All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2 05/14] NFSD: Add nfsd_seq4_status trace event
Date: Fri, 26 Jan 2024 12:45:42 -0500	[thread overview]
Message-ID: <170629114243.20612.6785316387431284189.stgit@manet.1015granger.net> (raw)
In-Reply-To: <170629091560.20612.563908774748586696.stgit@manet.1015granger.net>

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

Add a trace point that records SEQ4_STATUS flags returned in an
NFSv4.1 SEQUENCE response. SEQ4_STATUS flags report backchannel
issues and changes to lease state to clients. Knowing what the
server is reporting to clients is useful for debugging both
configuration and operational issues in real time.

For example, upcoming patches will enable server administrators to
revoke parts of a client's lease; that revocation is indicated to
the client when a subsequent SEQUENCE operation has one or more
SEQ4_STATUS flags that are set.

Sample trace records:

nfsd-927   [006]   615.581821: nfsd_seq4_status:     xid=0x095ded07 sessionid=65a032c3:b7845faf:00000001:00000000 status_flags=BACKCHANNEL_FAULT
nfsd-927   [006]   615.588043: nfsd_seq4_status:     xid=0x0a5ded07 sessionid=65a032c3:b7845faf:00000001:00000000 status_flags=BACKCHANNEL_FAULT
nfsd-928   [003]   615.588448: nfsd_seq4_status:     xid=0x0b5ded07 sessionid=65a032c3:b7845faf:00000001:00000000 status_flags=BACKCHANNEL_FAULT

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

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index d7d561b29fb0..3d6e3dcfdee1 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4058,6 +4058,7 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	}
 	if (!list_empty(&clp->cl_revoked))
 		seq->status_flags |= SEQ4_STATUS_RECALLABLE_STATE_REVOKED;
+	trace_nfsd_seq4_status(rqstp, seq);
 out_no_session:
 	if (conn)
 		free_conn(conn);
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index d1e8cf079b0f..38d11b43779c 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -696,6 +696,41 @@ DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name,			\
 
 DEFINE_STID_EVENT(revoke);
 
+TRACE_EVENT_CONDITION(nfsd_seq4_status,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct nfsd4_sequence *sequence
+	),
+	TP_ARGS(rqstp, sequence),
+	TP_CONDITION(sequence->status_flags),
+	TP_STRUCT__entry(
+		__field(unsigned int, netns_ino)
+		__field(u32, xid)
+		__field(u32, cl_boot)
+		__field(u32, cl_id)
+		__field(u32, seqno)
+		__field(u32, reserved)
+		__field(unsigned long, status_flags)
+	),
+	TP_fast_assign(
+		const struct nfsd4_sessionid *sid =
+			(struct nfsd4_sessionid *)&sequence->sessionid;
+
+		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->cl_boot = sid->clientid.cl_boot;
+		__entry->cl_id = sid->clientid.cl_id;
+		__entry->seqno = sid->sequence;
+		__entry->reserved = sid->reserved;
+		__entry->status_flags = sequence->status_flags;
+	),
+	TP_printk("xid=0x%08x sessionid=%08x:%08x:%08x:%08x status_flags=%s",
+		__entry->xid, __entry->cl_boot, __entry->cl_id,
+		__entry->seqno, __entry->reserved,
+		show_nfs4_seq4_status(__entry->status_flags)
+	)
+);
+
 DECLARE_EVENT_CLASS(nfsd_clientid_class,
 	TP_PROTO(const clientid_t *clid),
 	TP_ARGS(clid),



  parent reply	other threads:[~2024-01-26 17:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 17:45 [PATCH 2 00/14] NFSD backchannel fixes Chuck Lever
2024-01-26 17:45 ` [PATCH 2 01/14] NFSD: Reset cb_seq_status after NFS4ERR_DELAY Chuck Lever
2024-01-26 17:45 ` [PATCH 2 02/14] NFSD: Convert the callback workqueue to use delayed_work Chuck Lever
2024-01-26 19:09   ` Jeff Layton
2024-01-26 17:45 ` [PATCH 2 03/14] NFSD: Reschedule CB operations when backchannel rpc_clnt is shut down Chuck Lever
2024-01-26 19:10   ` Jeff Layton
2024-01-26 17:45 ` [PATCH 2 04/14] NFSD: Retransmit callbacks after client reconnects Chuck Lever
2024-01-26 17:45 ` Chuck Lever [this message]
2024-01-26 17:45 ` [PATCH 2 06/14] NFSD: Replace dprintks in nfsd4_cb_sequence_done() Chuck Lever
2024-01-26 17:45 ` [PATCH 2 07/14] NFSD: Rename nfsd_cb_state trace point Chuck Lever
2024-01-26 17:46 ` [PATCH 2 08/14] NFSD: Add callback operation lifetime trace points Chuck Lever
2024-01-26 17:46 ` [PATCH 2 09/14] SUNRPC: Remove EXPORT_SYMBOL_GPL for svc_process_bc() Chuck Lever
2024-01-26 17:46 ` [PATCH 2 10/14] NFSD: Remove unused @reason argument Chuck Lever
2024-01-26 17:46 ` [PATCH 2 11/14] NFSD: Replace comment with lockdep assertion Chuck Lever
2024-01-26 17:46 ` [PATCH 2 12/14] NFSD: Remove BUG_ON in nfsd4_process_cb_update() Chuck Lever
2024-01-26 17:46 ` [PATCH 2 13/14] SUNRPC: Remove stale comments Chuck Lever
2024-01-26 17:46 ` [PATCH 2 14/14] NFSD: Remove redundant cb_seq_status initialization Chuck Lever
2024-01-26 20:10 ` [PATCH 2 00/14] NFSD backchannel fixes Benjamin Coddington

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=170629114243.20612.6785316387431284189.stgit@manet.1015granger.net \
    --to=cel@kernel.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.