From: Miklos Szeredi <miklos@szeredi.hu>
To: Steve French <smfrench@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Amir Goldstein <amir73il@gmail.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] network fs notification
Date: Tue, 7 May 2019 10:57:07 +0200 [thread overview]
Message-ID: <20190507085707.GD30899@veci.piliscsaba.redhat.com> (raw)
In-Reply-To: <20190501205541.GC30899@veci.piliscsaba.redhat.com>
On Wed, May 01, 2019 at 04:55:41PM -0400, Miklos Szeredi 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.
And this one actually does something for inotify. I haven't tested fanotify
yet, but that one looks okay.
Note: FAN_MARK_MOUNT doesn't work yet, and we are not sure if it should work or
not. FAN_MARK_FILESYSTEM would be a better candidate for remote notification,
since remote accesses are not associated with any particular local mount of the
filesystem. But perhaps we need to turn on whole file notification for remote
due to the fact that applications rely on FAN_MARK_MOUNT already... Btw, does the smb protocol support whole filesystem (or subtree) notifications?
Thanks,
Miklos
---
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 >= 0 && 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,
prev parent reply other threads:[~2019-05-07 8:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 20:55 [RFC PATCH] network fs notification Miklos Szeredi
2019-05-02 14:39 ` Jan Kara
2019-05-02 15:08 ` Amir Goldstein
2019-05-02 15:41 ` Jan Kara
2019-05-02 17:22 ` Miklos Szeredi
2019-05-07 8:57 ` Miklos Szeredi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507085707.GD30899@veci.piliscsaba.redhat.com \
--to=miklos@szeredi.hu \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox