aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fsnotify_backend.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-02-21 15:07:52 +0100
committerJan Kara <jack@suse.cz>2018-02-27 10:25:33 +0100
commit7b1f641776e0c8b824fb10135168e4b683a9e2ba (patch)
tree80f394d89521008b6bcbc980e202d25d7f35973f /include/linux/fsnotify_backend.h
parentfanotify: Avoid lost events due to ENOMEM for unlimited queues (diff)
downloadlinux-dev-7b1f641776e0c8b824fb10135168e4b683a9e2ba.tar.xz
linux-dev-7b1f641776e0c8b824fb10135168e4b683a9e2ba.zip
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 'include/linux/fsnotify_backend.h')
-rw-r--r--include/linux/fsnotify_backend.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 067d52e95f02..9f1edb92c97e 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -331,6 +331,12 @@ extern int fsnotify_add_event(struct fsnotify_group *group,
struct fsnotify_event *event,
int (*merge)(struct list_head *,
struct fsnotify_event *));
+/* Queue overflow event to a notification group */
+static inline void fsnotify_queue_overflow(struct fsnotify_group *group)
+{
+ fsnotify_add_event(group, group->overflow_event, NULL);
+}
+
/* true if the group notification queue is empty */
extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
/* return, but do not dequeue the first event on the notification queue */