Skip to content

Commit 45a9fb3

Browse files
amir73iljankara
authored andcommitted
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>
1 parent e220140 commit 45a9fb3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/notify/fsnotify.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,15 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
328328
const unsigned char *file_name, u32 cookie)
329329
{
330330
struct fsnotify_iter_info iter_info = {};
331-
struct super_block *sb = NULL;
331+
struct super_block *sb = to_tell->i_sb;
332332
struct mount *mnt = NULL;
333-
__u32 mnt_or_sb_mask = 0;
333+
__u32 mnt_or_sb_mask = sb->s_fsnotify_mask;
334334
int ret = 0;
335335
__u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
336336

337337
if (data_is == FSNOTIFY_EVENT_PATH) {
338338
mnt = real_mount(((const struct path *)data)->mnt);
339-
sb = mnt->mnt.mnt_sb;
340-
mnt_or_sb_mask = mnt->mnt_fsnotify_mask | sb->s_fsnotify_mask;
339+
mnt_or_sb_mask |= mnt->mnt_fsnotify_mask;
341340
}
342341
/* An event "on child" is not intended for a mount/sb mark */
343342
if (mask & FS_EVENT_ON_CHILD)
@@ -350,8 +349,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
350349
* SRCU because we have no references to any objects and do not
351350
* need SRCU to keep them "alive".
352351
*/
353-
if (!to_tell->i_fsnotify_marks &&
354-
(!mnt || (!mnt->mnt_fsnotify_marks && !sb->s_fsnotify_marks)))
352+
if (!to_tell->i_fsnotify_marks && !sb->s_fsnotify_marks &&
353+
(!mnt || !mnt->mnt_fsnotify_marks))
355354
return 0;
356355
/*
357356
* 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,
366365

367366
iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
368367
fsnotify_first_mark(&to_tell->i_fsnotify_marks);
368+
iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
369+
fsnotify_first_mark(&sb->s_fsnotify_marks);
369370
if (mnt) {
370371
iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] =
371372
fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
372-
iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
373-
fsnotify_first_mark(&sb->s_fsnotify_marks);
374373
}
375374

376375
/*

0 commit comments

Comments
 (0)