linux-stable/fs/notify
Amir Goldstein aabb45fdcb dnotify: use fsnotify group lock helpers
Before commit 9542e6a643 ("nfsd: Containerise filecache laundrette")
nfsd would close open files in direct reclaim context.  There is no
guarantee that others memory shrinkers don't do the same and no
guarantee that future shrinkers won't do that.

For example, if overlayfs implements inode cache of fscache would
keep open files to cached objects, inode shrinkers could end up closing
open files to underlying fs.

Direct reclaim from dnotify mark allocation context may try to close
open files that have dnotify marks of the same group and hit a deadlock
on mark_mutex.

Set the FSNOTIFY_GROUP_NOFS flag to prevent going into direct reclaim
from allocations under dnotify group lock and use the safe group lock
helpers.

Link: https://lore.kernel.org/r/20220422120327.3459282-11-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>
2022-04-25 14:37:34 +02:00
..
dnotify dnotify: use fsnotify group lock helpers 2022-04-25 14:37:34 +02:00
fanotify fsnotify: pass flags argument to fsnotify_alloc_group() 2022-04-25 14:37:12 +02:00
inotify inotify: use fsnotify group lock helpers 2022-04-25 14:37:24 +02:00
fdinfo.c fsnotify: create helpers for group mark_mutex lock 2022-04-25 14:37:22 +02:00
fdinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fsnotify.c inotify: move control flags from mask to mark flags 2022-04-25 14:37:06 +02:00
fsnotify.h fsnotify: count all objects with attached connectors 2021-08-11 13:50:48 +02:00
group.c fsnotify: create helpers for group mark_mutex lock 2022-04-25 14:37:22 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mark.c fsnotify: create helpers for group mark_mutex lock 2022-04-25 14:37:22 +02:00
notification.c fsnotify: Pass group argument to free_event 2021-10-27 12:34:18 +02:00