From b9c505cbf4acd6f9fa5ebe183f434b72ac3199f7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 4 May 2026 02:49:20 -0400 Subject: [PATCH] d_prune_aliases(): make sure to skip NORCU aliases Either they are busy (in which case they won't be moved to shrink list anyway) or they have a zero refcount, in which case we really shouldn't mess with them - whoever had dropped the refcount to zero is on the way to evicting and freeing them. That way we are guaranteed that only the thread that has dropped refcount of NORCU dentry to zero might call lock_for_kill() and __dentry_kill() for those. Signed-off-by: Al Viro --- fs/dcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dcache.c b/fs/dcache.c index ea26bd2dd2b2..b5604b84bafb 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1200,7 +1200,8 @@ void d_prune_aliases(struct inode *inode) spin_lock(&inode->i_lock); for_each_alias(dentry, inode) { spin_lock(&dentry->d_lock); - __move_to_shrink_list(dentry, &dispose); + if (likely(!(dentry->d_flags & DCACHE_NORCU))) + __move_to_shrink_list(dentry, &dispose); spin_unlock(&dentry->d_lock); } spin_unlock(&inode->i_lock);