summaryrefslogtreecommitdiff
path: root/fs/notify
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-01-09 15:21:01 +0300
committerJan Kara <jack@suse.cz>2019-02-18 14:41:16 +0300
commitca6f86998d810d4a9fe172bf4cb6d3353636881f (patch)
tree15a4d97762ad8d2a390dc4b5e601c227ee6fc793 /fs/notify
parentf7db89accc9c51d8f765d79b8e9557cc623ec20e (diff)
downloadlinux-ca6f86998d810d4a9fe172bf4cb6d3353636881f.tar.xz
fanotify: Simplify cleaning of access_list
Simplify iteration cleaning access_list in fanotify_release(). That will make following changes more obvious. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fanotify/fanotify_user.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 121c84fc55ee..a73ada49fd3e 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -404,7 +404,7 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t
static int fanotify_release(struct inode *ignored, struct file *file)
{
struct fsnotify_group *group = file->private_data;
- struct fanotify_perm_event *event, *next;
+ struct fanotify_perm_event *event;
struct fsnotify_event *fsn_event;
/*
@@ -419,11 +419,9 @@ static int fanotify_release(struct inode *ignored, struct file *file)
* and simulate reply from userspace.
*/
spin_lock(&group->notification_lock);
- list_for_each_entry_safe(event, next, &group->fanotify_data.access_list,
- fae.fse.list) {
- pr_debug("%s: found group=%p event=%p\n", __func__, group,
- event);
-
+ while (!list_empty(&group->fanotify_data.access_list)) {
+ event = list_first_entry(&group->fanotify_data.access_list,
+ struct fanotify_perm_event, fae.fse.list);
list_del_init(&event->fae.fse.list);
event->response = FAN_ALLOW;
}