[PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()

cel@kernel.org posted 18 patches 7 months, 2 weeks ago
[PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()
Posted by cel@kernel.org 7 months, 2 weeks ago
From: Jeff Layton <jlayton@kernel.org>

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++
 fs/nfsd/vfs.c   |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index e347cdaaa732..acbf94cfb720 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -2471,6 +2471,33 @@ TRACE_EVENT(nfsd_vfs_symlink,
 	)
 );
 
+TRACE_EVENT(nfsd_vfs_link,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct svc_fh *sfhp,
+		const struct svc_fh *tfhp,
+		const char *name,
+		unsigned int namelen
+	),
+	TP_ARGS(rqstp, sfhp, tfhp, name, namelen),
+	TP_STRUCT__entry(
+		NFSD_TRACE_PROC_CALL_FIELDS(rqstp)
+		__field(u32, sfh_hash)
+		__field(u32, tfh_hash)
+		__string_len(name, name, namelen)
+	),
+	TP_fast_assign(
+		NFSD_TRACE_PROC_CALL_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 ecd453b260b6..30702f36db98 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1721,6 +1721,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
Re: [PATCH v4 07/18] nfsd: add tracepoint to nfsd_link()
Posted by Jeff Layton 7 months, 2 weeks ago
On Sat, 2025-05-03 at 15:59 -0400, cel@kernel.org wrote:
> From: Jeff Layton <jlayton@kernel.org>
> 

Looks like this one didn't get an expanded changelog?


> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/trace.h | 27 +++++++++++++++++++++++++++
>  fs/nfsd/vfs.c   |  2 ++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index e347cdaaa732..acbf94cfb720 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -2471,6 +2471,33 @@ TRACE_EVENT(nfsd_vfs_symlink,
>  	)
>  );
>  
> +TRACE_EVENT(nfsd_vfs_link,
> +	TP_PROTO(
> +		const struct svc_rqst *rqstp,
> +		const struct svc_fh *sfhp,
> +		const struct svc_fh *tfhp,
> +		const char *name,
> +		unsigned int namelen
> +	),
> +	TP_ARGS(rqstp, sfhp, tfhp, name, namelen),
> +	TP_STRUCT__entry(
> +		NFSD_TRACE_PROC_CALL_FIELDS(rqstp)
> +		__field(u32, sfh_hash)
> +		__field(u32, tfh_hash)
> +		__string_len(name, name, namelen)
> +	),
> +	TP_fast_assign(
> +		NFSD_TRACE_PROC_CALL_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 ecd453b260b6..30702f36db98 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1721,6 +1721,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;

-- 
Jeff Layton <jlayton@kernel.org>