fanotify: record either old name new name or both for FAN_RENAME
authorAmir Goldstein <amir73il@gmail.com>
Mon, 29 Nov 2021 20:15:35 +0000 (22:15 +0200)
committerJan Kara <jack@suse.cz>
Wed, 15 Dec 2021 14:55:53 +0000 (15:55 +0100)
commit2bfbcccde6e7a787feabad4645f628f963fe0663
tree277e92c0ad85d9ed876a0167d3d0de9360b0aa2b
parent3982534ba5ce45e890b2f5ef5e7372c1accd14c7
fanotify: record either old name new name or both for FAN_RENAME

We do not want to report the dirfid+name of a directory whose
inode/sb are not watched, because watcher may not have permissions
to see the directory content.

Use an internal iter_info to indicate to fanotify_alloc_event()
which marks of this group are watching FAN_RENAME, so it can decide
if we need to record only the old parent+name, new parent+name or both.

Link: https://lore.kernel.org/r/20211129201537.1932819-10-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[JK: Modified code to pass around only mask of mark types matching
generated event]
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify.c