kernel_samsung_a53x/fs/notify
Amir Goldstein 059dc1dee5 fanotify: introduce FAN_MARK_IGNORE
[ Upstream commit e252f2ed1c8c6c3884ab5dd34e003ed21f1fe6e0 ]

This flag is a new way to configure ignore mask which allows adding and
removing the event flags FAN_ONDIR and FAN_EVENT_ON_CHILD in ignore mask.

The legacy FAN_MARK_IGNORED_MASK flag would always ignore events on
directories and would ignore events on children depending on whether
the FAN_EVENT_ON_CHILD flag was set in the (non ignored) mask.

FAN_MARK_IGNORE can be used to ignore events on children without setting
FAN_EVENT_ON_CHILD in the mark's mask and will not ignore events on
directories unconditionally, only when FAN_ONDIR is set in ignore mask.

The new behavior is non-downgradable.  After calling fanotify_mark() with
FAN_MARK_IGNORE once, calling fanotify_mark() with FAN_MARK_IGNORED_MASK
on the same object will return EEXIST error.

Setting the event flags with FAN_MARK_IGNORE on a non-dir inode mark
has no meaning and will return ENOTDIR error.

The meaning of FAN_MARK_IGNORED_SURV_MODIFY is preserved with the new
FAN_MARK_IGNORE flag, but with a few semantic differences:

1. FAN_MARK_IGNORED_SURV_MODIFY is required for filesystem and mount
   marks and on an inode mark on a directory. Omitting this flag
   will return EINVAL or EISDIR error.

2. An ignore mask on a non-directory inode that survives modify could
   never be downgraded to an ignore mask that does not survive modify.
   With new FAN_MARK_IGNORE semantics we make that rule explicit -
   trying to update a surviving ignore mask without the flag
   FAN_MARK_IGNORED_SURV_MODIFY will return EEXIST error.

The conveniene macro FAN_MARK_IGNORE_SURV is added for
(FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY), because the
common case should use short constant names.

Link: https://lore.kernel.org/r/20220629144210.2983229-4-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:59 +01:00
..
dnotify dnotify: use fsnotify group lock helpers 2024-11-19 12:27:55 +01:00
fanotify fanotify: introduce FAN_MARK_IGNORE 2024-11-19 12:27:59 +01:00
inotify fs: inotify: Fix typo in inotify comment 2024-11-19 12:27:59 +01:00
fdinfo.c fanotify: prepare for setting event flags in ignore mask 2024-11-19 12:27:59 +01:00
fdinfo.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsnotify.c fanotify: prepare for setting event flags in ignore mask 2024-11-19 12:27:59 +01:00
fsnotify.h fsnotify: count all objects with attached connectors 2024-11-19 12:27:44 +01:00
group.c fsnotify: create helpers for group mark_mutex lock 2024-11-19 12:27:55 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mark.c fsnotify: allow adding an inode mark without pinning inode 2024-11-19 12:27:55 +01:00
notification.c fsnotify: Pass group argument to free_event 2024-11-19 12:27:46 +01:00