Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Eric Paris <eparis@redhat.com>

authored by

Lino Sanfilippo and committed by
Eric Paris
64c20d2a d5a335b8

+2 -9
+2 -8
fs/notify/mark.c
··· 299 299 unsigned int flags) 300 300 { 301 301 struct fsnotify_mark *lmark, *mark; 302 - LIST_HEAD(free_list); 303 302 304 303 mutex_lock(&group->mark_mutex); 305 304 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { 306 305 if (mark->flags & flags) { 307 - list_add(&mark->free_g_list, &free_list); 308 - list_del_init(&mark->g_list); 309 306 fsnotify_get_mark(mark); 307 + fsnotify_destroy_mark_locked(mark, group); 308 + fsnotify_put_mark(mark); 310 309 } 311 310 } 312 311 mutex_unlock(&group->mark_mutex); 313 - 314 - list_for_each_entry_safe(mark, lmark, &free_list, free_g_list) { 315 - fsnotify_destroy_mark(mark, group); 316 - fsnotify_put_mark(mark); 317 - } 318 312 } 319 313 320 314 /*
-1
include/linux/fsnotify_backend.h
··· 287 287 struct fsnotify_inode_mark i; 288 288 struct fsnotify_vfsmount_mark m; 289 289 }; 290 - struct list_head free_g_list; /* tmp list used when freeing this mark */ 291 290 __u32 ignored_mask; /* events types to ignore */ 292 291 #define FSNOTIFY_MARK_FLAG_INODE 0x01 293 292 #define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02