aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-06-11 11:09:47 -0400
committerEric Paris <eparis@redhat.com>2009-06-11 14:57:54 -0400
commite42e27736de80045f925564ea27a1d32957219e7 (patch)
treecae8a5bc81f02c7563625e30f5f0d05357dc3701
parentce61856bd2aadb064f595e5c0444376a2b117c41 (diff)
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: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/dnotify/dnotify.c1
-rw-r--r--fs/notify/fsnotify.c8
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c1
3 files changed, 7 insertions, 3 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index ec459b6e8c64..98a751614c74 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,
153 if (!entry) 153 if (!entry)
154 return false; 154 return false;
155 155
156 mask = (mask & ~FS_EVENT_ON_CHILD);
156 send = (mask & entry->mask); 157 send = (mask & entry->mask);
157 158
158 fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */ 159 fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index f11d75f02368..ec2f7bd76818 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
137 struct fsnotify_group *group; 137 struct fsnotify_group *group;
138 struct fsnotify_event *event = NULL; 138 struct fsnotify_event *event = NULL;
139 int idx; 139 int idx;
140 /* global tests shouldn't care about events on child only the specific event */
141 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
140 142
141 if (list_empty(&fsnotify_groups)) 143 if (list_empty(&fsnotify_groups))
142 return; 144 return;
143 145
144 if (!(mask & fsnotify_mask)) 146 if (!(test_mask & fsnotify_mask))
145 return; 147 return;
146 148
147 if (!(mask & to_tell->i_fsnotify_mask)) 149 if (!(test_mask & to_tell->i_fsnotify_mask))
148 return; 150 return;
149 /* 151 /*
150 * SRCU!! the groups list is very very much read only and the path is 152 * 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 */ 155 */
154 idx = srcu_read_lock(&fsnotify_grp_srcu); 156 idx = srcu_read_lock(&fsnotify_grp_srcu);
155 list_for_each_entry_rcu(group, &fsnotify_groups, group_list) { 157 list_for_each_entry_rcu(group, &fsnotify_groups, group_list) {
156 if (mask & group->mask) { 158 if (test_mask & group->mask) {
157 if (!group->ops->should_send_event(group, to_tell, mask)) 159 if (!group->ops->should_send_event(group, to_tell, mask))
158 continue; 160 continue;
159 if (!event) { 161 if (!event) {
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 160da5486839..7ef75b83247e 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
95 if (!entry) 95 if (!entry)
96 return false; 96 return false;
97 97
98 mask = (mask & ~FS_EVENT_ON_CHILD);
98 send = (entry->mask & mask); 99 send = (entry->mask & mask);
99 100
100 /* find took a reference */ 101 /* find took a reference */