summaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-01-09 07:21:01 -0500
committerJan Kara <jack@suse.cz>2019-02-18 06:41:16 -0500
commitca6f86998d810d4a9fe172bf4cb6d3353636881f (patch)
tree15a4d97762ad8d2a390dc4b5e601c227ee6fc793 /fs/notify
parentf7db89accc9c51d8f765d79b8e9557cc623ec20e (diff)
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
404static int fanotify_release(struct inode *ignored, struct file *file) 404static int fanotify_release(struct inode *ignored, struct file *file)
405{ 405{
406 struct fsnotify_group *group = file->private_data; 406 struct fsnotify_group *group = file->private_data;
407 struct fanotify_perm_event *event, *next; 407 struct fanotify_perm_event *event;
408 struct fsnotify_event *fsn_event; 408 struct fsnotify_event *fsn_event;
409 409
410 /* 410 /*
@@ -419,11 +419,9 @@ static int fanotify_release(struct inode *ignored, struct file *file)
419 * and simulate reply from userspace. 419 * and simulate reply from userspace.
420 */ 420 */
421 spin_lock(&group->notification_lock); 421 spin_lock(&group->notification_lock);
422 list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, 422 while (!list_empty(&group->fanotify_data.access_list)) {
423 fae.fse.list) { 423 event = list_first_entry(&group->fanotify_data.access_list,
424 pr_debug("%s: found group=%p event=%p\n", __func__, group, 424 struct fanotify_perm_event, fae.fse.list);
425 event);
426
427 list_del_init(&event->fae.fse.list); 425 list_del_init(&event->fae.fse.list);
428 event->response = FAN_ALLOW; 426 event->response = FAN_ALLOW;
429 } 427 }