summaryrefslogtreecommitdiff
path: root/fs/notify/inotify
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2021-03-04 13:48:22 +0300
committerJan Kara <jack@suse.cz>2021-03-16 18:14:23 +0300
commit6f73171e192366ff7c98af9fb50615ef9615f8a7 (patch)
treea00ed271b9b71439ee22ebf1d48f63eccbbb6665 /fs/notify/inotify
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0 (diff)
downloadlinux-6f73171e192366ff7c98af9fb50615ef9615f8a7.tar.xz
fsnotify: allow fsnotify_{peek,remove}_first_event with empty queue
Current code has an assumtion that fsnotify_notify_queue_is_empty() is called to verify that queue is not empty before trying to peek or remove an event from queue. Remove this assumption by moving the fsnotify_notify_queue_is_empty() into the functions, allow them to return NULL value and check return value by all callers. This is a prep patch for multi event queues. Link: https://lore.kernel.org/r/20210304104826.3993892-2-amir73il@gmail.com Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/inotify')
-rw-r--r--fs/notify/inotify/inotify_user.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index c71be4fb7dc5..a6c95bd64618 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -146,10 +146,9 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
size_t event_size = sizeof(struct inotify_event);
struct fsnotify_event *event;
- if (fsnotify_notify_queue_is_empty(group))
- return NULL;
-
event = fsnotify_peek_first_event(group);
+ if (!event)
+ return NULL;
pr_debug("%s: group=%p event=%p\n", __func__, group, event);