]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
d_prune_aliases(): make sure to skip NORCU aliases
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 May 2026 06:49:20 +0000 (02:49 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 5 Jun 2026 04:34:55 +0000 (00:34 -0400)
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 <viro@zeniv.linux.org.uk>
fs/dcache.c

index ea26bd2dd2b27cc85a25890f7334399240cc625b..b5604b84bafba4fe04c9a28e3b962b0df1967d3d 100644 (file)
@@ -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);