fsnotify: allow fsnotify_{peek,remove}_first_event with empty queue
authorAmir Goldstein <amir73il@gmail.com>
Thu, 4 Mar 2021 10:48:22 +0000 (12:48 +0200)
committerJan Kara <jack@suse.cz>
Tue, 16 Mar 2021 15:14:23 +0000 (16:14 +0100)
commit6f73171e192366ff7c98af9fb50615ef9615f8a7
treea00ed271b9b71439ee22ebf1d48f63eccbbb6665
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0
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>
fs/notify/fanotify/fanotify_user.c
fs/notify/inotify/inotify_user.c
fs/notify/notification.c
include/linux/fsnotify_backend.h