]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fsnotify: dont put marks on temporary list when clearing marks by group
authorLino Sanfilippo <LinoSanfilippo@gmx.de>
Tue, 14 Jun 2011 15:29:53 +0000 (17:29 +0200)
committerEric Paris <eparis@redhat.com>
Mon, 26 Mar 2012 15:21:16 +0000 (11:21 -0400)
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>
fs/notify/mark.c
include/linux/fsnotify_backend.h

index f9dda0304a10f71e4141617c69fc485f74183ccf..0e93d90bb753a3518235bfb04cc9da9ad912b857 100644 (file)
@@ -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);
-       }
 }
 
 /*
index 4f205fae95598f6aaa91c9c001dca4fa640f4429..3fea9d406743ffd6b286dd93c84395b30f8f1454 100644 (file)
@@ -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