diff options
author | Amir Goldstein <amir73il@gmail.com> | 2020-03-19 17:10:22 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2020-03-25 23:17:16 +0100 |
commit | 44d705b0370b1d581f46ff23e5d33e8b5ff8ec58 (patch) | |
tree | 8f80b2faa4e0d990ddcb397b01f3a8dcd00d1da7 /fs/squashfs | |
parent | cacfb956d46edc5d7a1165161bfc6ca3de9519d9 (diff) | |
download | linux-44d705b0370b1d581f46ff23e5d33e8b5ff8ec58.tar.gz linux-44d705b0370b1d581f46ff23e5d33e8b5ff8ec58.tar.bz2 linux-44d705b0370b1d581f46ff23e5d33e8b5ff8ec58.zip |
fanotify: report name info for FAN_DIR_MODIFY event
Report event FAN_DIR_MODIFY with name in a variable length record similar
to how fid's are reported. With name info reporting implemented, setting
FAN_DIR_MODIFY in mark mask is now allowed.
When events are reported with name, the reported fid identifies the
directory and the name follows the fid. The info record type for this
event info is FAN_EVENT_INFO_TYPE_DFID_NAME.
For now, all reported events have at most one info record which is
either FAN_EVENT_INFO_TYPE_FID or FAN_EVENT_INFO_TYPE_DFID_NAME (for
FAN_DIR_MODIFY). Later on, events "on child" will report both records.
There are several ways that an application can use this information:
1. When watching a single directory, the name is always relative to
the watched directory, so application need to fstatat(2) the name
relative to the watched directory.
2. When watching a set of directories, the application could keep a map
of dirfd for all watched directories and hash the map by fid obtained
with name_to_handle_at(2). When getting a name event, the fid in the
event info could be used to lookup the base dirfd in the map and then
call fstatat(2) with that dirfd.
3. When watching a filesystem (FAN_MARK_FILESYSTEM) or a large set of
directories, the application could use open_by_handle_at(2) with the fid
in event info to obtain dirfd for the directory where event happened and
call fstatat(2) with this dirfd.
The last option scales better for a large number of watched directories.
The first two options may be available in the future also for non
privileged fanotify watchers, because open_by_handle_at(2) requires
the CAP_DAC_READ_SEARCH capability.
Link: https://lore.kernel.org/r/20200319151022.31456-15-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/squashfs')
0 files changed, 0 insertions, 0 deletions