Overflow events are not mergeable, so they are not hashed_events. But, when failing inside fsnotify_add_event, for lack of space, fsnotify_add_event() still calls the insert hook, which adds the overflow event to the merge list. Avoid calling the insert hook when adding an overflow event. Fixes: 94e00d28a680 ("fsnotify: use hash table for faster events merge") Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx> --- fs/notify/notification.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 32f45543b9c6..033294669e07 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c @@ -106,6 +106,11 @@ int fsnotify_add_event(struct fsnotify_group *group, return ret; } event = group->overflow_event; + /* + * Since overflow events are not mergeable, don't insert + * them in the merge hash. + */ + insert = NULL; goto queue; } -- 2.31.0