From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>,
Mo Re Ra <more7.rev@gmail.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Wez Furlong <wez@fb.com>
Subject: Re: File monitor problem
Date: Wed, 11 Dec 2019 15:58:44 +0200 [thread overview]
Message-ID: <CAOQ4uxij13z0AazCm7AzrXOSz_eYBSFhs0mo6eZFW=57wOtwew@mail.gmail.com> (raw)
In-Reply-To: <20191211100604.GL1551@quack2.suse.cz>
On Wed, Dec 11, 2019 at 12:06 PM Jan Kara <jack@suse.cz> wrote:
>
> On Wed 04-12-19 22:27:31, Amir Goldstein wrote:
[...]
> > The way to frame this correctly IMO is that fsnotify events let application
> > know that "something has changed", without any ordering guaranty
> > beyond "sometime before the event was read".
> >
> > So far, that "something" can be a file (by fd), an inode (by fid),
> > more specifically a directory inode (by fid) where in an entry has
> > changed.
> >
> > Adding filename info extends that concept to "something has changed
> > in the namespace at" (by parent fid+name).
> > All it means is that application should pay attention to that part of
> > the namespace and perform a lookup to find out what has changed.
> >
> > Maybe the way to mitigate wrong assumptions about ordering and
> > existence of the filename in the namespace is to omit the event type
> > for "filename events", for example: { FAN_CHANGE, pfid, name }.
>
> So this event would effectively mean: In directory pfid, some filename
> event has happened with name "name" - i.e. "name" was created (could mean
> also mkdir), deleted, moved. Am I right?
Exactly.
> And the application would then
> open_by_handle(2) + open_at(2) + fstat(2) the object pointed to by
open_by_handle(2) + fstatat(2) to be exact.
> (pfid, name) pair and copy whatever it finds to the other end (or delete on
> the other end in case of ENOENT)?
Basically, yes.
Although a modern sync tool may also keep some local map of
remote name -> local fid, to detect a local rename and try to perform a
remote rename.
>
> After some thought, yes, I think this is difficult to misuse (or infer some
> false guarantees out of it). As far as I was thinking it also seems good
> enough to implement more efficient syncing of directories.
Great, so I will work on the patches.
> Mohammad, would
> this kind of event be enough for your needs? Frankly, I'd like to see a
> sample program (say dir-tree-sync) that uses this event before merging the
> kernel change so that we can verify that indeed this event is usable for
> practical purposes in a race-free way...
>
I will prepare demo code for the new API based on inotifywatch.
Mohammad, if you like you could use the demo code to present a sync tool.
I am hoping to be able to integrate the new API with Watchman as a demo.
Thanks,
Amir.
next prev parent reply other threads:[~2019-12-11 13:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 10:02 File monitor problem Mo Re Ra
2019-12-04 12:53 ` Amir Goldstein
2019-12-04 14:24 ` Mo Re Ra
2019-12-04 17:34 ` Jan Kara
2019-12-04 18:37 ` Amir Goldstein
2019-12-04 19:02 ` Matthew Wilcox
2019-12-04 20:27 ` Amir Goldstein
2019-12-11 10:06 ` Jan Kara
2019-12-11 13:58 ` Amir Goldstein [this message]
2019-12-16 15:00 ` Amir Goldstein
2019-12-19 7:33 ` Amir Goldstein
2019-12-23 18:19 ` Jan Kara
2019-12-23 19:14 ` Amir Goldstein
2019-12-24 3:49 ` Amir Goldstein
2019-12-31 11:53 ` Amir Goldstein
2020-01-07 17:10 ` Jan Kara
2020-01-07 18:56 ` Amir Goldstein
2020-01-08 9:04 ` Jan Kara
2020-01-08 10:25 ` Amir Goldstein
2020-01-08 12:04 ` Jan Kara
2019-12-07 12:36 ` Mo Re Ra
2019-12-10 16:55 ` Jan Kara
2019-12-10 20:49 ` Amir Goldstein
2019-12-11 22:06 ` Wez Furlong
2019-12-12 5:56 ` Amir Goldstein
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='CAOQ4uxij13z0AazCm7AzrXOSz_eYBSFhs0mo6eZFW=57wOtwew@mail.gmail.com' \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=more7.rev@gmail.com \
--cc=wez@fb.com \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).