From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [some sanity for a change] possible design issues for hybrids Date: Thu, 26 Aug 2004 16:57:01 -0700 (PDT) Message-ID: References: <20040826191323.GY21964@parcelfarce.linux.theplanet.co.uk> <20040826203228.GZ21964@parcelfarce.linux.theplanet.co.uk> <20040826212853.GA21964@parcelfarce.linux.theplanet.co.uk> <20040826223625.GB21964@parcelfarce.linux.theplanet.co.uk> <20040826225308.GC21964@parcelfarce.linux.theplanet.co.uk> <20040826234048.GD21964@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Denis Vlasenko , Rik van Riel , Diego Calleja , jamie@shareable.org, christophe@saout.de, christer@weinigel.se, spam@tnonline.net, akpm@osdl.org, wichert@wiggy.net, jra@samba.org, reiser@namesys.com, hch@lst.de, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, flx@namesys.com, reiserfs-list@namesys.com Return-path: list-help: list-unsubscribe: list-post: Errors-To: flx@namesys.com To: viro@parcelfarce.linux.theplanet.co.uk In-Reply-To: <20040826234048.GD21964@parcelfarce.linux.theplanet.co.uk> List-Id: linux-fsdevel.vger.kernel.org On Fri, 27 Aug 2004 viro@parcelfarce.linux.theplanet.co.uk wrote: > On Thu, Aug 26, 2004 at 04:24:51PM -0700, Linus Torvalds wrote: > > So basically: the "d_mounted++" just makes sure we get into > > "lookup_mnt()". That's where we will usually find the actual mount thing. > > > > And that's also where the special case comes in: if we _don't_ find the > > mount thing there, that's where we need to create it. That will only > > happen if somebody looks it up using another namespace, though, so it > > should be rare. > > No. Trivial example: > > mount --bind /foo /bar > mount /dev/sda1 /bar/baz > > do lookup for /foo/baz. No namespaces involved, no vfsmounts found, d_mounted > positive and we certainly do *not* want anything to be created at that point. Right. We obviously need to mark the dentry somehow, and only do the "create vfsmount" special case in this special case. If we didn't do that, then it wouldn't be a special case, now would it? So clearly lookup_mnt() needs to check the dentry in the failure case. The marking could be in any of three places - mark the dentry itself by just using a dentry flag ("DCACHE_AUTOVFSMNT") or by having a dentry operation for this. - mark the inode itself (same logic as dentry) - look up the first vfsmount (on the inode list), and look if that one is of the automatic type. Clearly we should not _always_ create a vfsmount, that would just break the existign logic. Linus