Commit e42e2773 authored by Eric Paris's avatar Eric Paris

inotify/dnotify: should_send_event shouldn't match on FS_EVENT_ON_CHILD

inotify and dnotify will both indicate that they want any event which came
from a child inode.  The fix is to mask off FS_EVENT_ON_CHILD when deciding
if inotify or dnotify is interested in a given event.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent ce61856b
...@@ -153,6 +153,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, ...@@ -153,6 +153,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
if (!entry) if (!entry)
return false; return false;
mask = (mask & ~FS_EVENT_ON_CHILD);
send = (mask & entry->mask); send = (mask & entry->mask);
fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */ fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */
......
...@@ -137,14 +137,16 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const ...@@ -137,14 +137,16 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const
struct fsnotify_group *group; struct fsnotify_group *group;
struct fsnotify_event *event = NULL; struct fsnotify_event *event = NULL;
int idx; 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)) if (list_empty(&fsnotify_groups))
return; return;
if (!(mask & fsnotify_mask)) if (!(test_mask & fsnotify_mask))
return; return;
if (!(mask & to_tell->i_fsnotify_mask)) if (!(test_mask & to_tell->i_fsnotify_mask))
return; return;
/* /*
* SRCU!! the groups list is very very much read only and the path is * 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 ...@@ -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); idx = srcu_read_lock(&fsnotify_grp_srcu);
list_for_each_entry_rcu(group, &fsnotify_groups, group_list) { 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)) if (!group->ops->should_send_event(group, to_tell, mask))
continue; continue;
if (!event) { if (!event) {
......
...@@ -95,6 +95,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode ...@@ -95,6 +95,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
if (!entry) if (!entry)
return false; return false;
mask = (mask & ~FS_EVENT_ON_CHILD);
send = (entry->mask & mask); send = (entry->mask & mask);
/* find took a reference */ /* find took a reference */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment