fanotify: allow ignored_masks to survive modify
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 users may want to truely ignore an inode even if it has been modified.
Say you are wanting a mount which contains a log file and you really don't
want any notification about that file.  This patch allows the listener to
do that.

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

index ad02d475770f0b192f0b32c8a2eff8d2d884bde4..3e275f17e7b7573b2e01cff35f429cb551ccde50 100644 (file)
@@ -375,6 +375,8 @@ static __u32 fanotify_mark_add_to_mask(struct fsnotify_mark *fsn_mark,
        } else {
                oldmask = fsn_mark->ignored_mask;
                fsnotify_set_mark_ignored_mask_locked(fsn_mark, (oldmask | mask));
+               if (flags & FAN_MARK_IGNORED_SURV_MODIFY)
+                       fsn_mark->flags |= FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY;
        }
        spin_unlock(&fsn_mark->lock);
 
index b8daa9f9b5605e46d47370b1e0166a923aeaedde..e43934d0b74c26d880f3bd2929cadb0641d827f8 100644 (file)
 #define FAN_MARK_ONLYDIR       0x00000008
 #define FAN_MARK_MOUNT         0x00000010
 #define FAN_MARK_IGNORED_MASK  0x00000020
+#define FAN_MARK_IGNORED_SURV_MODIFY   0x00000040
 
 #define FAN_ALL_MARK_FLAGS     (FAN_MARK_ADD |\
                                 FAN_MARK_REMOVE |\
                                 FAN_MARK_DONT_FOLLOW |\
                                 FAN_MARK_ONLYDIR |\
                                 FAN_MARK_MOUNT |\
-                                FAN_MARK_IGNORED_MASK)
+                                FAN_MARK_IGNORED_MASK |\
+                                FAN_MARK_IGNORED_SURV_MODIFY)
 
 /*
  * All of the events - we build the list by hand so that we can add flags in