In the future when we only serialize the freeing of the inode on the reference count we could potentially be relying on ->i_lru to be consistent, which means we need it to be consistent under the ->i_lock. Move the list_add in evict_inodes() to under the ->i_lock to prevent potential races where we think the inode isn't on a list but is going to be added to the private dispose list. Signed-off-by: Josef Bacik --- fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/inode.c b/fs/inode.c index d1668f7fb73e..1992db5cd70a 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -975,8 +975,8 @@ void evict_inodes(struct super_block *sb) __iget(inode); inode_lru_list_del(inode); - spin_unlock(&inode->i_lock); list_add(&inode->i_lru, &dispose); + spin_unlock(&inode->i_lock); /* * We can have a ton of inodes to evict at unmount time given -- 2.49.0