diff mbox series

[v2,24/27] NFSD: Add tracepoints to record the result of TEST_STATEID and FREE_STATEID

Message ID 160071197677.1468.2041968881033526045.stgit@klimt.1015granger.net
State New
Headers show
Series NFSD operation monitoring tracepoints | expand

Commit Message

Chuck Lever Sept. 21, 2020, 6:12 p.m. UTC
These tracepoints record information about NFSv4 state recovery.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4state.c |    6 +++++
 fs/nfsd/trace.h     |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 79fe2ab2e773..eaad1763d33a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5945,9 +5945,11 @@  nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct nfsd4_test_stateid_id *stateid;
 	struct nfs4_client *cl = cstate->session->se_client;
 
-	list_for_each_entry(stateid, &test_stateid->ts_stateid_list, ts_id_list)
+	list_for_each_entry(stateid, &test_stateid->ts_stateid_list, ts_id_list) {
 		stateid->ts_id_status =
 			nfsd4_validate_stateid(cl, &stateid->ts_id_stateid);
+		trace_nfsd4_test_stateid(rqstp, stateid);
+	}
 
 	return nfs_ok;
 }
@@ -5992,6 +5994,8 @@  nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct nfs4_client *cl = cstate->session->se_client;
 	__be32 ret = nfserr_bad_stateid;
 
+	trace_nfsd4_free_stateid(rqstp, stateid);
+
 	spin_lock(&cl->cl_lock);
 	s = find_stateid_locked(cl, stateid);
 	if (!s)
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index e933464316d7..10927da9d016 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -784,6 +784,62 @@  TRACE_EVENT(nfsd4_locku,
 	)
 );
 
+TRACE_EVENT(nfsd4_test_stateid,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct nfsd4_test_stateid_id *stateid
+	),
+	TP_ARGS(rqstp, stateid),
+	TP_STRUCT__entry(
+		__field(u32, xid)
+		__field(u32, cl_boot)
+		__field(u32, cl_id)
+		__field(u32, si_id)
+		__field(u32, si_generation)
+		__field(int, status)
+	),
+	TP_fast_assign(
+		const stateid_t *stp = &stateid->ts_id_stateid;
+
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
+		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
+		__entry->si_id = stp->si_opaque.so_id;
+		__entry->si_generation = stp->si_generation;
+		__entry->status = be32_to_cpu(stateid->ts_id_status);
+	),
+	TP_printk("xid=0x%08x client=%08x:%08x stateid=%08x:%08x status=%d",
+		__entry->xid, __entry->cl_boot, __entry->cl_id,
+		__entry->si_id, __entry->si_generation, __entry->status
+	)
+);
+
+TRACE_EVENT(nfsd4_free_stateid,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const stateid_t *stp
+	),
+	TP_ARGS(rqstp, stp),
+	TP_STRUCT__entry(
+		__field(u32, xid)
+		__field(u32, cl_boot)
+		__field(u32, cl_id)
+		__field(u32, si_id)
+		__field(u32, si_generation)
+	),
+	TP_fast_assign(
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
+		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
+		__entry->si_id = stp->si_opaque.so_id;
+		__entry->si_generation = stp->si_generation;
+	),
+	TP_printk("xid=0x%08x client=%08x:%08x stateid=%08x:%08x",
+		__entry->xid, __entry->cl_boot, __entry->cl_id,
+		__entry->si_id, __entry->si_generation
+	)
+);
+
 TRACE_EVENT(nfsd4_delegreturn,
 	TP_PROTO(
 		const struct svc_rqst *rqstp,