From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: [PATCH] ext3 [linux-2.6.2.]: accessing already freed inodes when under memory pressure Date: Sat, 3 Apr 2004 00:42:06 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040402234206.GF653@mail.shareable.org> References: <1080653969.24117.192.camel@hades.cambridge.redhat.com> <20040402161223.GZ31500@parcelfarce.linux.theplanet.co.uk> <20040402180111.GB31500@parcelfarce.linux.theplanet.co.uk> <20040402191752.GB653@mail.shareable.org> <20040402204057.GD653@mail.shareable.org> <20040402215935.A7990@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , viro@parcelfarce.linux.theplanet.co.uk, David Woodhouse , Martin Schwidefsky , Andrew Morton , Carsten Otte , Carsten Otte , linux-fsdevel@vger.kernel.org, sct@redhat.com, Dave Kleikamp Return-path: Received: from mail.shareable.org ([81.29.64.88]:17558 "EHLO mail.shareable.org") by vger.kernel.org with ESMTP id S261378AbUDBXmm (ORCPT ); Fri, 2 Apr 2004 18:42:42 -0500 To: Christoph Hellwig Content-Disposition: inline In-Reply-To: <20040402215935.A7990@infradead.org> List-Id: linux-fsdevel.vger.kernel.org Christoph Hellwig wrote: > On Fri, Apr 02, 2004 at 09:40:57PM +0100, Jamie Lokier wrote: > > Then there are programs such as optimised Make and cacheing systems > > and servers which use dnotify. dnotify is reliable for single-linked > > files, and when there are multiple links, it's still reliable if you > > discover all the st_nlink paths to a file. However, it isn't reliable > > if there are any bind mounts, because you don't know whether you have > > all paths to a file (without grubbing inside /proc/mounts, and that > > has race conditions anyway). > > bind mounts aside how are these programs supposed to work with multiple > mounts of the same filesystem at different mountpoints, possibly in > totally different namespaces? In short everything using dnotify is buggy > anyway.. dnotify listeners are keyed on parent inode of dentry, not (dentry, mnt). So they work fine with multiple mounts at different mountpoints and in different namespaces. The sole exception is the mountpoint itself, which fails even with single mounts. dnotify just doesn't handle mountpoints. In principle anyway. I've never tried this. Your point has got me thinking, though (thanks). dnotify is fine with bind mounts, for the same reason, again with the sole exception of the mountpoint. It would be good to get notification of mount changes anyway, and that would solve the exceptions. There is still the problem where you can find st_nlink paths and incorrectly assume that's all the names of a file. That's a problem with all the examples I gave ("cp -a" etc.); nothing specifically to do with dnotify, and it happens with any multiple mounts not just bind mounts. If there's a way to detect when a path walk crosses a mount point even though st_dev doesn't change, that problem would be solved too. O_NOMOUNT would be one method. -- Jamie