From: Al Viro <viro@ZenIV.linux.org.uk>
To: "C. Scott Ananian" <cscott@laptop.org>
Cc: Eric Paris <eparis@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH -v4 00/14] fsnotify, dnotify, and inotify
Date: Fri, 26 Dec 2008 01:44:01 +0000 [thread overview]
Message-ID: <20081226014401.GT28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <c6d9bea0812251658o4710f761j113fbeec9e5e1c97@mail.gmail.com>
On Thu, Dec 25, 2008 at 07:58:23PM -0500, C. Scott Ananian wrote:
> > Indeed - explicit, persistent and wrong. For current directory of a process
> > we store vfsmount and dentry. And use those in getcwd() rather than playing
> > hopeless games with inodes.
>
> Geez. Please don't treat me as if I can't read source code.
>
> I suggested a Mach-like iopen mechanism to address some inotify races.
> In order to show that extreme VFS violence might not be necessary, I
> pointed out that *in some cases* you can derive *some paths* to the
> file from the inode number, using the iget()->i_dentry list. But
> you've driven me far off-topic.
BTW, XFS open-by-inode implementation is severely broken - try using
it for directories and you'll get all kinds of hell breaking loose.
And that's the only attempt at iopen in Linux.
While we are at it, iget() is not a generic interface - it's strictly
up to specific filesystem whether that sucker will work at all. Or
what kind of data will have to be required for it to work on given fs,
assuming it will work to start with.
> Let's get back to the problem at hand. The most obvious problem with
> inotify is the race between mkdir/IN_CREATE and the userspace process
[snip]
> As far as I can tell, none of the existing Linux desktop search tools
> attempt to deal with these races. (Beagle handles the 'mkdir' race,
> but not the other rename races.) This is acceptable only if an
> unreliable file index is acceptable.
... and inotify is unreliable by design, or what passes for it anyway.
> Some possible improvements to the situtation (all bad, in various ways
> -- better suggestions wanted!):
>
> a) do nothing. Most developers will ignore the races in inotify out
> of ignorance or complexity, and most applications which use inotify
> will be unreliable as a result.
>
> b) use inode numbers rather than path names uniformly, in both
> inotify and the userland search index, along with an iopen() syscall,
> as in Mach. This decouples path maintenance from indexing. This was
> discussed in (for example)
> http://www.coda.cs.cmu.edu/maillists/codalist/codalist-1998/0217.html
> by Peter J. Braam and Ted Ts'o, but Al Viro has been objecting to the
> idea here. (If all you need to do is open found files after a search,
> you can skip path maintenance entirely.)
For one thing, opened directory can be fchdir'ed to. Or passed to
openat() et.al. For another, go ahead, show me how to implement that
sucker for something like NFS. Or CIFS. Or FAT, while we are at it.
Or anything that does have stable numbers identifying fs objects, but where
those numbers are huge.
> c) Pass file descriptors in the notification API from the kernel.
> This solves the races associated with renames before indexing.
> Userland still has to maintain its own copy of all the direntries for
> indexed content, but at least this task is decoupled. (The proposed
> fanotify API passes file descriptors, but provides no mechanism (yet)
> for path maintenance.)
>
> d) Do all indexing in the filesystem. BeOS used this option; in
> Linux-land, this would probably be a thin FUSE shim which layered over
> an existing filesystem. The shim could grab the appropriate locks to
> manage the races and ensure that the index's path information was
> consistent with the filesystem.
e) start with providing a higher-level description of what you want to
achieve. While we are at it, is it supposed to be fs-agnostic? What
kinds of filesystems could in principle be used with that?
So far you've mentioned use of blatantly inadequate tool and far too
low-level description of changes that might possibly make it more
tolerable for unspecified use you have in mind. I'm sorry, but that's
exactly how a bunch of bad APIs (including inotify) got pushed into the
tree and I would rather not repeat the experience.
Interfaces must make sense. And "we need <list of things> for our project,
nevermind what are they for, here's what we would like to see" is a recipe
for kludges. Inotify, dnotify, F_SETLEASE, etc. Sigh...
next prev parent reply other threads:[~2008-12-26 1:44 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-12 21:51 [RFC PATCH -v4 00/14] fsnotify, dnotify, and inotify Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 01/14] filesystem notification: create fs/notify to contain all fs notification Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 02/14] fsnotify: pass a file instead of an inode to open, read, and write Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 03/14] fsnotify: sys_execve and sys_uselib do not call into fsnotify Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 04/14] fsnotify: use the new open-exec hook for inotify and dnotify Eric Paris
2008-12-13 15:29 ` Christoph Hellwig
2008-12-12 21:51 ` [RFC PATCH -v4 05/14] fsnotify: unified filesystem notification backend Eric Paris
2008-12-13 2:54 ` Evgeniy Polyakov
2008-12-13 15:01 ` Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 06/14] fsnotify: add group priorities Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 07/14] fsnotify: add in inode fsnotify markings Eric Paris
2008-12-13 3:07 ` Evgeniy Polyakov
2008-12-13 16:35 ` Eric Paris
2008-12-22 13:43 ` Al Viro
2008-12-22 14:45 ` Eric Paris
2008-12-12 21:51 ` [RFC PATCH -v4 08/14] fsnotify: parent event notification Eric Paris
2008-12-12 21:52 ` [RFC PATCH -v4 09/14] dnotify: reimplement dnotify using fsnotify Eric Paris
2008-12-12 21:52 ` [RFC PATCH -v4 10/14] fsnotify: generic notification queue and waitq Eric Paris
2008-12-12 21:52 ` [RFC PATCH -v4 11/14] fsnotify: include pathnames with entries when possible Eric Paris
2008-12-13 3:19 ` Evgeniy Polyakov
2008-12-13 16:42 ` Eric Paris
2008-12-12 21:52 ` [RFC PATCH -v4 12/14] fsnotify: add correlations between events Eric Paris
2008-12-18 22:28 ` C. Scott Ananian
2008-12-22 2:40 ` Eric Paris
2008-12-22 9:01 ` Evgeniy Polyakov
2008-12-22 20:06 ` C. Scott Ananian
2008-12-12 21:52 ` [RFC PATCH -v4 13/14] inotify: reimplement inotify using fsnotify Eric Paris
2008-12-13 3:22 ` Evgeniy Polyakov
2008-12-13 16:44 ` Eric Paris
2008-12-15 15:48 ` Evgeniy Polyakov
2008-12-12 21:52 ` [RFC PATCH -v4 14/14] shit on top for debugging Eric Paris
2008-12-14 22:40 ` James Morris
2008-12-14 22:47 ` Eric Paris
2008-12-18 23:36 ` [RFC PATCH -v4 00/14] fsnotify, dnotify, and inotify C. Scott Ananian
2008-12-22 3:22 ` Eric Paris
2008-12-22 10:58 ` Niraj Kumar
2008-12-22 19:59 ` C. Scott Ananian
2008-12-22 20:53 ` Eric Paris
2008-12-29 18:19 ` C. Scott Ananian
2008-12-22 21:04 ` Al Viro
2008-12-22 23:08 ` C. Scott Ananian
2008-12-22 23:20 ` Al Viro
2008-12-22 23:21 ` Christoph Hellwig
2008-12-25 18:17 ` C. Scott Ananian
2008-12-25 20:33 ` Al Viro
2008-12-26 0:58 ` C. Scott Ananian
2008-12-26 1:44 ` Al Viro [this message]
2008-12-27 21:23 ` C. Scott Ananian
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=20081226014401.GT28946@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=cscott@laptop.org \
--cc=eparis@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.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