From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/2] fsnotify: make fsnotify_create() agnostic to file/dir
Date: Mon, 2 Mar 2026 19:37:40 +0100 [thread overview]
Message-ID: <20260302183741.1308767-2-amir73il@gmail.com> (raw)
In-Reply-To: <20260302183741.1308767-1-amir73il@gmail.com>
Like fsnotify_delete(), let fsnotify_create() handle creation of both
dir and non-dir objects, if d_inode is available at creation time.
Unlike fsnotify_rmdir(), we do not call fsnotify_create() from
fsnotify_mkdir(), because of the case where d_inode is instantiated
lazily (e.g. kernfs).
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
include/linux/fsnotify.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 079c18bcdbde6..13156d165d845 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -318,9 +318,15 @@ static inline void fsnotify_inoderemove(struct inode *inode)
*/
static inline void fsnotify_create(struct inode *dir, struct dentry *dentry)
{
+ struct inode *inode = d_inode(dentry);
+ __u32 mask = FS_CREATE;
+
+ if (inode && S_ISDIR(inode->i_mode))
+ mask |= FS_ISDIR;
+
audit_inode_child(dir, dentry, AUDIT_TYPE_CHILD_CREATE);
- fsnotify_dirent(dir, dentry, FS_CREATE);
+ fsnotify_dirent(dir, dentry, mask);
}
/*
--
2.53.0
next prev parent reply other threads:[~2026-03-02 18:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 18:37 [PATCH 0/2] fsnotify hooks consolidation Amir Goldstein
2026-03-02 18:37 ` Amir Goldstein [this message]
2026-03-02 18:37 ` [PATCH 2/2] fs: use simple_end_creating helper to consolidate fsnotify hooks Amir Goldstein
2026-03-02 22:28 ` Chuck Lever
2026-03-03 10:05 ` Amir Goldstein
2026-03-03 10:28 ` NeilBrown
2026-03-03 11:27 ` Amir Goldstein
2026-03-05 1:22 ` NeilBrown
2026-03-03 14:24 ` Chuck Lever
2026-03-03 15:01 ` Alice Ryhl
2026-03-03 12:45 ` [PATCH 0/2] fsnotify hooks consolidation Jeff Layton
2026-03-03 13:18 ` Amir Goldstein
2026-03-03 15:00 ` Christoph Hellwig
2026-03-03 15:05 ` Amir Goldstein
2026-03-03 15:07 ` Christoph Hellwig
2026-03-03 15:17 ` Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260302183741.1308767-2-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.