nfsd: observability improvements
Subsystems (3)
[email protected]
maintainerv4 cover nfsd: observability improvements
From: Chuck Lever <[email protected]>
These needed enough cosmetic changes that a v4 posting is warranted.
Some of these could add a few more arguments, but the basic infrastructure is solid enough to run with.
Changes in v4:
- Replace usage of __array/memcpy for capturing sockaddrs
- Add NFSD_TRACE_PROC_CALL macros instead of re-using SVC_RQST_ENDPOINT
- Const-ify tracepoint pointer arguments
- Rename nfsd_setattr and nfsd_lookup_dentry tracepoints to include _vfs_
- Restructure the new READDIR tracepoint to capture the "count" argument
- Add non-empty patch descriptions to silence checkpatch.pl
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- move most of the tracepoints into non-version specific nfsd/vfs.c calls
- rename them with a nfsd_vfs_* prefix
- remove the dprintks in separate patches
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Break tracepoints out into multiple patches
- Flesh out the tracepoints in these locations to display the same info
as legacy dprintks.
- have all the tracepoints SVC_XPRT_ENDPOINT_* info
- update svc_xprt_dequeue tracepoint to show how long xprt was on queue
- Link to v1: https://lore.kernel.org/r/[email protected]
Chuck Lever (2):
NFSD: Use sockaddr instead of a generic array
NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros
Jeff Layton (16):
nfsd: add a tracepoint for nfsd_setattr
nfsd: add a tracepoint to nfsd_lookup_dentry
nfsd: add nfsd_vfs_create tracepoints
nfsd: add tracepoint to nfsd_symlink
nfsd: add tracepoint to nfsd_link()
nfsd: add tracepoints for unlink events
nfsd: add tracepoint to nfsd_rename
nfsd: add tracepoint to nfsd_readdir
nfsd: add tracepoint for getattr and statfs events
nfsd: remove old v2/3 create path dprintks
nfsd: remove old v2/3 SYMLINK dprintks
nfsd: remove old LINK dprintks
nfsd: remove REMOVE/RMDIR dprintks
nfsd: remove dprintks for v2/3 RENAME events
nfsd: remove legacy READDIR dprintks
nfsd: remove legacy dprintks from GETATTR and STATFS codepaths
fs/nfsd/nfs3proc.c | 63 +-------- fs/nfsd/nfs4proc.c | 5 + fs/nfsd/nfsproc.c | 35 +---- fs/nfsd/trace.h | 300 ++++++++++++++++++++++++++++++++++++++-- fs/nfsd/vfs.c | 16 ++- include/trace/misc/fs.h | 21 +++ 6 files changed, 336 insertions(+), 104 deletions(-)
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 1/18 NFSD: Use sockaddr instead of a generic array
From: Chuck Lever <[email protected]>
Record and emit presentation addresses using tracing helpers designed for the task.
--- fs/nfsd/trace.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
fs/nfsd/trace.h +15 -14
@@ -18,22 +18,23 @@#include "nfsfh.h" #include "xdr4.h" -#define NFSD_TRACE_PROC_RES_FIELDS \ +#define NFSD_TRACE_PROC_RES_FIELDS (r) \ __field(unsigned int, netns_ino) \ __field(u32, xid) \ __field(unsigned long, status) \ - __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ - __array(unsigned char, client, sizeof(struct sockaddr_in6)) + __sockaddr(server, (r)->rq_xprt->xpt_locallen) \ + __sockaddr(client, (r)->rq_xprt->xpt_remotelen) -#define NFSD_TRACE_PROC_RES_ASSIGNMENTS (error) \ +#define NFSD_TRACE_PROC_RES_ASSIGNMENTS (r, error) \ do { \ - __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ - __entry->xid = be32_to_cpu(rqstp->rq_xid); \ + struct svc_xprt *xprt = (r)->rq_xprt; \ + __entry->netns_ino = SVC_NET(r)->ns.inum; \ + __entry->xid = be32_to_cpu((r)->rq_xid); \ __entry->status = be32_to_cpu(error); \ - memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ - rqstp->rq_xprt->xpt_locallen); \ - memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ - rqstp->rq_xprt->xpt_remotelen); \ + __assign_sockaddr(server, &xprt->xpt_local, \ + xprt->xpt_locallen); \ + __assign_sockaddr(client, &xprt->xpt_remote, \ + xprt->xpt_remotelen); \ } while (0); DECLARE_EVENT_CLASS(nfsd_xdr_err_class,
@@ -145,14 +146,14 @@ TRACE_EVENT(nfsd_compound_decode_err, ),TP_ARGS (rqstp, args_opcnt, resp_opcnt, opnum, status),TP_STRUCT__entry ( - NFSD_TRACE_PROC_RES_FIELDS + NFSD_TRACE_PROC_RES_FIELDS(rqstp) __field(u32, args_opcnt) __field(u32, resp_opcnt)__field (u32, opnum) ),TP_fast_assign ( -NFSD_TRACE_PROC_RES_ASSIGNMENTS (status) +NFSD_TRACE_PROC_RES_ASSIGNMENTS (rqstp, status) __entry->args_opcnt = args_opcnt; __entry->resp_opcnt = resp_opcnt;
@@ -171,12 +172,12 @@ DECLARE_EVENT_CLASS(nfsd_compound_err_class, ),TP_ARGS (rqstp, opnum, status),TP_STRUCT__entry ( - NFSD_TRACE_PROC_RES_FIELDS + NFSD_TRACE_PROC_RES_FIELDS(rqstp)__field (u32, opnum) ),TP_fast_assign ( -NFSD_TRACE_PROC_RES_ASSIGNMENTS (status) +NFSD_TRACE_PROC_RES_ASSIGNMENTS (rqstp, status) __entry->opnum = opnum; ),
Signature · 1 line
2.49.0
Re: [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array
Quoted 70 lines · On Sat, 2025-05-03 at 15:59 -0400, [email protected] wrote:
From: Chuck Lever <[email protected]>
Record and emit presentation addresses using tracing helpers designed for the task.
Signed-off-by Chuck Lever <[email protected]>--- fs/nfsd/trace.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)fs/nfsd/trace.h +13
-13@@ -18,22 +18,23 @@#include "nfsfh.h" #include "xdr4.h" -#define NFSD_TRACE_PROC_RES_FIELDS \ +#define NFSD_TRACE_PROC_RES_FIELDS (r) \ __field(unsigned int, netns_ino) \ __field(u32, xid) \ __field(unsigned long, status) \ - __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ - __array(unsigned char, client, sizeof(struct sockaddr_in6)) + __sockaddr(server, (r)->rq_xprt->xpt_locallen) \ + __sockaddr(client, (r)->rq_xprt->xpt_remotelen) -#define NFSD_TRACE_PROC_RES_ASSIGNMENTS (error) \ +#define NFSD_TRACE_PROC_RES_ASSIGNMENTS (r, error) \ do { \ - __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ - __entry->xid = be32_to_cpu(rqstp->rq_xid); \ + struct svc_xprt *xprt = (r)->rq_xprt; \ + __entry->netns_ino = SVC_NET(r)->ns.inum; \ + __entry->xid = be32_to_cpu((r)->rq_xid); \ __entry->status = be32_to_cpu(error); \ - memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ - rqstp->rq_xprt->xpt_locallen); \ - memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ - rqstp->rq_xprt->xpt_remotelen); \ + __assign_sockaddr(server, &xprt->xpt_local, \ + xprt->xpt_locallen); \ + __assign_sockaddr(client, &xprt->xpt_remote, \ + xprt->xpt_remotelen); \ } while (0); DECLARE_EVENT_CLASS(nfsd_xdr_err_class,@@ -145,14 +146,14 @@ TRACE_EVENT(nfsd_compound_decode_err, ),TP_ARGS (rqstp, args_opcnt, resp_opcnt, opnum, status),TP_STRUCT__entry ( - NFSD_TRACE_PROC_RES_FIELDS + NFSD_TRACE_PROC_RES_FIELDS(rqstp) __field(u32, args_opcnt) __field(u32, resp_opcnt)__field (u32, opnum) ),TP_fast_assign ( -NFSD_TRACE_PROC_RES_ASSIGNMENTS (status) +NFSD_TRACE_PROC_RES_ASSIGNMENTS (rqstp, status) __entry->args_opcnt = args_opcnt; __entry->resp_opcnt = resp_opcnt;@@ -171,12 +172,12 @@ DECLARE_EVENT_CLASS(nfsd_compound_err_class, ),TP_ARGS (rqstp, opnum, status), TP_STRUCT__entry( - NFSD_TRACE_PROC_RES_FIELDS
fs/nfsd/trace.h DECLARE_EVENT_CLASS(nfsd_compound_err_class, · line 183
Quoted 10 lines
fs/nfsd/trace.h +2
-1+ NFSD_TRACE_PROC_RES_FIELDS(rqstp) __field(u32, opnum) ), TP_fast_assign( -NFSD_TRACE_PROC_RES_ASSIGNMENTS (status) + NFSD_TRACE_PROC_RES_ASSIGNMENTS(rqstp, status) __entry->opnum = opnum; ),
Good idea.
[email protected]
maintainerPATCH v4 2/18 NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros
In reply to [email protected]From: Chuck Lever <[email protected]>
Introduce tracing helpers that can be used before the procedure status code is known. These macros are similar to the SVC_RQST_ENDPOINT helpers, but they can be modified to include NFS-specific fields if that is needed later.
--- fs/nfsd/trace.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/nfsd/trace.h +17 -0
@@ -18,6 +18,23 @@#include "nfsfh.h" #include "xdr4.h" +#define NFSD_TRACE_PROC_CALL_FIELDS (r) \ + __field(unsigned int, netns_ino) \ + __field(u32, xid) \ + __sockaddr(server, (r)->rq_xprt->xpt_locallen) \ + __sockaddr(client, (r)->rq_xprt->xpt_remotelen) + +#define NFSD_TRACE_PROC_CALL_ASSIGNMENTS (r) \ + do { \ + struct svc_xprt *xprt = (r)->rq_xprt; \ + __entry->netns_ino = SVC_NET(r)->ns.inum; \ + __entry->xid = be32_to_cpu((r)->rq_xid); \ + __assign_sockaddr(server, &xprt->xpt_local, \ + xprt->xpt_locallen); \ + __assign_sockaddr(client, &xprt->xpt_remote, \ + xprt->xpt_remotelen); \ + } while (0) +#define NFSD_TRACE_PROC_RES_FIELDS (r) \ __field(unsigned int, netns_ino) \ __field(u32, xid) \
Signature · 1 line
2.49.0
Re: [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros
Quoted 30 lines · On Sat, 2025-05-03 at 15:59 -0400, [email protected] wrote:
From: Chuck Lever <[email protected]>
Introduce tracing helpers that can be used before the procedure status code is known. These macros are similar to the
SVC_RQST_ENDPOINThelpers, but they can be modified to include NFS-specific fields if that is needed later.Signed-off-by Chuck Lever <[email protected]>--- fs/nfsd/trace.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)fs/nfsd/trace.h +10
-0@@ -18,6 +18,23 @@#include "nfsfh.h" #include "xdr4.h" +#define NFSD_TRACE_PROC_CALL_FIELDS (r) \ + __field(unsigned int, netns_ino) \ + __field(u32, xid) \ + __sockaddr(server, (r)->rq_xprt->xpt_locallen) \ + __sockaddr(client, (r)->rq_xprt->xpt_remotelen) + +#define NFSD_TRACE_PROC_CALL_ASSIGNMENTS (r) \ + do { \ + struct svc_xprt *xprt = (r)->rq_xprt; \ + __entry->netns_ino = SVC_NET(r)->ns.inum; \
fs/nfsd/trace.h line 40
Quoted 10 lines
fs/nfsd/trace.h +7
-0+ __entry->xid =be32_to_cpu ((r)->rq_xid); \ +__assign_sockaddr (server, &xprt->xpt_local, \ + xprt->xpt_locallen); \ +__assign_sockaddr (client, &xprt->xpt_remote, \ + xprt->xpt_remotelen); \ + } while (0) +#define NFSD_TRACE_PROC_RES_FIELDS (r) \ __field(unsigned int, netns_ino) \ __field(u32, xid) \
[email protected]
maintainerPATCH v4 3/18 nfsd: add a tracepoint for nfsd_setattr
In reply to [email protected]From: Jeff Layton <[email protected]>
Turn Sargun's internal kprobe based implementation of this into a normal static tracepoint. Also, remove the dprintk's that got added recently with the fix for zero-length ACLs.
--- fs/nfsd/trace.h | 39 +++++++++++++++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ include/trace/misc/fs.h | 21 +++++++++++++++++++++ 3 files changed, 62 insertions(+)
fs/nfsd/trace.h +39 -0
@@ -11,6 +11,7 @@#include <linux/tracepoint.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/xprt.h> +#include <trace/misc/fs.h> #include <trace/misc/nfs.h> #include <trace/misc/sunrpc.h>
@@ -2355,6 +2356,44 @@ DEFINE_EVENT(nfsd_copy_async_done_class, \DEFINE_COPY_ASYNC_DONE_EVENT (done);DEFINE_COPY_ASYNC_DONE_EVENT (cancel); +TRACE_EVENT (nfsd_vfs_setattr, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp, + const struct iattr *iap, + const struct timespec64 *guardtime + ), +TP_ARGS (rqstp, fhp, iap, guardtime), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) + __field(s64, gtime_tv_sec) + __field(u32, gtime_tv_nsec) + __field(unsigned int, ia_valid) + __field(loff_t, ia_size) + __field(uid_t, ia_uid) + __field(gid_t, ia_gid) +__field (umode_t, ia_mode) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __entry->gtime_tv_sec = guardtime ? guardtime->tv_sec : 0; + __entry->gtime_tv_nsec = guardtime ? guardtime->tv_nsec : 0; + __entry->ia_valid = iap->ia_valid; + __entry->ia_size = iap->ia_size; + __entry->ia_uid = __kuid_val(iap->ia_uid); + __entry->ia_gid = __kgid_val(iap->ia_gid); + __entry->ia_mode = iap->ia_mode; + ), +TP_printk ( +"xid=0x%08x fh_hash=0x%08x ia_valid=%s ia_size=%llu ia_mode=0%o ia_uid=%u ia_gid=%u guard_time=%lld.%u" , + __entry->xid, __entry->fh_hash,show_ia_valid_flags (__entry->ia_valid), + __entry->ia_size, __entry->ia_mode, __entry->ia_uid, __entry->ia_gid, + __entry->gtime_tv_sec, __entry->gtime_tv_nsec + ) +) +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -501,6 +501,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,bool size_change = (iap->ia_valid &ATTR_SIZE );int retries; +trace_nfsd_vfs_setattr (rqstp, fhp, iap, guardtime); +if (iap->ia_valid &ATTR_SIZE ) { accmode |=NFSD_MAY_WRITE |NFSD_MAY_OWNER_OVERRIDE ; ftype =S_IFREG ;
include/trace/misc/fs.h +21 -0
@@ -120,3 +120,24 @@ { LOOKUP_BENEATH, "BENEATH" }, \ { LOOKUP_IN_ROOT, "IN_ROOT" }, \ { LOOKUP_CACHED, "CACHED" }) + +#define show_ia_valid_flags (flags) \ + __print_flags(flags, "|", \ + { ATTR_MODE, "MODE" }, \ + { ATTR_UID, "UID" }, \ + { ATTR_GID, "GID" }, \ + { ATTR_SIZE, "SIZE" }, \ + { ATTR_ATIME, "ATIME" }, \ + { ATTR_MTIME, "MTIME" }, \ + { ATTR_CTIME, "CTIME" }, \ + { ATTR_ATIME_SET, "ATIME_SET" }, \ + { ATTR_MTIME_SET, "MTIME_SET" }, \ + { ATTR_FORCE, "FORCE" }, \ + { ATTR_KILL_SUID, "KILL_SUID" }, \ + { ATTR_KILL_SGID, "KILL_SGID" }, \ + { ATTR_FILE, "FILE" }, \ + { ATTR_KILL_PRIV, "KILL_PRIV" }, \ + { ATTR_OPEN, "OPEN" }, \ + { ATTR_TIMES_SET, "TIMES_SET" }, \ + { ATTR_TOUCH, "TOUCH"}, \ + { ATTR_DELEG, "DELEG"})
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 4/18 nfsd: add a tracepoint to nfsd_lookup_dentry
In reply to [email protected]From: Jeff Layton <[email protected]>
Replace the dprintk in nfsd_lookup_dentry() with a trace point. nfsd_lookup_dentry() is called frequently enough that enabling this dprintk call site would result in log floods and performance issues.
--- fs/nfsd/trace.h | 23 +++++++++++++++++++++++ fs/nfsd/vfs.c | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-)
fs/nfsd/trace.h +23 -0
@@ -2394,6 +2394,29 @@ TRACE_EVENT(nfsd_vfs_setattr, ) ) +TRACE_EVENT (nfsd_vfs_lookup, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp, + const char *name, + unsigned int len + ), +TP_ARGS (rqstp, fhp, name, len), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) +__string_len (name, name, len) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __assign_str(name); + ), +TP_printk ("xid=0x%08x fh_hash=0x%08x name=%s" , + __entry->xid, __entry->fh_hash,__get_str (name) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +1 -1
@@ -246,7 +246,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,struct dentry *dentry;int host_err; -dprintk ("nfsd: nfsd_lookup(fh %s, %.*s)\n" ,SVCFH_fmt (fhp), len,name); +trace_nfsd_vfs_lookup (rqstp, fhp, name, len); dparent = fhp->fh_dentry; exp =exp_get (fhp->fh_export);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 5/18 nfsd: add nfsd_vfs_create tracepoints
In reply to [email protected]From: Jeff Layton <[email protected]>
Observe the start of file and directory creation for all NFS versions.
--- fs/nfsd/nfs3proc.c | 3 +++ fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 3 files changed, 32 insertions(+)
fs/nfsd/nfs3proc.c +3 -0
@@ -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 ))
fs/nfsd/trace.h +27 -0
@@ -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
fs/nfsd/vfs.c +2 -0
@@ -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;
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 6/18 nfsd: add tracepoint to nfsd_symlink
In reply to [email protected]From: Jeff Layton <[email protected]>
Observe the start of SYMLINK operations for all NFS versions.
--- fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 2 files changed, 29 insertions(+)
fs/nfsd/trace.h +27 -0
@@ -2444,6 +2444,33 @@ TRACE_EVENT(nfsd_vfs_create, ) ); +TRACE_EVENT (nfsd_vfs_symlink, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp, + const char *name, + unsigned int namelen, + const char *target + ), +TP_ARGS (rqstp, fhp, name, namelen, target), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) + __string_len(name, name, namelen) +__string (target, target) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __assign_str(name); + __assign_str(target); + ), +TP_printk ("xid=0x%08x fh_hash=0x%08x name=%s target=%s" , + __entry->xid, __entry->fh_hash, +__get_str (name),__get_str (target) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -1651,6 +1651,8 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,__be32 err, cerr;int host_err; +trace_nfsd_vfs_symlink (rqstp, fhp, fname, flen, path); + err = nfserr_noent;if (!flen || path[0 ] =='\0' ) goto out;
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 7/18 nfsd: add tracepoint to nfsd_link()
In reply to [email protected]From: Jeff Layton <[email protected]>
--- fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 2 files changed, 29 insertions(+)
fs/nfsd/trace.h +27 -0
@@ -2471,6 +2471,33 @@ TRACE_EVENT(nfsd_vfs_symlink, ) ); +TRACE_EVENT (nfsd_vfs_link, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *sfhp, + const struct svc_fh *tfhp, + const char *name, + unsigned int namelen + ), +TP_ARGS (rqstp, sfhp, tfhp, name, namelen), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, sfh_hash) + __field(u32, tfh_hash) +__string_len (name, name, namelen) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->sfh_hash = knfsd_fh_hash(&sfhp->fh_handle); + __entry->tfh_hash = knfsd_fh_hash(&tfhp->fh_handle); + __assign_str(name); + ), +TP_printk ("xid=0x%08x src_fh=0x%08x tgt_fh=0x%08x name=%s" , + __entry->xid, __entry->sfh_hash, __entry->tfh_hash, +__get_str (name) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -1721,6 +1721,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,__be32 err;int host_err; +trace_nfsd_vfs_link (rqstp, ffhp, tfhp, name, len); + err =fh_verify (rqstp, ffhp,S_IFDIR ,NFSD_MAY_CREATE );if (err) goto out;
Signature · 1 line
2.49.0
Jeff Layton
maintainerRe: [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()
Quoted 2 lines · On Sat, 2025-05-03 at 15:59 -0400, [email protected] wrote:
From: Jeff Layton <[email protected]>
Looks like this one didn't get an expanded changelog?
Quoted 58 lines
Signed-off-by Jeff Layton <[email protected]>Signed-off-by Chuck Lever <[email protected]>--- fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 2 files changed, 29 insertions(+)fs/nfsd/trace.h +27
-0@@ -2471,6 +2471,33 @@ TRACE_EVENT(nfsd_vfs_symlink, ) ); +TRACE_EVENT (nfsd_vfs_link, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *sfhp, + const struct svc_fh *tfhp, + const char *name, + unsigned int namelen + ), +TP_ARGS (rqstp, sfhp, tfhp, name, namelen), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, sfh_hash) + __field(u32, tfh_hash) +__string_len (name, name, namelen) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->sfh_hash = knfsd_fh_hash(&sfhp->fh_handle); + __entry->tfh_hash = knfsd_fh_hash(&tfhp->fh_handle); + __assign_str(name); + ), +TP_printk ("xid=0x%08x src_fh=0x%08x tgt_fh=0x%08x name=%s" , + __entry->xid, __entry->sfh_hash, __entry->tfh_hash, +__get_str (name) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATHfs/nfsd/vfs.c +2
-0@@ -1721,6 +1721,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,__be32 err;int host_err; +trace_nfsd_vfs_link (rqstp, ffhp, tfhp, name, len); + err =fh_verify (rqstp, ffhp,S_IFDIR ,NFSD_MAY_CREATE );if (err) goto out;
Signature · 1 line
Jeff Layton <[email protected]>
[email protected]
maintainerPATCH v4 8/18 nfsd: add tracepoints for unlink events
In reply to [email protected]From: Jeff Layton <[email protected]>
Observe the start of UNLINK, REMOVE, and RMDIR operations for all NFS versions.
--- fs/nfsd/trace.h | 24 ++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 2 files changed, 26 insertions(+)
fs/nfsd/trace.h +24 -0
@@ -2498,6 +2498,30 @@ TRACE_EVENT(nfsd_vfs_link, ) ); +TRACE_EVENT (nfsd_vfs_unlink, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp, + const char *name, + unsigned int len + ), +TP_ARGS (rqstp, fhp, name, len), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) +__string_len (name, name, len) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __assign_str(name); + ), +TP_printk ("xid=0x%08x fh_hash=0x%08x name=%s" , + __entry->xid, __entry->fh_hash, +__get_str (name) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -1998,6 +1998,8 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,__be32 err;int host_err; +trace_nfsd_vfs_unlink (rqstp, fhp, fname, flen); + err = nfserr_acces;if (!flen ||isdotent (fname, flen)) goto out;
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 9/18 nfsd: add tracepoint to nfsd_rename
In reply to [email protected]From: Jeff Layton <[email protected]>
Observe the start of RENAME operations for all NFS versions.
--- fs/nfsd/trace.h | 31 +++++++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 2 files changed, 33 insertions(+)
fs/nfsd/trace.h +31 -0
@@ -2522,6 +2522,37 @@ TRACE_EVENT(nfsd_vfs_unlink, ) ); +TRACE_EVENT (nfsd_vfs_rename, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *sfhp, + const struct svc_fh *tfhp, + const char *source, + unsigned int sourcelen, + const char *target, + unsigned int targetlen + ), +TP_ARGS (rqstp, sfhp, tfhp, source, sourcelen, target, targetlen), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, sfh_hash) + __field(u32, tfh_hash) + __string_len(source, source, sourcelen) +__string_len (target, target, targetlen) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->sfh_hash = knfsd_fh_hash(&sfhp->fh_handle); + __entry->tfh_hash = knfsd_fh_hash(&tfhp->fh_handle); + __assign_str(source); + __assign_str(target); + ), +TP_printk ("xid=0x%08x sfh_hash=0x%08x tfh_hash=0x%08x source=%s target=%s" , + __entry->xid, __entry->sfh_hash, __entry->tfh_hash, +__get_str (source),__get_str (target) + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -1840,6 +1840,8 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,int host_err;bool close_cached = false; +trace_nfsd_vfs_rename (rqstp, ffhp, tfhp, fname, flen, tname, tlen); + err =fh_verify (rqstp, ffhp,S_IFDIR ,NFSD_MAY_REMOVE );if (err) goto out;
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 10/18 nfsd: add tracepoint to nfsd_readdir
In reply to [email protected]From: Jeff Layton <[email protected]>
Observe the start of NFS READDIR operations.
The NFS READDIR's count argument can be interesting when tuning a client's readdir behavior.
However, the count argument is not passed to nfsd_readdir(). To properly capture the count argument, this tracepoint must appear in each proc function before the nfsd_readdir() call.
--- fs/nfsd/nfs3proc.c | 2 ++ fs/nfsd/nfs4proc.c | 3 +++ fs/nfsd/nfsproc.c | 2 ++ fs/nfsd/trace.h | 26 ++++++++++++++++++++++++++ 4 files changed, 33 insertions(+)
fs/nfsd/nfs3proc.c +2 -0
@@ -625,6 +625,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)dprintk ("nfsd: READDIR(3) %s %d bytes at %d\n" ,SVCFH_fmt (&argp->fh), argp->count, (u32 ) argp->cookie); +trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd3_init_dirlist_pages (rqstp, resp, argp->count);
@@ -659,6 +660,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)dprintk ("nfsd: READDIR+(3) %s %d bytes at %d\n" ,SVCFH_fmt (&argp->fh), argp->count, (u32 ) argp->cookie); +trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd3_init_dirlist_pages (rqstp, resp, argp->count);
fs/nfsd/nfs4proc.c +3 -0
@@ -998,6 +998,9 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,u64 cookie = readdir->rd_cookie;static const nfs4_verifier zeroverf; +trace_nfsd_vfs_readdir (rqstp, &cstate->current_fh, + readdir->rd_maxcount, readdir->rd_cookie); +/* no need to check permission - this will be done in nfsd_readdir() */ if (readdir->rd_bmval[1 ] &NFSD_WRITEONLY_ATTRS_WORD1 )
fs/nfsd/nfsproc.c +2 -0
@@ -10,6 +10,7 @@#include "cache.h" #include "xdr.h" #include "vfs.h" +#include "trace.h" #define NFSDDBG_FACILITY NFSDDBG_PROC
@@ -618,6 +619,7 @@ nfsd_proc_readdir(struct svc_rqst *rqstp)dprintk ("nfsd: READDIR %s %d bytes at %d\n" ,SVCFH_fmt (&argp->fh), argp->count, argp->cookie); +trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd_init_dirlist_pages (rqstp, resp, argp->count);
fs/nfsd/trace.h +26 -0
@@ -2553,6 +2553,32 @@ TRACE_EVENT(nfsd_vfs_rename, ) ); +TRACE_EVENT (nfsd_vfs_readdir, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp, + u32 count, + u64 offset + ), +TP_ARGS (rqstp, fhp, count, offset), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) + __field(u32, count) +__field (u64, offset) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __entry->count = count; + __entry->offset = offset; + ), +TP_printk ("xid=0x%08x fh_hash=0x%08x offset=%llu count=%u" , + __entry->xid, __entry->fh_hash, + __entry->offset, __entry->count + ) +); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 11/18 nfsd: add tracepoint for getattr and statfs events
In reply to [email protected]From: Jeff Layton <[email protected]>
There isn't a common helper for getattrs, so add these into the protocol-specific helpers.
--- fs/nfsd/nfs3proc.c | 2 ++ fs/nfsd/nfs4proc.c | 2 ++ fs/nfsd/nfsproc.c | 2 ++ fs/nfsd/trace.h | 30 ++++++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 5 files changed, 38 insertions(+)
fs/nfsd/nfs3proc.c +2 -0
@@ -70,6 +70,8 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)struct nfsd_fhandle *argp = rqstp->rq_argp;struct nfsd3_attrstat *resp = rqstp->rq_resp; +trace_nfsd_vfs_getattr (rqstp, &argp->fh); +dprintk ("nfsd: GETATTR(3) %s\n" ,SVCFH_fmt (&argp->fh));
fs/nfsd/nfs4proc.c +2 -0
@@ -876,6 +876,8 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,struct nfsd4_getattr *getattr = &u->getattr;__be32 status; +trace_nfsd_vfs_getattr (rqstp, &cstate->current_fh); + status =fh_verify (rqstp, &cstate->current_fh,0 ,NFSD_MAY_NOP );if (status)return status;
fs/nfsd/nfsproc.c +2 -0
@@ -55,6 +55,8 @@ nfsd_proc_getattr(struct svc_rqst *rqstp)struct nfsd_fhandle *argp = rqstp->rq_argp;struct nfsd_attrstat *resp = rqstp->rq_resp; +trace_nfsd_vfs_getattr (rqstp, &argp->fh); +dprintk ("nfsd: GETATTR %s\n" ,SVCFH_fmt (&argp->fh));fh_copy (&resp->fh, &argp->fh);
fs/nfsd/trace.h +30 -0
@@ -2579,6 +2579,36 @@ TRACE_EVENT(nfsd_vfs_readdir, ) ); +DECLARE_EVENT_CLASS (nfsd_vfs_getattr_class, +TP_PROTO ( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp + ), +TP_ARGS (rqstp, fhp), +TP_STRUCT__entry ( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) +__field (u32, fh_hash) + ), +TP_fast_assign ( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + ), +TP_printk ("xid=0x%08x fh_hash=0x%08x" , + __entry->xid, __entry->fh_hash + ) +); + +#define DEFINE_NFSD_VFS_GETATTR_EVENT (__name) \ +DEFINE_EVENT(nfsd_vfs_getattr_class, __name, \ + TP_PROTO( \ + const struct svc_rqst *rqstp, \ + const struct svc_fh *fhp \ + ), \ + TP_ARGS(rqstp, fhp)) + +DEFINE_NFSD_VFS_GETATTR_EVENT (nfsd_vfs_getattr); +DEFINE_NFSD_VFS_GETATTR_EVENT (nfsd_vfs_statfs); +#endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH
fs/nfsd/vfs.c +2 -0
@@ -2290,6 +2290,8 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, in {__be32 err; +trace_nfsd_vfs_statfs (rqstp, fhp); + err =fh_verify (rqstp, fhp,0 ,NFSD_MAY_NOP | access);if (!err) { struct path path = {
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 12/18 nfsd: remove old v2/3 create path dprintks
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 15 --------------- fs/nfsd/nfsproc.c | 5 ----- 2 files changed, 20 deletions(-)
fs/nfsd/nfs3proc.c +0 -15
@@ -385,11 +385,6 @@ nfsd3_proc_create(struct svc_rqst *rqstp)struct nfsd3_diropres *resp = rqstp->rq_resp;svc_fh *dirfhp, *newfhp; -dprintk ("nfsd: CREATE(3) %s %.*s\n" , -SVCFH_fmt (&argp->fh), - argp->len, - argp->name); - dirfhp =fh_copy (&resp->dirfh, &argp->fh); newfhp =fh_init (&resp->fh,NFS3_FHSIZE );
@@ -410,11 +405,6 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp) .na_iattr = &argp->attrs, }; -dprintk ("nfsd: MKDIR(3) %s %.*s\n" , -SVCFH_fmt (&argp->fh), - argp->len, - argp->name); - argp->attrs.ia_valid &= ~ATTR_SIZE ;fh_copy (&resp->dirfh, &argp->fh);fh_init (&resp->fh,NFS3_FHSIZE );
@@ -479,11 +469,6 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)int type;dev_t rdev =0 ; -dprintk ("nfsd: MKNOD(3) %s %.*s\n" , -SVCFH_fmt (&argp->fh), - argp->len, - argp->name); -fh_copy (&resp->dirfh, &argp->fh);fh_init (&resp->fh,NFS3_FHSIZE );
fs/nfsd/nfsproc.c +0 -5
@@ -295,9 +295,6 @@ nfsd_proc_create(struct svc_rqst *rqstp)int hosterr;dev_t rdev =0 , wanted =new_decode_dev (attr->ia_size); -dprintk ("nfsd: CREATE %s %.*s\n" , -SVCFH_fmt (dirfhp), argp->len, argp->name); -/* First verify the parent file handle */ resp->status =fh_verify (rqstp, dirfhp,S_IFDIR ,NFSD_MAY_EXEC );if (resp->status != nfs_ok)
@@ -551,8 +548,6 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp) .na_iattr = &argp->attrs, }; -dprintk ("nfsd: MKDIR %s %.*s\n" ,SVCFH_fmt (&argp->fh), argp->len, argp->name); -if (resp->fh.fh_dentry) {printk (KERN_WARNING "nfsd_proc_mkdir: response already verified??\n" );
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 13/18 nfsd: remove old v2/3 SYMLINK dprintks
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 5 ----- fs/nfsd/nfsproc.c | 4 ---- 2 files changed, 9 deletions(-)
fs/nfsd/nfs3proc.c +0 -5
@@ -440,11 +440,6 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp) goto out; } -dprintk ("nfsd: SYMLINK(3) %s %.*s -> %.*s\n" , -SVCFH_fmt (&argp->ffh), - argp->flen, argp->fname, - argp->tlen, argp->tname); -fh_copy (&resp->dirfh, &argp->ffh);fh_init (&resp->fh,NFS3_FHSIZE ); resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname,
fs/nfsd/nfsproc.c +0 -4
@@ -519,10 +519,6 @@ nfsd_proc_symlink(struct svc_rqst *rqstp) goto out; } -dprintk ("nfsd: SYMLINK %s %.*s -> %.*s\n" , -SVCFH_fmt (&argp->ffh), argp->flen, argp->fname, - argp->tlen, argp->tname); -fh_init (&newfh,NFS_FHSIZE ); resp->status =nfsd_symlink (rqstp, &argp->ffh, argp->fname, argp->flen, argp->tname, &attrs, &newfh);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 14/18 nfsd: remove old LINK dprintks
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 7 ------- fs/nfsd/nfsproc.c | 7 ------- 2 files changed, 14 deletions(-)
fs/nfsd/nfs3proc.c +0 -7
@@ -559,13 +559,6 @@ nfsd3_proc_link(struct svc_rqst *rqstp)struct nfsd3_linkargs *argp = rqstp->rq_argp;struct nfsd3_linkres *resp = rqstp->rq_resp; -dprintk ("nfsd: LINK(3) %s ->\n" , -SVCFH_fmt (&argp->ffh)); -dprintk ("nfsd: -> %s %.*s\n" , -SVCFH_fmt (&argp->tfh), - argp->tlen, - argp->tname); -fh_copy (&resp->fh, &argp->ffh);fh_copy (&resp->tfh, &argp->tfh); resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
fs/nfsd/nfsproc.c +0 -7
@@ -481,13 +481,6 @@ nfsd_proc_link(struct svc_rqst *rqstp)struct nfsd_linkargs *argp = rqstp->rq_argp;struct nfsd_stat *resp = rqstp->rq_resp; -dprintk ("nfsd: LINK %s ->\n" , -SVCFH_fmt (&argp->ffh)); -dprintk ("nfsd: %s %.*s\n" , -SVCFH_fmt (&argp->tfh), - argp->tlen, - argp->tname); - resp->status =nfsd_link (rqstp, &argp->tfh, argp->tname, argp->tlen, &argp->ffh);fh_put (&argp->ffh);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 15/18 nfsd: remove REMOVE/RMDIR dprintks
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 10 ---------- fs/nfsd/nfsproc.c | 5 ----- 2 files changed, 15 deletions(-)
fs/nfsd/nfs3proc.c +0 -10
@@ -496,11 +496,6 @@ nfsd3_proc_remove(struct svc_rqst *rqstp)struct nfsd3_diropargs *argp = rqstp->rq_argp;struct nfsd3_attrstat *resp = rqstp->rq_resp; -dprintk ("nfsd: REMOVE(3) %s %.*s\n" , -SVCFH_fmt (&argp->fh), - argp->len, - argp->name); -/* Unlink. -S_IFDIR means file must not be a directory */ fh_copy (&resp->fh, &argp->fh); resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
@@ -518,11 +513,6 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp)struct nfsd3_diropargs *argp = rqstp->rq_argp;struct nfsd3_attrstat *resp = rqstp->rq_resp; -dprintk ("nfsd: RMDIR(3) %s %.*s\n" , -SVCFH_fmt (&argp->fh), - argp->len, - argp->name); -fh_copy (&resp->fh, &argp->fh); resp->status =nfsd_unlink (rqstp, &resp->fh,S_IFDIR , argp->name, argp->len);
fs/nfsd/nfsproc.c +0 -5
@@ -445,9 +445,6 @@ nfsd_proc_remove(struct svc_rqst *rqstp)struct nfsd_diropargs *argp = rqstp->rq_argp;struct nfsd_stat *resp = rqstp->rq_resp; -dprintk ("nfsd: REMOVE %s %.*s\n" ,SVCFH_fmt (&argp->fh), - argp->len, argp->name); -/* Unlink. -SIFDIR means file must not be a directory */ resp->status =nfsd_unlink (rqstp, &argp->fh, -S_IFDIR , argp->name, argp->len);
@@ -565,8 +562,6 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp)struct nfsd_diropargs *argp = rqstp->rq_argp;struct nfsd_stat *resp = rqstp->rq_resp; -dprintk ("nfsd: RMDIR %s %.*s\n" ,SVCFH_fmt (&argp->fh), argp->len, argp->name); - resp->status =nfsd_unlink (rqstp, &argp->fh,S_IFDIR , argp->name, argp->len);fh_put (&argp->fh);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 16/18 nfsd: remove dprintks for v2/3 RENAME events
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 9 --------- fs/nfsd/nfsproc.c | 5 ----- 2 files changed, 14 deletions(-)
fs/nfsd/nfs3proc.c +0 -9
@@ -526,15 +526,6 @@ nfsd3_proc_rename(struct svc_rqst *rqstp)struct nfsd3_renameargs *argp = rqstp->rq_argp;struct nfsd3_renameres *resp = rqstp->rq_resp; -dprintk ("nfsd: RENAME(3) %s %.*s ->\n" , -SVCFH_fmt (&argp->ffh), - argp->flen, - argp->fname); -dprintk ("nfsd: -> %s %.*s\n" , -SVCFH_fmt (&argp->tfh), - argp->tlen, - argp->tname); -fh_copy (&resp->ffh, &argp->ffh);fh_copy (&resp->tfh, &argp->tfh); resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
fs/nfsd/nfsproc.c +0 -5
@@ -459,11 +459,6 @@ nfsd_proc_rename(struct svc_rqst *rqstp)struct nfsd_renameargs *argp = rqstp->rq_argp;struct nfsd_stat *resp = rqstp->rq_resp; -dprintk ("nfsd: RENAME %s %.*s -> \n" , -SVCFH_fmt (&argp->ffh), argp->flen, argp->fname); -dprintk ("nfsd: -> %s %.*s\n" , -SVCFH_fmt (&argp->tfh), argp->tlen, argp->tname); - resp->status =nfsd_rename (rqstp, &argp->ffh, argp->fname, argp->flen, &argp->tfh, argp->tname, argp->tlen);fh_put (&argp->ffh);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 17/18 nfsd: remove legacy READDIR dprintks
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 6 ------ fs/nfsd/nfsproc.c | 3 --- 2 files changed, 9 deletions(-)
fs/nfsd/nfs3proc.c +0 -6
@@ -578,9 +578,6 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)struct nfsd3_readdirres *resp = rqstp->rq_resp;loff_t offset; -dprintk ("nfsd: READDIR(3) %s %d bytes at %d\n" , -SVCFH_fmt (&argp->fh), - argp->count, (u32 ) argp->cookie);trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd3_init_dirlist_pages (rqstp, resp, argp->count);
@@ -613,9 +610,6 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)struct nfsd3_readdirres *resp = rqstp->rq_resp;loff_t offset; -dprintk ("nfsd: READDIR+(3) %s %d bytes at %d\n" , -SVCFH_fmt (&argp->fh), - argp->count, (u32 ) argp->cookie);trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd3_init_dirlist_pages (rqstp, resp, argp->count);
fs/nfsd/nfsproc.c +0 -3
@@ -592,9 +592,6 @@ nfsd_proc_readdir(struct svc_rqst *rqstp)struct nfsd_readdirres *resp = rqstp->rq_resp;loff_t offset; -dprintk ("nfsd: READDIR %s %d bytes at %d\n" , -SVCFH_fmt (&argp->fh), - argp->count, argp->cookie);trace_nfsd_vfs_readdir (rqstp, &argp->fh, argp->count, argp->cookie);nfsd_init_dirlist_pages (rqstp, resp, argp->count);
Signature · 1 line
2.49.0
[email protected]
maintainerPATCH v4 18/18 nfsd: remove legacy dprintks from GETATTR and STATFS codepaths
In reply to [email protected]From: Jeff Layton <[email protected]>
Observability here is now covered by static tracepoints.
--- fs/nfsd/nfs3proc.c | 6 ------ fs/nfsd/nfsproc.c | 4 ---- 2 files changed, 10 deletions(-)
fs/nfsd/nfs3proc.c +0 -6
@@ -72,9 +72,6 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)trace_nfsd_vfs_getattr (rqstp, &argp->fh); -dprintk ("nfsd: GETATTR(3) %s\n" , -SVCFH_fmt (&argp->fh)); -fh_copy (&resp->fh, &argp->fh); resp->status =fh_verify (rqstp, &resp->fh,0 ,NFSD_MAY_NOP |NFSD_MAY_BYPASS_GSS_ON_ROOT );
@@ -651,9 +648,6 @@ nfsd3_proc_fsstat(struct svc_rqst *rqstp)struct nfsd_fhandle *argp = rqstp->rq_argp;struct nfsd3_fsstatres *resp = rqstp->rq_resp; -dprintk ("nfsd: FSSTAT(3) %s\n" , -SVCFH_fmt (&argp->fh)); - resp->status =nfsd_statfs (rqstp, &argp->fh, &resp->stats,0 );fh_put (&argp->fh); resp->status =nfsd3_map_status (resp->status);
fs/nfsd/nfsproc.c +0 -4
@@ -57,8 +57,6 @@ nfsd_proc_getattr(struct svc_rqst *rqstp)trace_nfsd_vfs_getattr (rqstp, &argp->fh); -dprintk ("nfsd: GETATTR %s\n" ,SVCFH_fmt (&argp->fh)); -fh_copy (&resp->fh, &argp->fh); resp->status =fh_verify (rqstp, &resp->fh,0 ,NFSD_MAY_NOP |NFSD_MAY_BYPASS_GSS_ON_ROOT );
@@ -617,8 +615,6 @@ nfsd_proc_statfs(struct svc_rqst *rqstp)struct nfsd_fhandle *argp = rqstp->rq_argp;struct nfsd_statfsres *resp = rqstp->rq_resp; -dprintk ("nfsd: STATFS %s\n" ,SVCFH_fmt (&argp->fh)); - resp->status =nfsd_statfs (rqstp, &argp->fh, &resp->stats,NFSD_MAY_BYPASS_GSS_ON_ROOT );fh_put (&argp->fh);
Signature · 1 line
2.49.0
Jeff Layton
maintainerQuoted 4 lines · On Sat, 2025-05-03 at 15:59 -0400, [email protected] wrote:
From: Chuck Lever <[email protected]>
These needed enough cosmetic changes that a v4 posting is warranted.
Thanks for the cleanups. Your changes look fine to me.
Quoted 55 lines
Some of these could add a few more arguments, but the basic infrastructure is solid enough to run with.
Changes in v4:
- Replace usage of __array/memcpy for capturing sockaddrs
- AddNFSD_TRACE_PROC_CALLmacros instead of re-usingSVC_RQST_ENDPOINT
- Const-ify tracepoint pointer arguments
- Renamenfsd_setattrandnfsd_lookup_dentrytracepoints to include _vfs_
- Restructure the new READDIR tracepoint to capture the "count" argument
- Add non-empty patch descriptions to silence checkpatch.pl
- Link to v3: https://lore.kernel.org/r/[email protected]Changes in v3:
- move most of the tracepoints into non-version specificnfsd/vfs.ccalls
- rename them with a nfsd_vfs_* prefix
- remove the dprintks in separate patches
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Break tracepoints out into multiple patches
- Flesh out the tracepoints in these locations to display the same info
as legacy dprintks.
- have all the tracepoints SVC_XPRT_ENDPOINT_* info
- updatesvc_xprt_dequeuetracepoint to show how long xprt was on queue
- Link to v1: https://lore.kernel.org/r/[email protected]Chuck Lever (2):
NFSD: Use sockaddr instead of a generic array
NFSD: Add a Call equivalent to theNFSD_TRACE_PROC_RESmacrosJeff Layton (16):
nfsd: add a tracepoint fornfsd_setattr
nfsd: add a tracepoint tonfsd_lookup_dentry
nfsd: addnfsd_vfs_createtracepoints
nfsd: add tracepoint tonfsd_symlink
nfsd: add tracepoint tonfsd_link()
nfsd: add tracepoints for unlink events
nfsd: add tracepoint tonfsd_rename
nfsd: add tracepoint tonfsd_readdir
nfsd: add tracepoint for getattr and statfs events
nfsd: remove old v2/3 create path dprintks
nfsd: remove old v2/3 SYMLINK dprintks
nfsd: remove old LINK dprintks
nfsd: remove REMOVE/RMDIR dprintks
nfsd: remove dprintks for v2/3 RENAME events
nfsd: remove legacy READDIR dprintks
nfsd: remove legacy dprintks from GETATTR and STATFS codepathsfs/nfsd/nfs3proc.c | 63 +-------- fs/nfsd/nfs4proc.c | 5 + fs/nfsd/nfsproc.c | 35 +---- fs/nfsd/trace.h | 300 ++++++++++++++++++++++++++++++++++++++-- fs/nfsd/vfs.c | 16 ++- include/trace/misc/fs.h | 21 +++ 6 files changed, 336 insertions(+), 104 deletions(-)
Signature · 1 line
Jeff Layton <[email protected]>