diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index ec459b6e8c641302515dc244f0ecce62f5404694..98a751614c748076e4b3514582ec0e56cfac2770 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c @@ -153,6 +153,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, if (!entry) return false; + mask = (mask & ~FS_EVENT_ON_CHILD); send = (mask & entry->mask); fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */ diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index f11d75f0236844ea4d1244e8dbf625849d8aec1d..ec2f7bd76818411b7a64b2784e86abec2eb9611b 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -137,14 +137,16 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const struct fsnotify_group *group; struct fsnotify_event *event = NULL; int idx; + /* global tests shouldn't care about events on child only the specific event */ + __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); if (list_empty(&fsnotify_groups)) return; - if (!(mask & fsnotify_mask)) + if (!(test_mask & fsnotify_mask)) return; - if (!(mask & to_tell->i_fsnotify_mask)) + if (!(test_mask & to_tell->i_fsnotify_mask)) return; /* * SRCU!! the groups list is very very much read only and the path is @@ -153,7 +155,7 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const */ idx = srcu_read_lock(&fsnotify_grp_srcu); list_for_each_entry_rcu(group, &fsnotify_groups, group_list) { - if (mask & group->mask) { + if (test_mask & group->mask) { if (!group->ops->should_send_event(group, to_tell, mask)) continue; if (!event) { diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index 160da54868398a35d9f00c598da82094756c2022..7ef75b83247e96945ab3c82d5fba0a60f42e00eb 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c @@ -95,6 +95,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode if (!entry) return false; + mask = (mask & ~FS_EVENT_ON_CHILD); send = (entry->mask & mask); /* find took a reference */