aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/dnotify/dnotify.c11
-rw-r--r--fs/notify/fanotify/fanotify.c23
-rw-r--r--fs/notify/fsnotify.c4
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c14
4 files changed, 14 insertions, 38 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index e3e855ff0dd8..c3dc15879a52 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -129,20 +129,11 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
129 struct fsnotify_mark *mark, __u32 mask, 129 struct fsnotify_mark *mark, __u32 mask,
130 void *data, int data_type) 130 void *data, int data_type)
131{ 131{
132 bool send;
133
134 /* !dir_notify_enable should never get here, don't waste time checking
135 if (!dir_notify_enable)
136 return 0; */
137
138 /* not a dir, dnotify doesn't care */ 132 /* not a dir, dnotify doesn't care */
139 if (!S_ISDIR(inode->i_mode)) 133 if (!S_ISDIR(inode->i_mode))
140 return false; 134 return false;
141 135
142 mask = (mask & ~FS_EVENT_ON_CHILD); 136 return true;
143 send = (mask & mark->mask);
144
145 return send;
146} 137}
147 138
148static void dnotify_free_mark(struct fsnotify_mark *fsn_mark) 139static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 666ccb733066..fbd7f35c6134 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -185,22 +185,15 @@ static bool should_send_inode_event(struct fsnotify_group *group,
185 pr_debug("%s: group=%p inode=%p mark=%p mask=%x\n", 185 pr_debug("%s: group=%p inode=%p mark=%p mask=%x\n",
186 __func__, group, inode, mark, mask); 186 __func__, group, inode, mark, mask);
187 187
188 /* if the event is for a child and this inode doesn't care about 188 /*
189 * events on the child, don't send it! */ 189 * if the event is for a child and this inode doesn't care about
190 * events on the child, don't send it!
191 */
190 if ((mask & FS_EVENT_ON_CHILD) && 192 if ((mask & FS_EVENT_ON_CHILD) &&
191 !(mark->mask & FS_EVENT_ON_CHILD)) { 193 !(mark->mask & FS_EVENT_ON_CHILD))
192 mask = 0; 194 return false;
193 } else { 195 else
194 /* 196 return true;
195 * We care about children, but do we care about this particular
196 * type of event?
197 */
198 mask &= ~FS_EVENT_ON_CHILD;
199 mask &= mark->mask;
200 mask &= ~mark->ignored_mask;
201 }
202
203 return mask;
204} 197}
205 198
206static bool fanotify_should_send_event(struct fsnotify_group *group, struct inode *to_tell, 199static bool fanotify_should_send_event(struct fsnotify_group *group, struct inode *to_tell,
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 59d639996cad..53b31f46d698 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -180,8 +180,8 @@ static int send_to_group(struct fsnotify_group *group, struct inode *to_tell,
180 " data_is=%d cookie=%d event=%p\n", __func__, group, to_tell, 180 " data_is=%d cookie=%d event=%p\n", __func__, group, to_tell,
181 mnt, mark, mask, data, data_is, cookie, *event); 181 mnt, mark, mask, data, data_is, cookie, *event);
182 182
183 if (!group->ops->should_send_event(group, to_tell, mnt, mark, mask, 183 if (group->ops->should_send_event(group, to_tell, mnt, mark, mask,
184 data, data_is)) 184 data, data_is) == false)
185 return 0; 185 return 0;
186 if (!*event) { 186 if (!*event) {
187 *event = fsnotify_create_event(to_tell, mask, data, 187 *event = fsnotify_create_event(to_tell, mask, data,
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index aa3f93c03e0f..7cf518b25daa 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -142,23 +142,15 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
142 struct vfsmount *mnt, struct fsnotify_mark *mark, 142 struct vfsmount *mnt, struct fsnotify_mark *mark,
143 __u32 mask, void *data, int data_type) 143 __u32 mask, void *data, int data_type)
144{ 144{
145 bool send; 145 if ((mark->mask & FS_EXCL_UNLINK) &&
146
147 pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n",
148 __func__, group, inode, mask, data, data_type);
149
150 mask = (mask & ~FS_EVENT_ON_CHILD);
151 send = (mark->mask & mask);
152
153 if (send && (mark->mask & FS_EXCL_UNLINK) &&
154 (data_type == FSNOTIFY_EVENT_FILE)) { 146 (data_type == FSNOTIFY_EVENT_FILE)) {
155 struct file *file = data; 147 struct file *file = data;
156 148
157 if (d_unlinked(file->f_path.dentry)) 149 if (d_unlinked(file->f_path.dentry))
158 send = false; 150 return false;
159 } 151 }
160 152
161 return send; 153 return true;
162} 154}
163 155
164/* 156/*