Skip to content

Commit 2d49901

Browse files
committed
nfsd: new tracepoint for check_slot_seqid
Replace a dprintk in check_slot_seqid with tracepoints. These new tracepoints track slot sequence numbers during operation. Suggested-by: Jeffrey Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent db2acd6 commit 2d49901

File tree

2 files changed

+77
-7
lines changed

2 files changed

+77
-7
lines changed

fs/nfsd/nfs4state.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,12 +3636,8 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
36363636
return status;
36373637
}
36383638

3639-
static __be32
3640-
check_slot_seqid(u32 seqid, u32 slot_seqid, int slot_inuse)
3639+
static __be32 check_slot_seqid(u32 seqid, u32 slot_seqid, bool slot_inuse)
36413640
{
3642-
dprintk("%s enter. seqid %d slot_seqid %d\n", __func__, seqid,
3643-
slot_seqid);
3644-
36453641
/* The slot is in use, and no response has been sent. */
36463642
if (slot_inuse) {
36473643
if (seqid == slot_seqid)
@@ -3818,10 +3814,13 @@ nfsd4_create_session(struct svc_rqst *rqstp,
38183814
}
38193815

38203816
/* RFC 8881 Section 18.36.4 Phase 2: Sequence ID processing. */
3821-
if (conf)
3817+
if (conf) {
38223818
cs_slot = &conf->cl_cs_slot;
3823-
else
3819+
trace_nfsd_slot_seqid_conf(conf, cr_ses);
3820+
} else {
38243821
cs_slot = &unconf->cl_cs_slot;
3822+
trace_nfsd_slot_seqid_unconf(unconf, cr_ses);
3823+
}
38253824
status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0);
38263825
switch (status) {
38273826
case nfs_ok:
@@ -4216,6 +4215,7 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
42164215
* sr_highest_slotid and the sr_target_slot id to maxslots */
42174216
seq->maxslots = session->se_fchannel.maxreqs;
42184217

4218+
trace_nfsd_slot_seqid_sequence(clp, seq, slot);
42194219
status = check_slot_seqid(seq->seqid, slot->sl_seqid,
42204220
slot->sl_flags & NFSD4_SLOT_INUSE);
42214221
if (status == nfserr_replay_cache) {

fs/nfsd/trace.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,76 @@ TRACE_EVENT_CONDITION(nfsd_seq4_status,
749749
)
750750
);
751751

752+
DECLARE_EVENT_CLASS(nfsd_cs_slot_class,
753+
TP_PROTO(
754+
const struct nfs4_client *clp,
755+
const struct nfsd4_create_session *cs
756+
),
757+
TP_ARGS(clp, cs),
758+
TP_STRUCT__entry(
759+
__field(u32, seqid)
760+
__field(u32, slot_seqid)
761+
__field(u32, cl_boot)
762+
__field(u32, cl_id)
763+
__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
764+
),
765+
TP_fast_assign(
766+
const struct nfsd4_clid_slot *slot = &clp->cl_cs_slot;
767+
768+
__entry->cl_boot = clp->cl_clientid.cl_boot;
769+
__entry->cl_id = clp->cl_clientid.cl_id;
770+
__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
771+
clp->cl_cb_conn.cb_addrlen);
772+
__entry->seqid = cs->seqid;
773+
__entry->slot_seqid = slot->sl_seqid;
774+
),
775+
TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u",
776+
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
777+
__entry->seqid, __entry->slot_seqid
778+
)
779+
);
780+
781+
#define DEFINE_CS_SLOT_EVENT(name) \
782+
DEFINE_EVENT(nfsd_cs_slot_class, nfsd_##name, \
783+
TP_PROTO( \
784+
const struct nfs4_client *clp, \
785+
const struct nfsd4_create_session *cs \
786+
), \
787+
TP_ARGS(clp, cs))
788+
789+
DEFINE_CS_SLOT_EVENT(slot_seqid_conf);
790+
DEFINE_CS_SLOT_EVENT(slot_seqid_unconf);
791+
792+
TRACE_EVENT(nfsd_slot_seqid_sequence,
793+
TP_PROTO(
794+
const struct nfs4_client *clp,
795+
const struct nfsd4_sequence *seq,
796+
const struct nfsd4_slot *slot
797+
),
798+
TP_ARGS(clp, seq, slot),
799+
TP_STRUCT__entry(
800+
__field(u32, seqid)
801+
__field(u32, slot_seqid)
802+
__field(u32, cl_boot)
803+
__field(u32, cl_id)
804+
__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
805+
__field(bool, in_use)
806+
),
807+
TP_fast_assign(
808+
__entry->cl_boot = clp->cl_clientid.cl_boot;
809+
__entry->cl_id = clp->cl_clientid.cl_id;
810+
__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
811+
clp->cl_cb_conn.cb_addrlen);
812+
__entry->seqid = seq->seqid;
813+
__entry->slot_seqid = slot->sl_seqid;
814+
),
815+
TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u (%sin use)",
816+
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
817+
__entry->seqid, __entry->slot_seqid,
818+
__entry->in_use ? "" : "not "
819+
)
820+
);
821+
752822
DECLARE_EVENT_CLASS(nfsd_clientid_class,
753823
TP_PROTO(const clientid_t *clid),
754824
TP_ARGS(clid),

0 commit comments

Comments
 (0)