[RFC PATCH] network fs notification

Steve French smfrench at gmail.com
Thu May 2 15:13:23 UTC 2019


Adding linux-cifs

Will take a look today - looks promising

On Wed, May 1, 2019 at 3:55 PM Miklos Szeredi <miklos at szeredi.hu> wrote:
>
> This is a really really trivial first iteration, but I think it's enough to
> try out CIFS notification support.  Doesn't deal with mark deletion, but
> that's best effort anyway: fsnotify() will filter out unneeded events.
>
> Signed-off-by: Miklos Szeredi <mszeredi at redhat.com>
> ---
>  fs/notify/fanotify/fanotify_user.c |    6 +++++-
>  fs/notify/inotify/inotify_user.c   |    2 ++
>  include/linux/fs.h                 |    1 +
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -1041,9 +1041,13 @@ static int do_fanotify_mark(int fanotify
>                 else if (mark_type == FAN_MARK_FILESYSTEM)
>                         ret = fanotify_add_sb_mark(group, mnt->mnt_sb, mask,
>                                                    flags, fsid);
> -               else
> +               else {
>                         ret = fanotify_add_inode_mark(group, inode, mask,
>                                                       flags, fsid);
> +
> +                       if (!ret && inode->i_op->notify_update)
> +                               inode->i_op->notify_update(inode);
> +               }
>                 break;
>         case FAN_MARK_REMOVE:
>                 if (mark_type == FAN_MARK_MOUNT)
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -754,6 +754,8 @@ SYSCALL_DEFINE3(inotify_add_watch, int,
>
>         /* create/update an inode mark */
>         ret = inotify_update_watch(group, inode, mask);
> +       if (!ret && inode->i_op->notify_update)
> +               inode->i_op->notify_update(inode);
>         path_put(&path);
>  fput_and_out:
>         fdput(f);
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1852,6 +1852,7 @@ struct inode_operations {
>                            umode_t create_mode);
>         int (*tmpfile) (struct inode *, struct dentry *, umode_t);
>         int (*set_acl)(struct inode *, struct posix_acl *, int);
> +       void (*notify_update)(struct inode *inode);
>  } ____cacheline_aligned;
>
>  static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,



-- 
Thanks,

Steve



More information about the samba-technical mailing list