All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: bfields@fieldses.org, Bill.Baker@oracle.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 12/27] NFSD: Add tracepoint in nfsd_setattr()
Date: Mon, 21 Sep 2020 14:11:53 -0400	[thread overview]
Message-ID: <160071191326.1468.16608972172945152910.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <160071167664.1468.1365570508917640511.stgit@klimt.1015granger.net>

Capture especially the XID, file handle, and attr mask for
troubleshooting. So for example:

nfsd-1025  [002]   256.807363: nfsd_setattr:         xid=0x12147d7a fh_hash=0x6085d6fb valid=MODE|ATIME|MTIME

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h           |   24 ++++++++++++++++++++++++
 fs/nfsd/vfs.c             |    2 ++
 include/trace/events/fs.h |   20 ++++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 62bf57a8d03c..b4c773530aa8 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -9,6 +9,7 @@
 #define _NFSD_TRACE_H
 
 #include <linux/tracepoint.h>
+#include <trace/events/fs.h>
 
 #include "export.h"
 #include "nfsfh.h"
@@ -29,6 +30,29 @@
 		{ NFSD_MAY_READ_IF_EXEC,	"READ_IF_EXEC" },	\
 		{ NFSD_MAY_64BIT_COOKIE,	"64BIT_COOKIE" })
 
+TRACE_EVENT(nfsd_setattr_args,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct svc_fh *fhp,
+		unsigned int valid
+	),
+	TP_ARGS(rqstp, fhp, valid),
+	TP_STRUCT__entry(
+		__field(u32, xid)
+		__field(u32, fh_hash)
+		__field(unsigned long, valid)
+	),
+	TP_fast_assign(
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
+		__entry->valid = valid;
+	),
+	TP_printk("xid=0x%08x fh_hash=0x%08x valid=%s",
+		__entry->xid, __entry->fh_hash,
+		show_attr_valid_flags(__entry->valid)
+	)
+);
+
 TRACE_EVENT(nfsd_compound,
 	TP_PROTO(const struct svc_rqst *rqst,
 		 u32 args_opcnt),
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1ecaceebee13..a311593ac976 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -375,6 +375,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 	bool		get_write_count;
 	bool		size_change = (iap->ia_valid & ATTR_SIZE);
 
+	trace_nfsd_setattr_args(rqstp, fhp, iap->ia_valid);
+
 	if (iap->ia_valid & ATTR_SIZE) {
 		accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
 		ftype = S_IFREG;
diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h
index 8ea0e84e425a..2b185d81d9a5 100644
--- a/include/trace/events/fs.h
+++ b/include/trace/events/fs.h
@@ -145,3 +145,23 @@
 		{ LOOKUP_NO_XDEV,	"NO_XDEV" }, \
 		{ LOOKUP_BENEATH,	"BENEATH" }, \
 		{ LOOKUP_IN_ROOT,	"IN_ROOT" })
+
+#define show_attr_valid_flags(x) \
+	__print_flags(x, "|", \
+		{ 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" })



  parent reply	other threads:[~2020-09-21 18:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 18:10 [PATCH v2 00/27] NFSD operation monitoring tracepoints Chuck Lever
2020-09-21 18:10 ` [PATCH v2 01/27] NFS: Move generic FS show macros to global header Chuck Lever
2020-09-21 18:11 ` [PATCH v2 02/27] NFS: Move NFS protocol display " Chuck Lever
2020-09-21 18:11 ` [PATCH v2 03/27] NFSD: Add SPDX header for fs/nfsd/trace.c Chuck Lever
2020-09-21 18:11 ` [PATCH v2 04/27] SUNRPC: Move the svc_xdr_recvfrom() tracepoint Chuck Lever
2020-09-21 18:11 ` [PATCH v2 05/27] SUNRPC: Add svc_xdr_authenticate tracepoint Chuck Lever
2020-09-21 18:11 ` [PATCH v2 06/27] lockd: Replace PROC() macro with open code Chuck Lever
2020-09-21 18:11 ` [PATCH v2 07/27] NFSACL: " Chuck Lever
2020-09-21 18:11 ` [PATCH v2 08/27] SUNRPC: Make trace_svc_process() display the RPC procedure symbolically Chuck Lever
2020-09-21 18:11 ` [PATCH v2 09/27] NFSD: Clean up the show_nf_may macro Chuck Lever
2020-09-21 18:11 ` [PATCH v2 10/27] NFSD: Remove extra "0x" in tracepoint format specifier Chuck Lever
2020-09-21 18:11 ` [PATCH v2 11/27] NFSD: Constify @fh argument of knfsd_fh_hash() Chuck Lever
2020-09-21 18:11 ` Chuck Lever [this message]
2020-09-21 18:11 ` [PATCH v2 13/27] NFSD: Add tracepoint for nfsd_access() Chuck Lever
2020-09-21 18:12 ` [PATCH v2 14/27] NFSD: nfsd_compound_status tracepoint should record XID Chuck Lever
2020-09-21 18:12 ` [PATCH v2 15/27] NFSD: Add client ID lifetime tracepoints Chuck Lever
2020-09-21 18:12 ` [PATCH v2 16/27] NFSD: Add tracepoints to report NFSv4 session state Chuck Lever
2020-09-21 18:12 ` [PATCH v2 17/27] NFSD: Add a tracepoint to report the current filehandle Chuck Lever
2020-09-21 18:12 ` [PATCH v2 18/27] NFSD: Add GETATTR tracepoint Chuck Lever
2020-09-21 18:12 ` [PATCH v2 19/27] NFSD: Add tracepoint in nfsd4_stateid_preprocess() Chuck Lever
2020-09-21 18:12 ` [PATCH v2 20/27] NFSD: Add tracepoint to report arguments to NFSv4 OPEN Chuck Lever
2020-09-21 18:12 ` [PATCH v2 21/27] NFSD: Add a tracepoint for DELEGRETURN Chuck Lever
2020-09-21 18:12 ` [PATCH v2 22/27] NFSD: Add a lookup tracepoint Chuck Lever
2020-09-21 18:12 ` [PATCH v2 23/27] NFSD: Add lock and locku tracepoints Chuck Lever
2020-09-21 18:12 ` [PATCH v2 24/27] NFSD: Add tracepoints to record the result of TEST_STATEID and FREE_STATEID Chuck Lever
2020-09-21 18:13 ` [PATCH v2 25/27] NFSD: Rename nfsd_ tracepoints to nfsd4_ Chuck Lever
2020-09-21 18:13 ` [PATCH v2 26/27] NFSD: Add tracepoints in the NFS dispatcher Chuck Lever
2020-09-24 23:45   ` J. Bruce Fields
2020-09-25 13:59     ` Chuck Lever
2020-09-25 14:17       ` Bruce Fields
2020-09-25 14:21         ` Chuck Lever
2020-09-25 14:18       ` Chuck Lever
2020-09-25 14:47       ` Bruce Fields
2020-09-21 18:13 ` [PATCH v2 27/27] NFSD: Replace dprintk callsites in fs/nfsd/nfsfh.c Chuck Lever
2020-09-24 21:36 ` [PATCH v2 00/27] NFSD operation monitoring tracepoints J. Bruce Fields
2020-09-25 13:59   ` Chuck Lever
2020-09-25 14:32     ` Bruce Fields
2020-09-25 14:36       ` Chuck Lever
2020-09-25 15:00         ` Bruce Fields
2020-09-25 15:05           ` Chuck Lever
2020-09-25 17:04             ` Chuck Lever
2020-09-25 18:37               ` Bruce Fields
2020-09-25 18:41                 ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160071191326.1468.16608972172945152910.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=Bill.Baker@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.