Re: [PATCH v7 12/18] fanotify: add a helper to check for pre content events

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

 



On Tue, Nov 12, 2024 at 6:56 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
>
> We want to emit events during page fault, and calling into fanotify
> could be expensive, so add a helper to allow us to skip calling into
> fanotify from page fault.  This will also be used to disable readahead
> for content watched files which will be handled in a subsequent patch.
>
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> ---
>  fs/notify/fsnotify.c             | 12 ++++++++++++
>  include/linux/fsnotify_backend.h | 26 ++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+)
>
> diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
> index cab5a1a16e57..17047c44cf91 100644
> --- a/fs/notify/fsnotify.c
> +++ b/fs/notify/fsnotify.c
> @@ -203,6 +203,18 @@ static inline bool fsnotify_object_watched(struct inode *inode, __u32 mnt_mask,
>         return mask & marks_mask & ALL_FSNOTIFY_EVENTS;
>  }
>
> +#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
> +bool fsnotify_file_object_watched(struct file *file, __u32 mask)
> +{
> +       struct inode *inode = file_inode(file);
> +       __u32 mnt_mask = real_mount(file->f_path.mnt)->mnt_fsnotify_mask;
> +
> +       return fsnotify_object_watched(inode, mnt_mask, mask);
> +}
> +EXPORT_SYMBOL_GPL(fsnotify_file_object_watched);
> +#endif
> +

FYI, I was going to use this helper to set the FMODE_ flags, but
I noticed that it is missing the check for parent watching pre content
events.

The other user of fsnotify_object_watched(), __fsnotify_parent()
explicitly checks the fsnotify_inode_watches_children() mask.

I will need to add this.

Thanks,
Amir.





[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