]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: add WARN_ON and comment for RCU revalidate
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 3 Nov 2025 13:10:38 +0000 (14:10 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 12 Nov 2025 10:45:03 +0000 (11:45 +0100)
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/super.c

index 43ee4c7296a77e155552913f1ee9e4c7ca22236f..a153f449e2ad441e34cc4123f806ab3ef5f60453 100644 (file)
@@ -128,9 +128,17 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry,
        unsigned int i;
        int ret = 1;
 
-       /* Careful in RCU mode */
-       if (!inode)
+       if (!inode) {
+               /*
+                * Lookup of negative dentries will call ovl_dentry_init_flags()
+                * with NULL upperdentry and NULL oe, resulting in the
+                * DCACHE_OP*_REVALIDATE flags being cleared.  Hence the only
+                * way to get a negative inode is due to a race with dentry
+                * destruction.
+                */
+               WARN_ON(!(flags & LOOKUP_RCU));
                return -ECHILD;
+       }
 
        oe = OVL_I_E(inode);
        lowerstack = ovl_lowerstack(oe);