Re: [PATCH 5/7] fanotify: record new parent and name in MOVED_FROM event

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

 



On Fri 29-10-21 14:40:26, Amir Goldstein wrote:
> In the special case of MOVED_FROM event, if we are recording the child
> fid due to FAN_REPORT_TARGET_FID init flag, we also record the new
> parent and name.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
...
> diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
> index 795bedcb6f9b..d1adcb3437c5 100644
> --- a/fs/notify/fanotify/fanotify.c
> +++ b/fs/notify/fanotify/fanotify.c
> @@ -592,21 +592,30 @@ static struct fanotify_event *fanotify_alloc_name_event(struct inode *id,
>  							__kernel_fsid_t *fsid,
>  							const struct qstr *name,
>  							struct inode *child,
> +							struct dentry *moved,
>  							unsigned int *hash,
>  							gfp_t gfp)
>  {
>  	struct fanotify_name_event *fne;
>  	struct fanotify_info *info;
>  	struct fanotify_fh *dfh, *ffh;
> +	struct inode *dir2 = moved ? d_inode(moved->d_parent) : NULL;

I think we need to be more careful here (like dget_parent()?). Fsnotify is
called after everything is unlocked after rename so dentry can be changing
under us, cannot it? Also does that mean that we could actually get a wrong
parent here if the dentry is renamed immediately after we unlock things and
before we report fsnotify event?

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



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

  Powered by Linux