linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: dwysocha@redhat.com, bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH RFC 15/21] NFSD: Add nfsd_clid_verf_mismatch tracepoint
Date: Mon, 10 May 2021 11:53:10 -0400	[thread overview]
Message-ID: <162066199008.94415.3881243902817026664.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <162066179690.94415.203187037032448300.stgit@klimt.1015granger.net>

Record when a client presents a different boot verifier than the
one we know about. Typically this is a sign the client has
rebooted, but sometimes it signals a conflicting client ID, which
the client's administrator will need to address.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4state.c |   11 ++++++++---
 fs/nfsd/trace.h     |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 4feadb683a2d..56ca79f55da4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3193,6 +3193,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			goto out_copy;
 		}
 		/* case 5, client reboot */
+		trace_nfsd_clid_verf_mismatch(conf, rqstp, &verf);
 		conf = NULL;
 		goto out_new;
 	}
@@ -3988,9 +3989,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	if (unconf)
 		unhash_client_locked(unconf);
 	/* We need to handle only case 1: probable callback update */
-	if (conf && same_verf(&conf->cl_verifier, &clverifier)) {
-		copy_clid(new, conf);
-		gen_confirm(new, nn);
+	if (conf) {
+		if (same_verf(&conf->cl_verifier, &clverifier)) {
+			copy_clid(new, conf);
+			gen_confirm(new, nn);
+		} else
+			trace_nfsd_clid_verf_mismatch(conf, rqstp,
+						      &clverifier);
 	}
 	new->cl_minorversion = 0;
 	gen_callback(new, setclid, rqstp);
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 80fd6ca6ae46..2c0392f30a86 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -592,6 +592,38 @@ TRACE_EVENT(nfsd_clid_cred_mismatch,
 	)
 )
 
+TRACE_EVENT(nfsd_clid_verf_mismatch,
+	TP_PROTO(
+		const struct nfs4_client *clp,
+		const struct svc_rqst *rqstp,
+		const nfs4_verifier *verf
+	),
+	TP_ARGS(clp, rqstp, verf),
+	TP_STRUCT__entry(
+		__field(u32, cl_boot)
+		__field(u32, cl_id)
+		__array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE)
+		__array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE)
+		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
+	),
+	TP_fast_assign(
+		__entry->cl_boot = clp->cl_clientid.cl_boot;
+		__entry->cl_id = clp->cl_clientid.cl_id;
+		memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier,
+		       NFS4_VERIFIER_SIZE);
+		memcpy(__entry->new_verifier, (void *)verf,
+		       NFS4_VERIFIER_SIZE);
+		memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote,
+			sizeof(struct sockaddr_in6));
+	),
+	TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc",
+		__entry->cl_boot, __entry->cl_id,
+		__print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE),
+		__print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE),
+		__entry->addr
+	)
+);
+
 TRACE_EVENT(nfsd_clid_inuse_err,
 	TP_PROTO(const struct nfs4_client *clp),
 	TP_ARGS(clp),



  parent reply	other threads:[~2021-05-10 15:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 15:51 [PATCH RFC 00/21] NFSD callback and lease management observability Chuck Lever
2021-05-10 15:51 ` [PATCH RFC 01/21] NFSD: Constify @fh argument of knfsd_fh_hash() Chuck Lever
2021-05-10 15:51 ` [PATCH RFC 02/21] NFSD: Capture every CB state transition Chuck Lever
2021-05-10 15:51 ` [PATCH RFC 03/21] NFSD: Drop TRACE_DEFINE_ENUM for NFSD4_CB_<state> macros Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 04/21] NFSD: Add cb_lost tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 05/21] NFSD: Adjust cb_shutdown tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 06/21] NFSD: Remove spurious cb_setup_err tracepoint Chuck Lever
2021-05-10 20:27   ` J. Bruce Fields
2021-05-10 20:29     ` Chuck Lever III
2021-05-11 17:44       ` Bruce Fields
2021-05-10 15:52 ` [PATCH RFC 07/21] NFSD: Enhance the nfsd_cb_setup tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 08/21] NFSD: Add an nfsd_cb_lm_notify tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 09/21] NFSD: Add an nfsd_cb_offload tracepoint Chuck Lever
2021-05-14 18:22   ` Olga Kornievskaia
2021-05-14 19:11     ` Chuck Lever III
2021-05-10 15:52 ` [PATCH RFC 10/21] NFSD: Replace the nfsd_deleg_break tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 11/21] NFSD: Add an nfsd_cb_probe tracepoint Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 12/21] NFSD: Remove the nfsd_cb_work and nfsd_cb_done tracepoints Chuck Lever
2021-05-10 15:52 ` [PATCH RFC 13/21] NFSD: Update nfsd_cb_args tracepoint Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 14/21] NFSD: Add nfsd_clid_cred_mismatch tracepoint Chuck Lever
2021-05-10 15:53 ` Chuck Lever [this message]
2021-05-11 15:49   ` [PATCH RFC 15/21] NFSD: Add nfsd_clid_verf_mismatch tracepoint J. Bruce Fields
2021-05-10 15:53 ` [PATCH RFC 16/21] NFSD: Remove nfsd_clid_inuse_err Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 17/21] NFSD: Add nfsd_clid_confirmed tracepoint Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 18/21] NFSD: Add nfsd_clid_destroyed tracepoint Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 19/21] NFSD: Add a couple more nfsd_clid_expired call sites Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 20/21] NFSD: Rename nfsd_clid_class Chuck Lever
2021-05-10 15:53 ` [PATCH RFC 21/21] NFSD: Add tracepoints to observe clientID activity Chuck Lever
2021-05-10 19:56   ` David Wysochanski
2021-05-10 20:00     ` Chuck Lever III
2021-05-11 15:59   ` Chuck Lever III
2021-05-11 17:38     ` Bruce Fields
2021-05-11 17:40       ` Chuck Lever III
2021-05-11 17:43         ` Bruce Fields
2021-05-10 17:24 ` [PATCH RFC 00/21] NFSD callback and lease management observability David Wysochanski

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=162066199008.94415.3881243902817026664.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=dwysocha@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).