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 ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux