fsnotify: introduce mark type iterator
authorAmir Goldstein <amir73il@gmail.com>
Wed, 11 May 2022 19:02:12 +0000 (22:02 +0300)
committerJan Kara <jack@suse.cz>
Wed, 18 May 2022 13:07:43 +0000 (15:07 +0200)
commit14362a2541797cf9df0e86fb12dcd7950baf566e
tree5bc7090500aba7a64f0fdfbfdf66eb6b4a58392d
parent5f9d3bd520261fd7a850818c71809fd580e0f30c
fsnotify: introduce mark type iterator

fsnotify_foreach_iter_mark_type() is used to reduce boilerplate code
of iterating all marks of a specific group interested in an event
by consulting the iterator report_mask.

Use an open coded version of that iterator in fsnotify_iter_next()
that collects all marks of the current iteration group without
consulting the iterator report_mask.

At the moment, the two iterator variants are the same, but this
decoupling will allow us to exclude some of the group's marks from
reporting the event, for example for event on child and inode marks
on parent did not request to watch events on children.

Fixes: 2f02fd3fa13e ("fanotify: fix ignore mask logic for events on child and on dir")
Reported-by: Jan Kara <jack@suse.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220511190213.831646-2-amir73il@gmail.com
fs/notify/fanotify/fanotify.c
fs/notify/fsnotify.c
include/linux/fsnotify_backend.h