From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Waychison Subject: Re: [RFC][PATCH 1/8] namespace: use global namespace semaphore Date: Tue, 31 May 2005 11:43:21 -0400 Message-ID: <429C8619.5010301@waychison.com> References: <429BD8B7.7070906@waychison.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: raven@themaw.net, linux-fsdevel@vger.kernel.org, jamie@shareable.org, viro@parcelfarce.linux.theplanet.co.uk Return-path: Received: from dsl081-242-086.sfo1.dsl.speakeasy.net ([64.81.242.86]:57517 "EHLO lapdance.christiehouse.net") by vger.kernel.org with ESMTP id S261914AbVEaPpy (ORCPT ); Tue, 31 May 2005 11:45:54 -0400 To: Miklos Szeredi In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Miklos Szeredi wrote: >> - this triggers the actual mount in the daemon, which mounts over >> the autofs filesystem (with some trick to avoid recursion) > > > BTW, there's an elegant way to avoid recursion: > > - _before_ mounting the autofs, do mpfd = open(mountpoint, O_RDONLY). > > - then mount autofs > > - when mount trigger comes in do: fchdir(mpfd), mount whatever . > > This way the autofs mount won't be followed by the mount program, > since looking up '.' does not follow mounts. > > So the result is two sibling mounts: the original autofs and the > actual filesystem. But subsequent lookups will see the later mount > only, since it's placed earlier on the hash chain, and lookup_mnt() will > always return that. Indeed. This is how autofsng handles direct mounts and 'browse' mounts currently, although it currently uses mountfds to do a move in the end (avoiding having to hijack cwd to do the final move). This could be better achieved by mount --move'ing to /proc/self/fd/#. Mike Waychison -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCnIYZdQs4kOxk3/MRAskPAJ9kAXkVsCu9GKtliB5O5otVmbVb7QCePbxy xMst1n+X3kGvWmJrUr1Je+0= =WKDP -----END PGP SIGNATURE-----