summaryrefslogtreecommitdiffstats
path: root/fs/notify/fanotify/fanotify.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.com>2021-10-25 21:27:34 +0200
committerJan Kara <jack@suse.cz>2021-10-27 12:35:05 +0200
commit734a1a5eccc5f7473002b0669f788e135f1f64aa (patch)
tree9a2bf10a36c11cd378181c3cefba5440391715a5 /fs/notify/fanotify/fanotify.c
parentfanotify: Reserve UAPI bits for FAN_FS_ERROR (diff)
downloadlinux-734a1a5eccc5f7473002b0669f788e135f1f64aa.tar.xz
linux-734a1a5eccc5f7473002b0669f788e135f1f64aa.zip
fanotify: Pre-allocate pool of error events
Pre-allocate slots for file system errors to have greater chances of succeeding, since error events can happen in GFP_NOFS context. This patch introduces a group-wide mempool of error events, shared by all FAN_FS_ERROR marks in this group. Link: https://lore.kernel.org/r/20211025192746.66445-20-krisman@collabora.com Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify.c')
-rw-r--r--fs/notify/fanotify/fanotify.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 8f152445d75c..01d68dfc74aa 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -819,6 +819,9 @@ static void fanotify_free_group_priv(struct fsnotify_group *group)
if (group->fanotify_data.ucounts)
dec_ucount(group->fanotify_data.ucounts,
UCOUNT_FANOTIFY_GROUPS);
+
+ if (mempool_initialized(&group->fanotify_data.error_events_pool))
+ mempool_exit(&group->fanotify_data.error_events_pool);
}
static void fanotify_free_path_event(struct fanotify_event *event)