Commit 9991bb84 authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara

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: df6a58c5 ("kernfs: don't depend on d_find_any_alias()...")
Link: https://lore.kernel.org/r/20200708111156.24659-5-amir73il@gmail.comAcked-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 9a02aa40
...@@ -912,7 +912,7 @@ static void kernfs_notify_workfn(struct work_struct *work) ...@@ -912,7 +912,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
} }
fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
&name, 0); NULL, 0);
iput(inode); iput(inode);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment