All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/18] nfsd: observability improvements
@ 2025-05-03 19:59 cel
  2025-05-03 19:59 ` [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array cel
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

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/20250503-nfsd-tracepoints-v3-0-d89f445969af@kernel.org

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/20250409-nfsd-tracepoints-v2-0-cf4e084fdd9c@kernel.org

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/20250306-nfsd-tracepoints-v1-0-4405bf41b95f@kernel.org

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(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 20:29   ` Jeff Layton
  2025-05-03 19:59 ` [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros cel
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

Record and emit presentation addresses using tracing helpers
designed for the task.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 0d49fc064f72..f67ab3d1b506 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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;
 	),
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
  2025-05-03 19:59 ` [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 20:30   ` Jeff Layton
  2025-05-03 19:59 ` [PATCH v4 03/18] nfsd: add a tracepoint for nfsd_setattr cel
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

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.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index f67ab3d1b506..fc373c4d5fdd 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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) \
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 03/18] nfsd: add a tracepoint for nfsd_setattr
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
  2025-05-03 19:59 ` [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array cel
  2025-05-03 19:59 ` [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 04/18] nfsd: add a tracepoint to nfsd_lookup_dentry cel
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

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.

Cc: Sargun Dillon <sargun@sargun.me>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h         | 39 +++++++++++++++++++++++++++++++++++++++
 fs/nfsd/vfs.c           |  2 ++
 include/trace/misc/fs.h | 21 +++++++++++++++++++++
 3 files changed, 62 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index fc373c4d5fdd..b435276a1aaa 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 68f7d0094b06..9e0a858d2129 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
diff --git a/include/trace/misc/fs.h b/include/trace/misc/fs.h
index 738b97f22f36..0406ebe2a80a 100644
--- a/include/trace/misc/fs.h
+++ b/include/trace/misc/fs.h
@@ -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"})
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 04/18] nfsd: add a tracepoint to nfsd_lookup_dentry
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (2 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 03/18] nfsd: add a tracepoint for nfsd_setattr cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 05/18] nfsd: add nfsd_vfs_create tracepoints cel
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

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.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 23 +++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index b435276a1aaa..661a870d62f5 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 9e0a858d2129..657ba0c2da14 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 05/18] nfsd: add nfsd_vfs_create tracepoints
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (3 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 04/18] nfsd: add a tracepoint to nfsd_lookup_dentry cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 06/18] nfsd: add tracepoint to nfsd_symlink cel
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

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 |  3 +++
 fs/nfsd/trace.h    | 27 +++++++++++++++++++++++++++
 fs/nfsd/vfs.c      |  2 ++
 3 files changed, 32 insertions(+)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 372bdcf5e07a..5d2b081072e8 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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))
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 661a870d62f5..a71d605fd7b7 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 657ba0c2da14..cc0efc47dc25 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 06/18] nfsd: add tracepoint to nfsd_symlink
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (4 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 05/18] nfsd: add nfsd_vfs_create tracepoints cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link() cel
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observe the start of SYMLINK operations for all NFS versions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index a71d605fd7b7..e347cdaaa732 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index cc0efc47dc25..ecd453b260b6 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (5 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 06/18] nfsd: add tracepoint to nfsd_symlink cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 20:30   ` Jeff Layton
  2025-05-03 19:59 ` [PATCH v4 08/18] nfsd: add tracepoints for unlink events cel
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index e347cdaaa732..acbf94cfb720 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index ecd453b260b6..30702f36db98 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 08/18] nfsd: add tracepoints for unlink events
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (6 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link() cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 09/18] nfsd: add tracepoint to nfsd_rename cel
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observe the start of UNLINK, REMOVE, and RMDIR operations for all
NFS versions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 24 ++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index acbf94cfb720..e96585546d01 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 30702f36db98..820290e5328f 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 09/18] nfsd: add tracepoint to nfsd_rename
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (7 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 08/18] nfsd: add tracepoints for unlink events cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 10/18] nfsd: add tracepoint to nfsd_readdir cel
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observe the start of RENAME operations for all NFS versions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 31 +++++++++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 33 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index e96585546d01..46091d7f2260 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 820290e5328f..41314b2a8199 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 10/18] nfsd: add tracepoint to nfsd_readdir
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (8 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 09/18] nfsd: add tracepoint to nfsd_rename cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 11/18] nfsd: add tracepoint for getattr and statfs events cel
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

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.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 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(+)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 5d2b081072e8..80096a5c4865 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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);
 
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 77895e099673..483fd8b26f9d 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -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)
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 6dda081eb24c..c561af30c37a 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
 
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 46091d7f2260..bed58cf55c10 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 11/18] nfsd: add tracepoint for getattr and statfs events
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (9 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 10/18] nfsd: add tracepoint to nfsd_readdir cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 12/18] nfsd: remove old v2/3 create path dprintks cel
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

There isn't a common helper for getattrs, so add these into the
protocol-specific helpers.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 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(+)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 80096a5c4865..f6eb8331dc4b 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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));
 
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 483fd8b26f9d..2b16ee1ae461 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -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;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index c561af30c37a..8816cc565c0c 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index bed58cf55c10..3c5505ef5e3a 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -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
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 41314b2a8199..d0dfd97de4d3 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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 = {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 12/18] nfsd: remove old v2/3 create path dprintks
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (10 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 11/18] nfsd: add tracepoint for getattr and statfs events cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 13/18] nfsd: remove old v2/3 SYMLINK dprintks cel
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 15 ---------------
 fs/nfsd/nfsproc.c  |  5 -----
 2 files changed, 20 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index f6eb8331dc4b..a4dd1f7c202f 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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);
 
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 8816cc565c0c..eec925d84410 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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");
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 13/18] nfsd: remove old v2/3 SYMLINK dprintks
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (11 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 12/18] nfsd: remove old v2/3 create path dprintks cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 14/18] nfsd: remove old LINK dprintks cel
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 5 -----
 fs/nfsd/nfsproc.c  | 4 ----
 2 files changed, 9 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index a4dd1f7c202f..f207fba722eb 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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,
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index eec925d84410..a12ad08b000a 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 14/18] nfsd: remove old LINK dprintks
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (12 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 13/18] nfsd: remove old v2/3 SYMLINK dprintks cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 15/18] nfsd: remove REMOVE/RMDIR dprintks cel
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 7 -------
 fs/nfsd/nfsproc.c  | 7 -------
 2 files changed, 14 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index f207fba722eb..ebf9bcac9e7f 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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,
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index a12ad08b000a..6636fd075ca8 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 15/18] nfsd: remove REMOVE/RMDIR dprintks
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (13 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 14/18] nfsd: remove old LINK dprintks cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 16/18] nfsd: remove dprintks for v2/3 RENAME events cel
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 10 ----------
 fs/nfsd/nfsproc.c  |  5 -----
 2 files changed, 15 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index ebf9bcac9e7f..3b1d63d51bb2 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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);
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 6636fd075ca8..7581b1ef4183 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 16/18] nfsd: remove dprintks for v2/3 RENAME events
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (14 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 15/18] nfsd: remove REMOVE/RMDIR dprintks cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 17/18] nfsd: remove legacy READDIR dprintks cel
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 9 ---------
 fs/nfsd/nfsproc.c  | 5 -----
 2 files changed, 14 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 3b1d63d51bb2..e394b0fb6260 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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,
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 7581b1ef4183..799ee95cdcd1 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 17/18] nfsd: remove legacy READDIR dprintks
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (15 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 16/18] nfsd: remove dprintks for v2/3 RENAME events cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 19:59 ` [PATCH v4 18/18] nfsd: remove legacy dprintks from GETATTR and STATFS codepaths cel
  2025-05-03 20:32 ` [PATCH v4 00/18] nfsd: observability improvements Jeff Layton
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 6 ------
 fs/nfsd/nfsproc.c  | 3 ---
 2 files changed, 9 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index e394b0fb6260..6019ce3a8036 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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);
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 799ee95cdcd1..fe0f1c372f18 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v4 18/18] nfsd: remove legacy dprintks from GETATTR and STATFS codepaths
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (16 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 17/18] nfsd: remove legacy READDIR dprintks cel
@ 2025-05-03 19:59 ` cel
  2025-05-03 20:32 ` [PATCH v4 00/18] nfsd: observability improvements Jeff Layton
  18 siblings, 0 replies; 23+ messages in thread
From: cel @ 2025-05-03 19:59 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

From: Jeff Layton <jlayton@kernel.org>

Observability here is now covered by static tracepoints.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs3proc.c | 6 ------
 fs/nfsd/nfsproc.c  | 4 ----
 2 files changed, 10 deletions(-)

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 6019ce3a8036..8902fae8c62d 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -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);
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index fe0f1c372f18..7c573d792252 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array
  2025-05-03 19:59 ` [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array cel
@ 2025-05-03 20:29   ` Jeff Layton
  0 siblings, 0 replies; 23+ messages in thread
From: Jeff Layton @ 2025-05-03 20:29 UTC (permalink / raw)
  To: cel, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

On Sat, 2025-05-03 at 15:59 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Record and emit presentation addresses using tracing helpers
> designed for the task.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/trace.h | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index 0d49fc064f72..f67ab3d1b506 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -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;
>  	),

Good idea.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros
  2025-05-03 19:59 ` [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros cel
@ 2025-05-03 20:30   ` Jeff Layton
  0 siblings, 0 replies; 23+ messages in thread
From: Jeff Layton @ 2025-05-03 20:30 UTC (permalink / raw)
  To: cel, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

On Sat, 2025-05-03 at 15:59 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> 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.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/trace.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index f67ab3d1b506..fc373c4d5fdd 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -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) \

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()
  2025-05-03 19:59 ` [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link() cel
@ 2025-05-03 20:30   ` Jeff Layton
  0 siblings, 0 replies; 23+ messages in thread
From: Jeff Layton @ 2025-05-03 20:30 UTC (permalink / raw)
  To: cel, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel

On Sat, 2025-05-03 at 15:59 -0400, cel@kernel.org wrote:
> From: Jeff Layton <jlayton@kernel.org>
> 

Looks like this one didn't get an expanded changelog?


> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++
>  fs/nfsd/vfs.c   |  2 ++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index e347cdaaa732..acbf94cfb720 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -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
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index ecd453b260b6..30702f36db98 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -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;

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v4 00/18] nfsd: observability improvements
  2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
                   ` (17 preceding siblings ...)
  2025-05-03 19:59 ` [PATCH v4 18/18] nfsd: remove legacy dprintks from GETATTR and STATFS codepaths cel
@ 2025-05-03 20:32 ` Jeff Layton
  18 siblings, 0 replies; 23+ messages in thread
From: Jeff Layton @ 2025-05-03 20:32 UTC (permalink / raw)
  To: cel, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker
  Cc: sargun, linux-nfs, linux-kernel, Chuck Lever

On Sat, 2025-05-03 at 15:59 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> These needed enough cosmetic changes that a v4 posting is warranted.
> 

Thanks for the cleanups. Your changes look fine to me.

> 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/20250503-nfsd-tracepoints-v3-0-d89f445969af@kernel.org
> 
> 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/20250409-nfsd-tracepoints-v2-0-cf4e084fdd9c@kernel.org
> 
> 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/20250306-nfsd-tracepoints-v1-0-4405bf41b95f@kernel.org
> 
> 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(-)

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2025-05-03 20:32 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-03 19:59 [PATCH v4 00/18] nfsd: observability improvements cel
2025-05-03 19:59 ` [PATCH v4 01/18] NFSD: Use sockaddr instead of a generic array cel
2025-05-03 20:29   ` Jeff Layton
2025-05-03 19:59 ` [PATCH v4 02/18] NFSD: Add a Call equivalent to the NFSD_TRACE_PROC_RES macros cel
2025-05-03 20:30   ` Jeff Layton
2025-05-03 19:59 ` [PATCH v4 03/18] nfsd: add a tracepoint for nfsd_setattr cel
2025-05-03 19:59 ` [PATCH v4 04/18] nfsd: add a tracepoint to nfsd_lookup_dentry cel
2025-05-03 19:59 ` [PATCH v4 05/18] nfsd: add nfsd_vfs_create tracepoints cel
2025-05-03 19:59 ` [PATCH v4 06/18] nfsd: add tracepoint to nfsd_symlink cel
2025-05-03 19:59 ` [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link() cel
2025-05-03 20:30   ` Jeff Layton
2025-05-03 19:59 ` [PATCH v4 08/18] nfsd: add tracepoints for unlink events cel
2025-05-03 19:59 ` [PATCH v4 09/18] nfsd: add tracepoint to nfsd_rename cel
2025-05-03 19:59 ` [PATCH v4 10/18] nfsd: add tracepoint to nfsd_readdir cel
2025-05-03 19:59 ` [PATCH v4 11/18] nfsd: add tracepoint for getattr and statfs events cel
2025-05-03 19:59 ` [PATCH v4 12/18] nfsd: remove old v2/3 create path dprintks cel
2025-05-03 19:59 ` [PATCH v4 13/18] nfsd: remove old v2/3 SYMLINK dprintks cel
2025-05-03 19:59 ` [PATCH v4 14/18] nfsd: remove old LINK dprintks cel
2025-05-03 19:59 ` [PATCH v4 15/18] nfsd: remove REMOVE/RMDIR dprintks cel
2025-05-03 19:59 ` [PATCH v4 16/18] nfsd: remove dprintks for v2/3 RENAME events cel
2025-05-03 19:59 ` [PATCH v4 17/18] nfsd: remove legacy READDIR dprintks cel
2025-05-03 19:59 ` [PATCH v4 18/18] nfsd: remove legacy dprintks from GETATTR and STATFS codepaths cel
2025-05-03 20:32 ` [PATCH v4 00/18] nfsd: observability improvements Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.