Skip to content

Commit 9991bb8

Browse files
amir73iljankara
authored andcommitted
kernfs: do not call fsnotify() with name without a parent
When creating an FS_MODIFY event on inode itself (not on parent) the file_name argument should be NULL. The change to send a non NULL name to inode itself was done on purpuse as part of another commit, as Tejun writes: "...While at it, supply the target file name to fsnotify() from kernfs_node->name.". But this is wrong practice and inconsistent with inotify behavior when watching a single file. When a child is being watched (as opposed to the parent directory) the inotify event should contain the watch descriptor, but not the file name. Fixes: df6a58c ("kernfs: don't depend on d_find_any_alias()...") Link: https://lore.kernel.org/r/[email protected] Acked-by: Tejun Heo <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 9a02aa4 commit 9991bb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/kernfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
912912
}
913913

914914
fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
915-
&name, 0);
915+
NULL, 0);
916916
iput(inode);
917917
}
918918

0 commit comments

Comments
 (0)