summaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2019-01-10 12:04:30 -0500
committerJan Kara <jack@suse.cz>2019-02-06 09:20:30 -0500
commit45a9fb3725d8868a9b4192afd1a1f2bff1cc5ffb (patch)
treebf2c9f46ab1c8b3d83fece3c828897066c0eaf71 /fs/notify
parente220140ff6241e180d0c2fc294e61ee6bbc6a18e (diff)
fsnotify: send all event types to super block marks
So far, existence of super block marks was checked only on events with data type FSNOTIFY_EVENT_PATH. Use the super block of the "to_tell" inode to report the events of all event types to super block marks. This change has no effect on current backends. Soon, this will allow fanotify backend to receive all event types on a super block mark. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fsnotify.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index ecf09b6243d9..df06f3da166c 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -328,16 +328,15 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
328 const unsigned char *file_name, u32 cookie) 328 const unsigned char *file_name, u32 cookie)
329{ 329{
330 struct fsnotify_iter_info iter_info = {}; 330 struct fsnotify_iter_info iter_info = {};
331 struct super_block *sb = NULL; 331 struct super_block *sb = to_tell->i_sb;
332 struct mount *mnt = NULL; 332 struct mount *mnt = NULL;
333 __u32 mnt_or_sb_mask = 0; 333 __u32 mnt_or_sb_mask = sb->s_fsnotify_mask;
334 int ret = 0; 334 int ret = 0;
335 __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); 335 __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
336 336
337 if (data_is == FSNOTIFY_EVENT_PATH) { 337 if (data_is == FSNOTIFY_EVENT_PATH) {
338 mnt = real_mount(((const struct path *)data)->mnt); 338 mnt = real_mount(((const struct path *)data)->mnt);
339 sb = mnt->mnt.mnt_sb; 339 mnt_or_sb_mask |= mnt->mnt_fsnotify_mask;
340 mnt_or_sb_mask = mnt->mnt_fsnotify_mask | sb->s_fsnotify_mask;
341 } 340 }
342 /* An event "on child" is not intended for a mount/sb mark */ 341 /* An event "on child" is not intended for a mount/sb mark */
343 if (mask & FS_EVENT_ON_CHILD) 342 if (mask & FS_EVENT_ON_CHILD)
@@ -350,8 +349,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
350 * SRCU because we have no references to any objects and do not 349 * SRCU because we have no references to any objects and do not
351 * need SRCU to keep them "alive". 350 * need SRCU to keep them "alive".
352 */ 351 */
353 if (!to_tell->i_fsnotify_marks && 352 if (!to_tell->i_fsnotify_marks && !sb->s_fsnotify_marks &&
354 (!mnt || (!mnt->mnt_fsnotify_marks && !sb->s_fsnotify_marks))) 353 (!mnt || !mnt->mnt_fsnotify_marks))
355 return 0; 354 return 0;
356 /* 355 /*
357 * if this is a modify event we may need to clear the ignored masks 356 * if this is a modify event we may need to clear the ignored masks
@@ -366,11 +365,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
366 365
367 iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = 366 iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
368 fsnotify_first_mark(&to_tell->i_fsnotify_marks); 367 fsnotify_first_mark(&to_tell->i_fsnotify_marks);
368 iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
369 fsnotify_first_mark(&sb->s_fsnotify_marks);
369 if (mnt) { 370 if (mnt) {
370 iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] = 371 iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] =
371 fsnotify_first_mark(&mnt->mnt_fsnotify_marks); 372 fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
372 iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
373 fsnotify_first_mark(&sb->s_fsnotify_marks);
374 } 373 }
375 374
376 /* 375 /*