Re: [PATCH v4 13/15] fanotify: support events with data type FSNOTIFY_EVENT_INODE

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

 



On Fri, Jan 4, 2019 at 12:17 PM Jan Kara <jack@xxxxxxx> wrote:
>
> On Sun 02-12-18 13:38:24, Amir Goldstein wrote:
> > When event data type is FSNOTIFY_EVENT_INODE, we don't have a refernece
> > to the mount, so we will not be able to open a file descriptor when user
> > reads the event. However, if the listener has enabled reporting file
> > identifier with the FAN_REPORT_FID init flag, we allow repoting those
>                                                          ^^^ reporting
>
> > events and we use an indentifier inode to encode fid.
>                         ^^ identifier
>
> > The inode to use as indetifier when reporting fid depedns on the event.
>                         ^^ identifier                   ^^ depends
>
> > For dirent modification events, we report the modified directory inode
> > and we report the "victim" inode otherwise.
> > For example:
> > FS_ATTRIB reports the child inode even if reported on a watched parent.
> > FS_CREATE reports the modified dir inode and not the created inode.
> >
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ...
> > @@ -201,13 +202,34 @@ static int fanotify_encode_fid(struct fanotify_event *event,
> >       return FILEID_INVALID;
> >  }
> >
> > +/*
> > + * The inode to use as indetifier when reporting fid depedns on the event.
>                           ^^ identifier                 ^^ depends
>
> > + * Report the modified directory inode on dirent modification events.
> > + * Report the "victim" inode otherwise.
> > + * For example:
> > + * FS_ATTRIB reports the child inode even if reported on a watched parent.
> > + * FS_CREATE reports the modified dir inode and not the created inode.
> > + */
> > +static struct inode *fanotify_report_id(struct inode *to_tell, u32 event_mask,
> > +                                     const void *data, int data_type)
> > +{
> > +     if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS)
> > +             return to_tell;
> > +     else if (data_type == FSNOTIFY_EVENT_INODE)
> > +             return (struct inode *)data;
> > +     else if (data_type == FSNOTIFY_EVENT_PATH)
> > +             return d_inode(((struct path *)data)->dentry);
> > +     return NULL;
> > +}
> > +
>
> Maybe call this function fanotify_fid_inode()?

Sounds good.

Thanks,
Amir.



[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