diff options
author | Amir Goldstein <amir73il@gmail.com> | 2020-07-16 11:42:29 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2020-07-28 00:24:00 +0300 |
commit | 7e8283af6edeb7dd9f8f18a429e6738c07f00ce4 (patch) | |
tree | d4aea74ea2e9a6a23cc2913d9f7a4e46775d2bc8 /fs/notify/fanotify/fanotify_user.c | |
parent | 929943b38daf817f2e6d303ea04401651fc3bc05 (diff) | |
download | linux-7e8283af6edeb7dd9f8f18a429e6738c07f00ce4.tar.xz |
fanotify: report parent fid + name + child fid
For a group with fanotify_init() flag FAN_REPORT_DFID_NAME, the parent
fid and name are reported for events on non-directory objects with an
info record of type FAN_EVENT_INFO_TYPE_DFID_NAME.
If the group also has the init flag FAN_REPORT_FID, the child fid
is also reported with another info record that follows the first info
record. The second info record is the same info record that would have
been reported to a group with only FAN_REPORT_FID flag.
When the child fid needs to be recorded, the variable size struct
fanotify_name_event is preallocated with enough space to store the
child fh between the dir fh and the name.
Link: https://lore.kernel.org/r/20200716084230.30611-22-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify_user.c')
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 6b839790cb42..be328d7ee283 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -956,14 +956,15 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) return -EINVAL; /* - * Reporting either object fid or dir fid. * Child name is reported with parent fid so requires dir fid. + * If reporting child name, we can report both child fid and dir fid. */ switch (fid_mode) { case 0: case FAN_REPORT_FID: case FAN_REPORT_DIR_FID: case FAN_REPORT_DFID_NAME: + case FAN_REPORT_DFID_NAME | FAN_REPORT_FID: break; default: return -EINVAL; |