Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64c20d2a authored by Lino Sanfilippo's avatar Lino Sanfilippo Committed by Eric Paris
Browse files

fsnotify: dont put marks on temporary list when clearing marks by group



In clear_marks_by_group_flags() the mark list of a group is iterated and the
marks are put on a temporary list.
Since we introduced fsnotify_destroy_mark_locked() we dont need the temp list
any more and are able to remove the marks while the mark list is iterated and
the mark list mutex is held.

Signed-off-by: default avatarLino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent d5a335b8
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -299,22 +299,16 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group,
					 unsigned int flags)
{
	struct fsnotify_mark *lmark, *mark;
	LIST_HEAD(free_list);

	mutex_lock(&group->mark_mutex);
	list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
		if (mark->flags & flags) {
			list_add(&mark->free_g_list, &free_list);
			list_del_init(&mark->g_list);
			fsnotify_get_mark(mark);
			fsnotify_destroy_mark_locked(mark, group);
			fsnotify_put_mark(mark);
		}
	}
	mutex_unlock(&group->mark_mutex);

	list_for_each_entry_safe(mark, lmark, &free_list, free_g_list) {
		fsnotify_destroy_mark(mark, group);
		fsnotify_put_mark(mark);
	}
}

/*
+0 −1
Original line number Diff line number Diff line
@@ -287,7 +287,6 @@ struct fsnotify_mark {
		struct fsnotify_inode_mark i;
		struct fsnotify_vfsmount_mark m;
	};
	struct list_head free_g_list;	/* tmp list used when freeing this mark */
	__u32 ignored_mask;		/* events types to ignore */
#define FSNOTIFY_MARK_FLAG_INODE		0x01
#define FSNOTIFY_MARK_FLAG_VFSMOUNT		0x02