public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John McCutchan <ttb@tentacle.dhs.org>
To: viro@parcelfarce.linux.theplanet.co.uk
Cc: nautilus-list@gnome.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH] inotify -- a dnotify replacement
Date: Tue, 11 May 2004 15:02:31 -0400	[thread overview]
Message-ID: <20040511190228.GA12609@tentacle.dhs.org> (raw)
In-Reply-To: <20040511124647.GE17014@parcelfarce.linux.theplanet.co.uk>

On Tue, May 11, 2004 at 01:46:47PM +0100, viro@parcelfarce.linux.theplanet.co.uk wrote:
> On Tue, May 11, 2004 at 08:20:01AM -0400, John McCutchan wrote:
>  
> > Inotify will support watching a hierarchy. The reason it was not
> > implemented yet is because the one app that I really care about is
> > nautilus and the maintainer of it says he doesn't care. 
> 
> How are you going to implement that?

>From a quick glance at someone elses implementation of it, I plan on
walking up the dentries and checking at each level if a watcher on that
level is interested in events from subdirectories. Is this good practice in
the kernel?

> > The big feature that inotify is trying to provide is not having to keep
> > a file open (So that unmounting is not affected). I asked for some
> > guidance from people more familiar with the kernel so that I can
> > implement this feature, it requires changes made to the inode cache, and
> > how unmounting is done.
> 
> Bzzert.  First of all, on quite a few filesystems inumbers are stable
> only when object is pinned down.  What's more, if it's not pinned down
> you've got nothing even remotely resembling a reliable way to tell if
> two events had happened to the same object - inumbers can be reused.

The inode will be pinned down, I haven't implemented this yet but I am
going to change the inode cache (is this the right place? )
so that if inode->watcher_count > 0 the inode stays pinned. Then when
the filesystem is unmounted, we will kick off all the watchers on
each inode.

> 
> Besides, your "doesn't pin down" is racy as hell - not to mention the
> way you manage the lists, pretty much every function is an exploitable
> hole.  Hell, just take a look at your "find inode" stuff - you grab
> superblock, find an inode by inumber (great idea, that - especially
> since on a bunch of filesystems it will get you BUG() or equivalent)
> then drop refernce to superblock (at which point it can be destroyed by
> umount()) _and_ do iput() (which will do lovely, lovely things if that
> umount did happen).  Moreover, you return a pointer to inode, even
> though there's nothing to hold it alive anymore.  And dereference that
> pointer later on, not caring if it had been freed/reused/whatever.

Like I said above,as long as an inode has a watcher it will be pinned. As
for the races, I plan on implementing locking around all of the list operations.
Perhaps I wasn't very clear that this is very much a WIP and lots of work is
needed.

> 
> Overall: hopeless crap.  And that's a direct result of your main feature -
> it's really broken by design.

Having directory event notification without needing to keep a file open on the
device is not broken by design. It is the only reasonable solution to
a problem that needs fixing. You can't simply say that a file manager
needing to be notified when directories change is broken. How would
you solve this problem?

John

  reply	other threads:[~2004-05-11 19:04 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-10  1:35 [RFC/PATCH] inotify -- a dnotify replacement John McCutchan
2004-05-10  2:11 ` Chris Wedgwood
2004-05-10 22:17   ` John McCutchan
2004-05-10 22:31     ` Davide Libenzi
2004-05-10 22:41       ` John McCutchan
2004-05-10 22:52         ` Davide Libenzi
2004-05-10 23:10           ` Valdis.Kletnieks
2004-05-10 23:42             ` Davide Libenzi
2004-05-11  4:11         ` Chris Wedgwood
2004-05-11  2:00     ` Ian Kent
2004-05-11  2:47     ` Chris Wedgwood
2004-05-11 11:52       ` nf
2004-05-11 12:17         ` Stephen Rothwell
2004-05-11 12:24         ` John McCutchan
     [not found]         ` <1084278605.3839.47.camel@carados.180sw.com>
     [not found]           ` <1084885604.4062.48.camel@lilota.lamp.priv>
     [not found]             ` <1085127066.20393.440.camel@localhost.localdomain>
2004-05-21 12:04               ` nf
2004-05-11 12:20       ` John McCutchan
2004-05-11 12:46         ` viro
2004-05-11 19:02           ` John McCutchan [this message]
2004-05-11 20:28             ` carbonated beverage
2004-05-11 21:28               ` John McCutchan
2004-05-11 15:02       ` Alexander Larsson
2004-05-11 21:41         ` Chris Wedgwood
2004-05-12 12:38     ` Jörn Engel
2004-05-13 15:36 ` raven
2004-05-13 19:04   ` Chris Wedgwood
2004-05-14  7:04     ` Ian Kent
2004-05-13 21:24   ` John McCutchan
2004-05-14  2:02     ` Ian Kent
2004-05-15  4:52 ` raven

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=20040511190228.GA12609@tentacle.dhs.org \
    --to=ttb@tentacle.dhs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nautilus-list@gnome.org \
    --cc=viro@parcelfarce.linux.theplanet.co.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