diff options
author | Jan Kara <jack@suse.cz> | 2018-02-21 17:07:52 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2018-02-27 12:25:33 +0300 |
commit | 7b1f641776e0c8b824fb10135168e4b683a9e2ba (patch) | |
tree | 80f394d89521008b6bcbc980e202d25d7f35973f /fs/notify/notification.c | |
parent | 1f5eaa90010ed7cf0ae90a526c48657d02c6086f (diff) | |
download | linux-7b1f641776e0c8b824fb10135168e4b683a9e2ba.tar.xz |
fsnotify: Let userspace know about lost events due to ENOMEM
Currently if notification event is lost due to event allocation failing
we ENOMEM, we just silently continue (except for fanotify permission
events where we deny the access). This is undesirable as userspace has
no way of knowing whether the notifications it got are complete or not.
Treat lost events due to ENOMEM the same way as lost events due to queue
overflow so that userspace knows something bad happened and it likely
needs to rescan the filesystem.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/notification.c')
-rw-r--r-- | fs/notify/notification.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 66f85c651c52..3c3e36745f59 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c @@ -111,7 +111,8 @@ int fsnotify_add_event(struct fsnotify_group *group, return 2; } - if (group->q_len >= group->max_events) { + if (event == group->overflow_event || + group->q_len >= group->max_events) { ret = 2; /* Queue overflow event only if it isn't already queued */ if (!list_empty(&group->overflow_event->list)) { |