fsnotify: create helpers for group mark_mutex lock
authorAmir Goldstein <amir73il@gmail.com>
Fri, 22 Apr 2022 12:03:17 +0000 (15:03 +0300)
committerJan Kara <jack@suse.cz>
Mon, 25 Apr 2022 12:37:22 +0000 (14:37 +0200)
commit43b245a788e2d8f1bb742668a9bdace02fcb3e96
treebcd81fb80a6512f99e6b4b15ac59eafe9714fc26
parentf3010343d9e119da35ee864b3a28993bb5c78ed7
fsnotify: create helpers for group mark_mutex lock

Create helpers to take and release the group mark_mutex lock.

Define a flag FSNOTIFY_GROUP_NOFS in fsnotify_group that determines
if the mark_mutex lock is fs reclaim safe or not.  If not safe, the
lock helpers take the lock and disable direct fs reclaim.

In that case we annotate the mutex with a different lockdep class to
express to lockdep that an allocation of mark of an fs reclaim safe group
may take the group lock of another "NOFS" group to evict inodes.

For now, converted only the callers in common code and no backend
defines the NOFS flag.  It is intended to be set by fanotify for
evictable marks support.

Link: https://lore.kernel.org/r/20220422120327.3459282-7-amir73il@gmail.com
Suggested-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220321112310.vpr7oxro2xkz5llh@quack3.lan/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fdinfo.c
fs/notify/group.c
fs/notify/mark.c
include/linux/fsnotify_backend.h