mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "C. Scott Ananian" <cscott@laptop.org>
To: "Al Viro" <viro@zeniv.linux.org.uk>
Cc: "Eric Paris" <eparis@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH -v4 00/14] fsnotify, dnotify, and inotify
Date: Mon, 22 Dec 2008 18:08:08 -0500	[thread overview]
Message-ID: <c6d9bea0812221508n75f03ebdsff5bcbabe56eae56@mail.gmail.com> (raw)
In-Reply-To: <20081222210410.GL28946@ZenIV.linux.org.uk>

On Mon, Dec 22, 2008 at 4:04 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Mon, Dec 22, 2008 at 02:59:37PM -0500, C. Scott Ananian wrote:
>> > 2) major vfs and every FS redesign me thinks.
>>
>> I'm not convinced of that.  I'm pretty certain one could export
>> symlinks /proc/<pid>/mountinfo/<dev>/<inode> -> <absolute path in
>> processes' namespace> with very little trouble, and no violence done
>> to the VFS, which already has an iget() function which does the heavy
>> lifting.
>
> There is no such thing as absolute path of inode *anywhere*, process
> namespace or not.  Not on any UNIX.  Period.  End of story.

That's not correct, as /proc/self/fd/<num> and the getcwd syscall make
clear.  struct inode has a i_dentry member, and via its d_parent links
you can reconstruct the path, as __d_path in fs/dcache.c does.

Of course, this only works as long as the inode is in the kernel's
cache (which implies all the appropriate dentry items are there, too).
 For an open file descriptor, this works well.  If you index the open
file now and then return sometime later to try to open it, there's no
guarantee.

If the inode represents a directory, we *could* use the magic '..' and
'.' entries to reconstruct its path, even without its being in the
cache.  I haven't looked hard, but that might involve VFS violence.
But having to manually track what directory inode a given file was in
is still an improvement over having to duplicate the entire directory
tree.

We can also debate whether finding *a* name for the inode if
sufficient, or if you really need to know *all* names for the inode.
One is plenty if you're just looking for a path to give on the command
line to (say) emacs to open the file after a successful search.  But
then emacs may not be happy when it tries to write a backup file to an
arbitrarily chosen directory.

> Al, once again astonished by the ability of desktop developers to post from the alternative realities they apparently inhabit...

I think you're prejudging.  I'm certainly posting from a weird twisted
alternate reality, but by and large it's not the "desktop developer"
one. ;-)

There are a paucity of good solutions.  We can follow the example of
old-school UNIX dump and open the filesystem's block device directly
to map inodes to paths.  Or we can use 'find' over the entire
filesystem.  Or we can duplicate the filesystem's directory structure
in userspace so that we can correctly associate index information with
the current path to the given file?

inotify *almost* lets us do that last thing (though the code
duplication pains me) but is too racy for reliable use. Give me a
kernel interface without races and I'll call it a good start.  If you
can save me the trouble of duplicating all of the filesystem's
directory information in my userspace database in order to handle
directory moves, I'll actually grin a little.
 --scott

-- 
                         ( http://cscott.net/ )

  reply	other threads:[~2008-12-22 23:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 21:51 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 [this message]
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
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=c6d9bea0812221508n75f03ebdsff5bcbabe56eae56@mail.gmail.com \
    --to=cscott@laptop.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

Powered by JetHome