diff mbox series

[1/7] fsnotify: pass dentry instead of inode data for move events

Message ID 20211029114028.569755-2-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show
Series Report more information in fanotify dirent events | expand

Commit Message

Amir Goldstein Oct. 29, 2021, 11:40 a.m. UTC
This is needed for reporting the new parent/name with MOVED_FROM
events.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 include/linux/fsnotify.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 787545e87eeb..ae7501c80d05 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -140,7 +140,6 @@  static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
 				 int isdir, struct inode *target,
 				 struct dentry *moved)
 {
-	struct inode *source = moved->d_inode;
 	u32 fs_cookie = fsnotify_get_cookie();
 	__u32 old_dir_mask = FS_MOVED_FROM;
 	__u32 new_dir_mask = FS_MOVED_TO;
@@ -154,14 +153,14 @@  static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
 		new_dir_mask |= FS_ISDIR;
 	}
 
-	fsnotify_name(old_dir_mask, source, FSNOTIFY_EVENT_INODE,
+	fsnotify_name(old_dir_mask, moved, FSNOTIFY_EVENT_DENTRY,
 		      old_dir, old_name, fs_cookie);
-	fsnotify_name(new_dir_mask, source, FSNOTIFY_EVENT_INODE,
+	fsnotify_name(new_dir_mask, moved, FSNOTIFY_EVENT_DENTRY,
 		      new_dir, new_name, fs_cookie);
 
 	if (target)
 		fsnotify_link_count(target);
-	fsnotify_inode(source, FS_MOVE_SELF);
+	fsnotify_inode(d_inode(moved), FS_MOVE_SELF);
 	audit_inode_child(new_dir, moved, AUDIT_TYPE_CHILD_CREATE);
 }