]> git.ipfire.org Git - people/ms/linux.git/blobdiff - fs/notify/fsnotify.c
Merge branch 'for-6.0/dax' into libnvdimm-fixes
[people/ms/linux.git] / fs / notify / fsnotify.c
index 0b3e74935cb4f07f7f8bcff5295f08d48854adad..7974e91ffe134f49d866bbc0ceb55a0ec1998897 100644 (file)
@@ -100,7 +100,7 @@ void fsnotify_sb_delete(struct super_block *sb)
  * Given an inode, first check if we care what happens to our children.  Inotify
  * and dnotify both tell their parents about events.  If we care about any event
  * on a child we run all of our children and set a dentry flag saying that the
- * parent cares.  Thus when an event happens on a child it can quickly tell if
+ * parent cares.  Thus when an event happens on a child it can quickly tell
  * if there is a need to find a parent and send the event to the parent.
  */
 void __fsnotify_update_child_dentry_flags(struct inode *inode)
@@ -324,7 +324,8 @@ static int send_to_group(__u32 mask, const void *data, int data_type,
        struct fsnotify_group *group = NULL;
        __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
        __u32 marks_mask = 0;
-       __u32 marks_ignored_mask = 0;
+       __u32 marks_ignore_mask = 0;
+       bool is_dir = mask & FS_ISDIR;
        struct fsnotify_mark *mark;
        int type;
 
@@ -336,7 +337,7 @@ static int send_to_group(__u32 mask, const void *data, int data_type,
                fsnotify_foreach_iter_mark_type(iter_info, mark, type) {
                        if (!(mark->flags &
                              FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY))
-                               mark->ignored_mask = 0;
+                               mark->ignore_mask = 0;
                }
        }
 
@@ -344,14 +345,15 @@ static int send_to_group(__u32 mask, const void *data, int data_type,
        fsnotify_foreach_iter_mark_type(iter_info, mark, type) {
                group = mark->group;
                marks_mask |= mark->mask;
-               marks_ignored_mask |= mark->ignored_mask;
+               marks_ignore_mask |=
+                       fsnotify_effective_ignore_mask(mark, is_dir, type);
        }
 
-       pr_debug("%s: group=%p mask=%x marks_mask=%x marks_ignored_mask=%x data=%p data_type=%d dir=%p cookie=%d\n",
-                __func__, group, mask, marks_mask, marks_ignored_mask,
+       pr_debug("%s: group=%p mask=%x marks_mask=%x marks_ignore_mask=%x data=%p data_type=%d dir=%p cookie=%d\n",
+                __func__, group, mask, marks_mask, marks_ignore_mask,
                 data, data_type, dir, cookie);
 
-       if (!(test_mask & marks_mask & ~marks_ignored_mask))
+       if (!(test_mask & marks_mask & ~marks_ignore_mask))
                return 0;
 
        if (group->ops->handle_event) {
@@ -423,7 +425,8 @@ static bool fsnotify_iter_select_report_types(
                         * But is *this mark* watching children?
                         */
                        if (type == FSNOTIFY_ITER_TYPE_PARENT &&
-                           !(mark->mask & FS_EVENT_ON_CHILD))
+                           !(mark->mask & FS_EVENT_ON_CHILD) &&
+                           !(fsnotify_ignore_mask(mark) & FS_EVENT_ON_CHILD))
                                continue;
 
                        fsnotify_iter_set_report_type(iter_info, type);
@@ -532,8 +535,8 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir,
 
 
        /*
-        * If this is a modify event we may need to clear some ignored masks.
-        * In that case, the object with ignored masks will have the FS_MODIFY
+        * If this is a modify event we may need to clear some ignore masks.
+        * In that case, the object with ignore masks will have the FS_MODIFY
         * event in its mask.
         * Otherwise, return if none of the marks care about this type of event.
         */