fsnotify: allow ignored_mask to survive modification
authorEric Paris <eparis@redhat.com>
Fri, 18 Dec 2009 02:24:33 +0000 (21:24 -0500)
committerEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 13:59:00 +0000 (09:59 -0400)
Some inodes a group may want to never hear about a set of events even if
the inode is modified.  We add a new mark flag which indicates that these
marks should not have their ignored_mask cleared on modification.

Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/fsnotify.c
include/linux/fsnotify_backend.h

index 3ad940d0bac145a531ddae9318d1a4d7eb7c4d81..54d58d5f72c1c4fe22c3fceeb443f74f13b89cc6 100644 (file)
@@ -148,7 +148,8 @@ void __fsnotify_flush_ignored_mask(struct inode *inode, void *data, int data_is)
        if (!hlist_empty(&inode->i_fsnotify_marks)) {
                spin_lock(&inode->i_lock);
                hlist_for_each_entry(mark, node, &inode->i_fsnotify_marks, i.i_list) {
-                       mark->ignored_mask = 0;
+                       if (!(mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY))
+                               mark->ignored_mask = 0;
                }
                spin_unlock(&inode->i_lock);
        }
@@ -160,7 +161,8 @@ void __fsnotify_flush_ignored_mask(struct inode *inode, void *data, int data_is)
                if (mnt && !hlist_empty(&mnt->mnt_fsnotify_marks)) {
                        spin_lock(&mnt->mnt_root->d_lock);
                        hlist_for_each_entry(mark, node, &mnt->mnt_fsnotify_marks, m.m_list) {
-                               mark->ignored_mask = 0;
+                               if (!(mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY))
+                                       mark->ignored_mask = 0;
                        }
                        spin_unlock(&mnt->mnt_root->d_lock);
                }
index 018416ec5ce4000563278583bda230bc2a8a8024..8ca19df8a1713197bf5c4c22d598c373d994a273 100644 (file)
@@ -271,6 +271,7 @@ struct fsnotify_mark {
 #define FSNOTIFY_MARK_FLAG_INODE               0x01
 #define FSNOTIFY_MARK_FLAG_VFSMOUNT            0x02
 #define FSNOTIFY_MARK_FLAG_OBJECT_PINNED       0x04
+#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
        unsigned int flags;             /* vfsmount or inode mark? */
        void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
 };