Re: [PATCH v3 02/13] fsnotify: send all event types to super block marks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun 25-11-18 15:43:41, Amir Goldstein wrote:
> 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@xxxxxxxxx>

Looks good.

								Honza

> ---
>  fs/notify/fsnotify.c | 15 +++++++--------
>  1 file 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,
>  	     const unsigned char *file_name, u32 cookie)
>  {
>  	struct fsnotify_iter_info iter_info = {};
> -	struct super_block *sb = NULL;
> +	struct super_block *sb = to_tell->i_sb;
>  	struct mount *mnt = NULL;
> -	__u32 mnt_or_sb_mask = 0;
> +	__u32 mnt_or_sb_mask = sb->s_fsnotify_mask;
>  	int ret = 0;
>  	__u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
>  
>  	if (data_is == FSNOTIFY_EVENT_PATH) {
>  		mnt = real_mount(((const struct path *)data)->mnt);
> -		sb = mnt->mnt.mnt_sb;
> -		mnt_or_sb_mask = mnt->mnt_fsnotify_mask | sb->s_fsnotify_mask;
> +		mnt_or_sb_mask |= mnt->mnt_fsnotify_mask;
>  	}
>  	/* An event "on child" is not intended for a mount/sb mark */
>  	if (mask & FS_EVENT_ON_CHILD)
> @@ -350,8 +349,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
>  	 * SRCU because we have no references to any objects and do not
>  	 * need SRCU to keep them "alive".
>  	 */
> -	if (!to_tell->i_fsnotify_marks &&
> -	    (!mnt || (!mnt->mnt_fsnotify_marks && !sb->s_fsnotify_marks)))
> +	if (!to_tell->i_fsnotify_marks && !sb->s_fsnotify_marks &&
> +	    (!mnt || !mnt->mnt_fsnotify_marks))
>  		return 0;
>  	/*
>  	 * 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,
>  
>  	iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
>  		fsnotify_first_mark(&to_tell->i_fsnotify_marks);
> +	iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
> +		fsnotify_first_mark(&sb->s_fsnotify_marks);
>  	if (mnt) {
>  		iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] =
>  			fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
> -		iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] =
> -			fsnotify_first_mark(&sb->s_fsnotify_marks);
>  	}
>  
>  	/*
> -- 
> 2.17.1
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux