[PATCH v3 06/17] nfsd: add tracepoint to nfsd_link()

Jeff Layton posted 17 patches 9 months, 2 weeks ago
There is a newer version of this series
[PATCH v3 06/17] nfsd: add tracepoint to nfsd_link()
Posted by Jeff Layton 9 months, 2 weeks ago
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/trace.h | 24 ++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 9f604eb23f6304d11223733cee38871a4c39001f..17c09d8a52041205ff4edd47fbd4d31135e97f85 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -2439,6 +2439,30 @@ TRACE_EVENT(nfsd_vfs_symlink,
 		  __entry->xid, __entry->fh_hash,
 		  __get_str(name), __get_str(tgt))
 );
+
+TRACE_EVENT(nfsd_vfs_link,
+	TP_PROTO(struct svc_rqst *rqstp,
+		 struct svc_fh *sfhp,
+		 struct svc_fh *tfhp,
+		 const char *name,
+		 unsigned int namelen),
+	TP_ARGS(rqstp, sfhp, tfhp, name, namelen),
+	TP_STRUCT__entry(
+		SVC_RQST_ENDPOINT_FIELDS(rqstp)
+		__field(u32, sfh_hash)
+		__field(u32, tfh_hash)
+		__string_len(name, name, namelen)
+	),
+	TP_fast_assign(
+		SVC_RQST_ENDPOINT_ASSIGNMENTS(rqstp);
+		__entry->sfh_hash = knfsd_fh_hash(&sfhp->fh_handle);
+		__entry->tfh_hash = knfsd_fh_hash(&tfhp->fh_handle);
+		__assign_str(name);
+	),
+	TP_printk("xid=0x%08x src_fh=0x%08x tgt_fh=0x%08x name=%s",
+		  __entry->xid, __entry->sfh_hash, __entry->tfh_hash,
+		  __get_str(name))
+);
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 44e9260410b2d9dc7e07b5af7a74b63bd0175998..d949860d2aac998efb1b74218d0657a73a0d3fc6 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1746,6 +1746,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
 	__be32		err;
 	int		host_err;
 
+	trace_nfsd_vfs_link(rqstp, ffhp, tfhp, name, len);
+
 	err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_CREATE);
 	if (err)
 		goto out;

-- 
2.49.0