]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfs/localio: make trace_nfs_local_open_fh more useful
authorMike Snitzer <snitzer@kernel.org>
Fri, 19 Sep 2025 14:36:25 +0000 (10:36 -0400)
committerAnna Schumaker <anna.schumaker@oracle.com>
Tue, 30 Sep 2025 20:10:29 +0000 (16:10 -0400)
Always trigger trace event when LOCALIO opens a file.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/localio.c
fs/nfs/nfstrace.h

index 97abf62f109d2e9bf20fe2759e30d4e50baaab05..42ea50d42c9951d0cd167b596c35ad8c425d206b 100644 (file)
@@ -231,13 +231,13 @@ __nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
                    struct nfsd_file __rcu **pnf,
                    const fmode_t mode)
 {
+       int status = 0;
        struct nfsd_file *localio;
 
        localio = nfs_open_local_fh(&clp->cl_uuid, clp->cl_rpcclient,
                                    cred, fh, nfl, pnf, mode);
        if (IS_ERR(localio)) {
-               int status = PTR_ERR(localio);
-               trace_nfs_local_open_fh(fh, mode, status);
+               status = PTR_ERR(localio);
                switch (status) {
                case -ENOMEM:
                case -ENXIO:
@@ -247,6 +247,7 @@ __nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
                        nfs_local_probe(clp);
                }
        }
+       trace_nfs_local_open_fh(fh, mode, status);
        return localio;
 }
 
index 1356ce10236acb3c9b8324baecc5fe5daeafcde5..b51f0fa9e9afebac9a2d7497264e86a87f35982f 100644 (file)
@@ -1846,10 +1846,10 @@ TRACE_EVENT(nfs_local_open_fh,
                ),
 
                TP_printk(
-                       "error=%d fhandle=0x%08x mode=%s",
-                       __entry->error,
+                       "fhandle=0x%08x mode=%s result=%d",
                        __entry->fhandle,
-                       show_fs_fmode_flags(__entry->fmode)
+                       show_fs_fmode_flags(__entry->fmode),
+                       __entry->error
                )
 );