On Tue, Nov 20, 2018 at 1:32 PM Jan Kara <jack@xxxxxxx> wrote: > > On Wed 14-11-18 19:43:40, Amir Goldstein wrote: > > Define a new data type to pass for event FSNOTIFY_EVENT_DENTRY > > and use it whenever a dentry is available instead of passing > > it's ->d_inode as data type FSNOTIFY_EVENT_INODE. > > > > None of the current fsnotify backends make use of the inode data > > with data type FSNOTIFY_EVENT_INODE - only the data of type > > FSNOTIFY_EVENT_PATH is ever used, so this change has no immediate > > consequences. > > > > Soon, we are going to use the dentry data type to support more > > events with fanotify backend. > > > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > One general coment: Audit is using FSNOTIFY_EVENT_INODE and this change is > going to break it. So it needs updating as well. > Ouch! I should really add the audit test suite to my testing routine... > Also I'd prefer a more justified selection of dentry events than 'those > where we can do it'. Because eventually that set will translate to events > available to userspace in fanotify and that should be a reasonably > consistent set. So here I suspect you target at directory modification > events (you call them filename events in the next patch). So just define > which FS_<foo> events these exactly are and convert exactly those event > helpers to dentry ones... > It is not accurate that I target only "directory modification" events. I also target FS_ATTRIB and in the future also FS_DELETE_SELF, both applicable to files as well as directories. But when I think about it... fanotify does not really need the dentry information, so I might just be able to do without FSNOTIFY_EVENT_DENTRY and avert the questions about stability of dentry->d_inode fanotify_dentry branch uses the dentry information in 3 occasions: 1. if (d_is_dir(dentry) in fanotify_group_event_mask() This could be converted to S_ISDIR(inode->i_mode) 2. exportfs_encode_fh(dentry,... in fanotify_alloc_fid() Can be converted to exportfs_encode_inode_fh(inode,... 3. statfs_by_dentry(dentry,... in fanotify_alloc_fid() Can be converted to statfs_by_dentry(inode->i_sb->sb_root,... I will leave the patch to annotate "directory change" events, but the rest of this prep series can be discarded. Does that sound reasonable? Thanks, Amir.