]> www.infradead.org Git - users/hch/misc.git/commitdiff
nfsd: add nfsd_vfs_create tracepoints
authorJeff Layton <jlayton@kernel.org>
Sat, 3 May 2025 19:59:23 +0000 (15:59 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 11 May 2025 23:48:31 +0000 (19:48 -0400)
Observe the start of file and directory creation for all NFS
versions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs3proc.c
fs/nfsd/trace.h
fs/nfsd/vfs.c

index 372bdcf5e07a5c835da240ecebb02e3576eb2ca6..5d2b081072e8c2e286c6815c34e5e58d4be15067 100644 (file)
@@ -14,6 +14,7 @@
 #include "xdr3.h"
 #include "vfs.h"
 #include "filecache.h"
+#include "trace.h"
 
 #define NFSDDBG_FACILITY               NFSDDBG_PROC
 
@@ -266,6 +267,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
        __be32 status;
        int host_err;
 
+       trace_nfsd_vfs_create(rqstp, fhp, S_IFREG, argp->name, argp->len);
+
        if (isdotent(argp->name, argp->len))
                return nfserr_exist;
        if (!(iap->ia_valid & ATTR_MODE))
index 661a870d62f5fb7218e5ce434bb581397f200d66..a71d605fd7b7acd63fb8bbafd4717a008f75c227 100644 (file)
@@ -2417,6 +2417,33 @@ TRACE_EVENT(nfsd_vfs_lookup,
        )
 );
 
+TRACE_EVENT(nfsd_vfs_create,
+       TP_PROTO(
+               const struct svc_rqst *rqstp,
+               const struct svc_fh *fhp,
+               umode_t type,
+               const char *name,
+               unsigned int len
+       ),
+       TP_ARGS(rqstp, fhp, type, name, len),
+       TP_STRUCT__entry(
+               NFSD_TRACE_PROC_CALL_FIELDS(rqstp)
+               __field(u32, fh_hash)
+               __field(umode_t, type)
+               __string_len(name, name, len)
+       ),
+       TP_fast_assign(
+               NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp);
+               __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
+               __entry->type = type;
+               __assign_str(name);
+       ),
+       TP_printk("xid=0x%08x fh_hash=0x%08x type=%s name=%s",
+               __entry->xid, __entry->fh_hash,
+               show_fs_file_type(__entry->type), __get_str(name)
+       )
+);
+
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH
index 657ba0c2da1452f697aac2ddf1dd05584502e71a..cc0efc47dc254f461a4e269e513d628cc004016e 100644 (file)
@@ -1549,6 +1549,8 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
        __be32          err;
        int             host_err;
 
+       trace_nfsd_vfs_create(rqstp, fhp, type, fname, flen);
+
        if (isdotent(fname, flen))
                return nfserr_exist;