From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH 2/3] nfsd: new tracepoint for check_slot_seqid
Date: Fri, 05 Apr 2024 14:40:50 -0400 [thread overview]
Message-ID: <20240405-nfsd-fixes-v1-2-e017bfe9a783@kernel.org> (raw)
In-Reply-To: <20240405-nfsd-fixes-v1-0-e017bfe9a783@kernel.org>
Replace a dprintk in check_slot_seqid with a new tracepoint. Add a
nfs4_client argument to check_slot_seqid so that we can pass the
appropriate info to the tracepoint.
Signed-off-by: Jeffrey Layton <jlayton@redhat.com>
---
fs/nfsd/nfs4state.c | 12 ++++++------
fs/nfsd/trace.h | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 3cef81e196c6..5891bc3e2b0b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3642,10 +3642,9 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
}
static __be32
-check_slot_seqid(u32 seqid, u32 slot_seqid, int slot_inuse)
+check_slot_seqid(struct nfs4_client *clp, u32 seqid, u32 slot_seqid, bool slot_inuse)
{
- dprintk("%s enter. seqid %d slot_seqid %d\n", __func__, seqid,
- slot_seqid);
+ trace_check_slot_seqid(clp, seqid, slot_seqid, slot_inuse);
/* The slot is in use, and no response has been sent. */
if (slot_inuse) {
@@ -3827,7 +3826,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
cs_slot = &conf->cl_cs_slot;
else
cs_slot = &unconf->cl_cs_slot;
- status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0);
+ status = check_slot_seqid(conf ? conf : unconf, cr_ses->seqid,
+ cs_slot->sl_seqid, false);
switch (status) {
case nfs_ok:
cs_slot->sl_seqid++;
@@ -4221,8 +4221,8 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
* sr_highest_slotid and the sr_target_slot id to maxslots */
seq->maxslots = session->se_fchannel.maxreqs;
- status = check_slot_seqid(seq->seqid, slot->sl_seqid,
- slot->sl_flags & NFSD4_SLOT_INUSE);
+ status = check_slot_seqid(clp, seq->seqid, slot->sl_seqid,
+ slot->sl_flags & NFSD4_SLOT_INUSE);
if (status == nfserr_replay_cache) {
status = nfserr_seq_misordered;
if (!(slot->sl_flags & NFSD4_SLOT_INITIALIZED))
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 7f1a6d568bdb..ec00ca7ecfc8 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -1542,6 +1542,40 @@ TRACE_EVENT(nfsd_cb_seq_status,
)
);
+TRACE_EVENT(check_slot_seqid,
+ TP_PROTO(
+ const struct nfs4_client *clp,
+ u32 seqid,
+ u32 slot_seqid,
+ bool inuse
+ ),
+ TP_ARGS(clp, seqid, slot_seqid, inuse),
+ TP_STRUCT__entry(
+ __field(u32, seqid)
+ __field(u32, slot_seqid)
+ __field(u32, cl_boot)
+ __field(u32, cl_id)
+ __sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
+ __field(bool, conf)
+ __field(bool, inuse)
+ ),
+ TP_fast_assign(
+ __entry->cl_boot = clp->cl_clientid.cl_boot;
+ __entry->cl_id = clp->cl_clientid.cl_id;
+ __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
+ clp->cl_cb_conn.cb_addrlen);
+ __entry->seqid = seqid;
+ __entry->slot_seqid = slot_seqid;
+ __entry->conf = test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags);
+ __entry->inuse = inuse;
+ ),
+ TP_printk("addr=%pISpc %s client %08x:%08x seqid=%u slot_seqid=%u inuse=%d",
+ __get_sockaddr(addr), __entry->conf ? "conf" : "unconf",
+ __entry->cl_boot, __entry->cl_id,
+ __entry->seqid, __entry->slot_seqid, __entry->inuse
+ )
+);
+
TRACE_EVENT(nfsd_cb_free_slot,
TP_PROTO(
const struct rpc_task *task,
--
2.44.0
next prev parent reply other threads:[~2024-04-05 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 18:40 [PATCH 0/3] nfsd: tracepoint cleanups and additions Jeff Layton
2024-04-05 18:40 ` [PATCH 1/3] nfsd: drop extraneous newline from nfsd tracepoints Jeff Layton
2024-04-05 18:40 ` Jeff Layton [this message]
2024-04-05 19:03 ` [PATCH 2/3] nfsd: new tracepoint for check_slot_seqid Chuck Lever
2024-04-05 19:08 ` Jeff Layton
2024-04-05 18:40 ` [PATCH 3/3] nfsd: add tracepoint in mark_client_expired_locked Jeff Layton
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=20240405-nfsd-fixes-v1-2-e017bfe9a783@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=kolga@netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tom@talpey.com \
/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
all inboxes | Powered by JetHome®