lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250602-dir-deleg-v2-26-a7919700de86@kernel.org>
Date: Mon, 02 Jun 2025 10:02:09 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Alexander Viro <viro@...iv.linux.org.uk>, 
 Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, 
 Chuck Lever <chuck.lever@...cle.com>, 
 Alexander Aring <alex.aring@...il.com>, 
 Trond Myklebust <trondmy@...nel.org>, Anna Schumaker <anna@...nel.org>, 
 Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.com>, 
 Ronnie Sahlberg <ronniesahlberg@...il.com>, 
 Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>, 
 Bharath SM <bharathsm@...rosoft.com>, NeilBrown <neil@...wn.name>, 
 Olga Kornievskaia <okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>, 
 Jonathan Corbet <corbet@....net>, Amir Goldstein <amir73il@...il.com>, 
 Miklos Szeredi <miklos@...redi.hu>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, 
 linux-nfs@...r.kernel.org, linux-cifs@...r.kernel.org, 
 samba-technical@...ts.samba.org, linux-doc@...r.kernel.org, 
 Jeff Layton <jlayton@...nel.org>
Subject: [PATCH RFC v2 26/28] nfsd: add a tracepoint for
 nfsd_file_fsnotify_handle_dir_event()

Repurpose the existing nfsd_file_fsnotify_handle_event tracepoint() as a
class and call it from the dir notificaiton codepath. Add info about the
dir to it.

Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
 fs/nfsd/filecache.c |  2 +-
 fs/nfsd/nfs4state.c |  3 +++
 fs/nfsd/trace.h     | 25 ++++++++++++++++++-------
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 6cd4cfa0b46bf33c4134987a12e42c8455fc4879..ba72470b870cd0e266ba7fac8174a1a249a840e8 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -743,7 +743,7 @@ nfsd_file_fsnotify_handle_event(struct fsnotify_mark *mark, u32 mask,
 	if (WARN_ON_ONCE(!inode))
 		return 0;
 
-	trace_nfsd_file_fsnotify_handle_event(inode, mask);
+	trace_nfsd_file_fsnotify_handle_event(inode, dir, mask);
 
 	/* Should be no marks on non-regular files */
 	if (!S_ISREG(inode->i_mode)) {
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a75179ffa6006868bae3931263830d7b7e1a8882..a610a90d119a771771cdb60ce3ee4ab3604cb8a3 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -9640,9 +9640,12 @@ int
 nfsd_handle_dir_event(u32 mask, const struct inode *dir, const void *data,
 		      int data_type, const struct qstr *name)
 {
+	struct inode *inode = fsnotify_data_inode(data, data_type);
 	struct file_lock_context *ctx;
 	struct file_lock_core *flc;
 
+	trace_nfsd_file_fsnotify_handle_dir_event(inode, dir, mask);
+
 	ctx = locks_inode_context(dir);
 	if (!ctx || list_empty(&ctx->flc_lease))
 		return 0;
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 0c68df50eae248c7c9afe0437dfcf29837e09275..968e13a721942c051448f21af2f13849511b7c6a 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -1293,25 +1293,36 @@ TRACE_EVENT(nfsd_file_is_cached,
 	)
 );
 
-TRACE_EVENT(nfsd_file_fsnotify_handle_event,
-	TP_PROTO(struct inode *inode, u32 mask),
-	TP_ARGS(inode, mask),
+DECLARE_EVENT_CLASS(nfsd_file_fsnotify_handle_event_class,
+	TP_PROTO(const struct inode *inode, const struct inode *dir, u32 mask),
+	TP_ARGS(inode, dir, mask),
 	TP_STRUCT__entry(
-		__field(struct inode *, inode)
+		__field(ino_t, ino)
+		__field(ino_t, dir)
 		__field(unsigned int, nlink)
 		__field(umode_t, mode)
 		__field(u32, mask)
 	),
 	TP_fast_assign(
-		__entry->inode = inode;
+		__entry->ino = inode->i_ino;
+		__entry->dir = dir ? dir->i_ino : 0;
 		__entry->nlink = inode->i_nlink;
 		__entry->mode = inode->i_mode;
 		__entry->mask = mask;
 	),
-	TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
-			__entry->nlink, __entry->mode, __entry->mask)
+	TP_printk("dir=%lu inode=%lu nlink=%u mode=0%ho mask=0x%x",
+		  __entry->dir, __entry->ino, __entry->nlink,
+		  __entry->mode, __entry->mask)
 );
 
+#define DEFINE_NFSD_FSNOTIFY_HANDLE_EVENT(name)					\
+DEFINE_EVENT(nfsd_file_fsnotify_handle_event_class, name,			\
+	TP_PROTO(const struct inode *inode, const struct inode *dir, u32 mask),	\
+	TP_ARGS(inode, dir, mask))
+
+DEFINE_NFSD_FSNOTIFY_HANDLE_EVENT(nfsd_file_fsnotify_handle_event);
+DEFINE_NFSD_FSNOTIFY_HANDLE_EVENT(nfsd_file_fsnotify_handle_dir_event);
+
 DECLARE_EVENT_CLASS(nfsd_file_gc_class,
 	TP_PROTO(
 		const struct nfsd_file *nf

-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ