Re: [PATCH v4 11/21] nfsd: add tracepoint to dir_event handler

From: Steven Rostedt

Date: Fri May 22 2026 - 10:52:29 EST


On Fri, 22 May 2026 08:29:00 -0400
Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> Add some extra visibility around the fsnotify handlers.
>
> Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> fs/nfsd/nfs4state.c | 2 ++
> fs/nfsd/trace.h | 22 ++++++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 3afde2e91efe..8d73203297e5 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -10032,6 +10032,8 @@ nfsd_handle_dir_event(u32 mask, const struct inode *dir, const void *data,
> struct file_lock_core *flc;
> struct nfsd_notify_event *evt;
>
> + trace_nfsd_handle_dir_event(mask, dir, name);
> +
> /* Normalize cross-dir rename events to create/delete */
> if (mask & FS_MOVED_FROM) {
> mask &= ~FS_MOVED_FROM;
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index ebf5677c4e73..e8e121a52e82 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -12,6 +12,7 @@
> #include <linux/sunrpc/clnt.h>
> #include <linux/sunrpc/xprt.h>
> #include <trace/misc/fs.h>
> +#include <trace/misc/fsnotify.h>
> #include <trace/misc/nfs.h>
> #include <trace/misc/sunrpc.h>
>
> @@ -1377,6 +1378,27 @@ TRACE_EVENT(nfsd_file_fsnotify_handle_event,
> __entry->nlink, __entry->mode, __entry->mask)
> );
>
> +TRACE_EVENT(nfsd_handle_dir_event,
> + TP_PROTO(u32 mask, const struct inode *dir, const struct qstr *name),
> + TP_ARGS(mask, dir, name),
> + TP_STRUCT__entry(
> + __field(u32, mask)
> + __field(dev_t, s_dev)
> + __field(ino_t, i_ino)
> + __string_len(name, name->name, name->len)
> + ),
> + TP_fast_assign(
> + __entry->mask = mask;
> + __entry->s_dev = dir->i_sb->s_dev;
> + __entry->i_ino = dir->i_ino;
> + __assign_str(name);
> + ),
> + TP_printk("inode=0x%x:0x%x:0x%lx mask=%s name=%s",
> + MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> + __entry->i_ino, show_fsnotify_mask(__entry->mask),

Hmm, I don't have the show_fsnotify_mask() function in my repos and don't
see it defined in the patch series (I scanned lore).

Have a link to the patch or repo that creates it?

-- Steve


> + __get_str(name))
> +);
> +
> DECLARE_EVENT_CLASS(nfsd_file_gc_class,
> TP_PROTO(
> const struct nfsd_file *nf
>