Skip to content

Commit 8e25af0

Browse files
Brian Fostergregkh
authored andcommitted
xfs: support ability to wait on new inodes
commit 756baca27fff3ecaeab9dbc7a5ee35a1d7bc0c7f upstream. Inodes that are inserted into the perag tree but still under construction are flagged with the XFS_INEW bit. Most contexts either skip such inodes when they are encountered or have the ability to handle them. The runtime quotaoff sequence introduces a context that must wait for construction of such inodes to correctly ensure that all dquots in the fs are released. In anticipation of this, support the ability to wait on new inodes. Wake the appropriate bit when XFS_INEW is cleared. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cf55c35 commit 8e25af0

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

fs/xfs/xfs_icache.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,17 @@ xfs_iget_cache_hit(
210210

211211
error = inode_init_always(mp->m_super, inode);
212212
if (error) {
213+
bool wake;
213214
/*
214215
* Re-initializing the inode failed, and we are in deep
215216
* trouble. Try to re-add it to the reclaim list.
216217
*/
217218
rcu_read_lock();
218219
spin_lock(&ip->i_flags_lock);
219-
220+
wake = !!__xfs_iflags_test(ip, XFS_INEW);
220221
ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM);
222+
if (wake)
223+
wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
221224
ASSERT(ip->i_flags & XFS_IRECLAIMABLE);
222225
trace_xfs_iget_reclaim_fail(ip);
223226
goto out_error;

fs/xfs/xfs_inode.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ xfs_get_initial_prid(struct xfs_inode *dp)
208208
#define XFS_IRECLAIM (1 << 0) /* started reclaiming this inode */
209209
#define XFS_ISTALE (1 << 1) /* inode has been staled */
210210
#define XFS_IRECLAIMABLE (1 << 2) /* inode can be reclaimed */
211-
#define XFS_INEW (1 << 3) /* inode has just been allocated */
211+
#define __XFS_INEW_BIT 3 /* inode has just been allocated */
212+
#define XFS_INEW (1 << __XFS_INEW_BIT)
212213
#define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */
213214
#define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */
214215
#define __XFS_IFLOCK_BIT 7 /* inode is being flushed right now */
@@ -453,6 +454,7 @@ static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
453454
xfs_iflags_clear(ip, XFS_INEW);
454455
barrier();
455456
unlock_new_inode(VFS_I(ip));
457+
wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
456458
}
457459

458460
static inline void xfs_setup_existing_inode(struct xfs_inode *ip)

0 commit comments

Comments
 (0)