]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/9p: Add p9_debug(VFS) in d_revalidate
authorTingmao Wang <m@maowtm.org>
Sun, 6 Apr 2025 16:18:44 +0000 (17:18 +0100)
committerDominique Martinet <asmadeus@codewreck.org>
Sat, 23 Aug 2025 06:34:46 +0000 (15:34 +0900)
This was a useful debugging / validation aid, and can explain why a
GETATTR request is made.

Signed-off-by: Tingmao Wang <m@maowtm.org>
Message-ID: <00829a99549e33d26139fa4d756c466629f13e00.1743956147.git.m@maowtm.org>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
fs/9p/vfs_dentry.c

index ddf7424b5850cbf25eb50560e6791097ee7fd555..f3248a3e54023489054337bf98e87a1d7b1fbafc 100644 (file)
@@ -85,8 +85,13 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
                struct v9fs_session_info *v9ses;
 
                fid = v9fs_fid_lookup(dentry);
-               if (IS_ERR(fid))
+               if (IS_ERR(fid)) {
+                       p9_debug(
+                               P9_DEBUG_VFS,
+                               "v9fs_fid_lookup: dentry = %pd (%p), got error %pe\n",
+                               dentry, dentry, fid);
                        return PTR_ERR(fid);
+               }
 
                v9ses = v9fs_inode2v9ses(inode);
                if (v9fs_proto_dotl(v9ses))
@@ -95,14 +100,25 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
                        retval = v9fs_refresh_inode(fid, inode);
                p9_fid_put(fid);
 
-               if (retval == -ENOENT)
+               if (retval == -ENOENT) {
+                       p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) invalidated due to ENOENT\n",
+                                dentry, dentry);
                        return 0;
-               if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR)
+               }
+               if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
+                       p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) invalidated due to type change\n",
+                                dentry, dentry);
                        return 0;
-               if (retval < 0)
+               }
+               if (retval < 0) {
+                       p9_debug(P9_DEBUG_VFS,
+                               "refresh inode: dentry = %pd (%p), got error %pe\n",
+                               dentry, dentry, ERR_PTR(retval));
                        return retval;
+               }
        }
 out_valid:
+       p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) is valid\n", dentry, dentry);
        return 1;
 }