Skip to content

Commit b313a5f

Browse files
dgchinnerBen Myers
authored andcommitted
xfs: asserting lock not held during freeing not valid
When we free an inode, we do so via RCU. As an RCU lookup can occur at any time before we free an inode, and that lookup takes the inode flags lock, we cannot safely assert that the flags lock is not held just before marking it dead and running call_rcu() to free the inode. We check on allocation of a new inode structre that the lock is not held, so we still have protection against locks being leaked and hence not correctly initialised when allocated out of the slab. Hence just remove the assert... Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
1 parent 4885235 commit b313a5f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

fs/xfs/xfs_icache.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ xfs_inode_free(
119119
ip->i_itemp = NULL;
120120
}
121121

122-
/* asserts to verify all state is correct here */
123-
ASSERT(atomic_read(&ip->i_pincount) == 0);
124-
ASSERT(!spin_is_locked(&ip->i_flags_lock));
125-
ASSERT(!xfs_isiflocked(ip));
126-
127122
/*
128123
* Because we use RCU freeing we need to ensure the inode always
129124
* appears to be reclaimed with an invalid inode number when in the
@@ -135,6 +130,10 @@ xfs_inode_free(
135130
ip->i_ino = 0;
136131
spin_unlock(&ip->i_flags_lock);
137132

133+
/* asserts to verify all state is correct here */
134+
ASSERT(atomic_read(&ip->i_pincount) == 0);
135+
ASSERT(!xfs_isiflocked(ip));
136+
138137
call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
139138
}
140139

0 commit comments

Comments
 (0)