diff mbox series

[RFC,16/21] NFSD: Add CLOSE tracepoint

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

Commit Message

Chuck Lever Sept. 16, 2020, 9:43 p.m. UTC
Record the state ID being closed.

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

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 47790c7a29a3..6509e431ddd2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6253,8 +6253,7 @@  nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct net *net = SVC_NET(rqstp);
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
-	dprintk("NFSD: nfsd4_close on file %pd\n", 
-			cstate->current_fh.fh_dentry);
+	trace_nfsd4_close(rqstp, close);
 
 	status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid,
 					&close->cl_stateid,
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 3c587d5076f7..cf350f37ddc9 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -450,6 +450,37 @@  TRACE_EVENT(nfsd4_open_downgrade,
 	)
 );
 
+TRACE_EVENT(nfsd4_close,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct nfsd4_close *close
+	),
+	TP_ARGS(rqstp, close),
+	TP_STRUCT__entry(
+		__field(u32, xid)
+		__field(u32, seqid)
+		__field(u32, cl_boot)
+		__field(u32, cl_id)
+		__field(u32, si_id)
+		__field(u32, si_generation)
+	),
+	TP_fast_assign(
+		const stateid_t *stp = &close->cl_stateid;
+
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->seqid = close->cl_seqid;
+		__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 seqid=%u client %08x:%08x stateid %08x:%08x",
+		__entry->xid, __entry->seqid,
+		__entry->cl_boot, __entry->cl_id,
+		__entry->si_id, __entry->si_generation
+	)
+);
+
 TRACE_EVENT(nfsd4_stateid_prep,
 	TP_PROTO(
 		const struct svc_rqst *rqstp,