Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756038AbYFJJNX (ORCPT ); Tue, 10 Jun 2008 05:13:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752535AbYFJJNP (ORCPT ); Tue, 10 Jun 2008 05:13:15 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:40641 "EHLO out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176AbYFJJNN (ORCPT ); Tue, 10 Jun 2008 05:13:13 -0400 X-Sasl-enc: 55Kd306istUocnWykrV2RzS8EajEPrxiK9u7sB7RZuNG 1213089191 Subject: Re: Linux 2.6.26-rc4 From: Ian Kent To: Jesper Krogh Cc: Al Viro , Jeff Moyer , Linus Torvalds , Miklos Szeredi , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org In-Reply-To: <1213080010.3024.42.camel@raven.themaw.net> References: <20080603105258.GV28946@ZenIV.linux.org.uk> <1212499623.3025.46.camel@raven.themaw.net> <1212509263.3025.66.camel@raven.themaw.net> <1212513189.3025.101.camel@raven.themaw.net> <20080603173029.GD28946@ZenIV.linux.org.uk> <20080603191859.GG28946@ZenIV.linux.org.uk> <20080603230026.GH28946@ZenIV.linux.org.uk> <1212547323.3146.45.camel@raven.themaw.net> <1213073861.3024.34.camel@raven.themaw.net> <484E1F20.4060804@krogh.cc> <1213080010.3024.42.camel@raven.themaw.net> Content-Type: text/plain Date: Tue, 10 Jun 2008 17:09:43 +0800 Message-Id: <1213088983.3024.49.camel@raven.themaw.net> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-4.fc8) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3854 Lines: 75 On Tue, 2008-06-10 at 14:40 +0800, Ian Kent wrote: > On Tue, 2008-06-10 at 08:28 +0200, Jesper Krogh wrote: > > Ian Kent wrote: > > > On Wed, 2008-06-04 at 10:42 +0800, Ian Kent wrote: > > >> On Wed, 2008-06-04 at 00:00 +0100, Al Viro wrote: > > >>> On Tue, Jun 03, 2008 at 03:53:36PM -0400, Jeff Moyer wrote: > > >>> > > >>>> autofs4_lookup is called on behalf a process trying to walk into an > > >>>> automounted directory. That dentry's d_flags is set to > > >>>> DCACHE_AUTOFS_PENDING but not hashed. A waitqueue entry is created, > > >>>> indexed off of the name of the dentry. A callout is made to the > > >>>> automount daemon (via autofs4_wait). > > >>>> > > >>>> The daemon looks up the directory name in its configuration. If it > > >>>> finds a valid map entry, it will then create the directory using > > >>>> sys_mkdir. The autofs4_lookup call on behalf of the daemon (oz_mode == > > >>>> 1) will return NULL, and then the mkdir call will be made. The > > >>>> autofs4_mkdir function then instantiates the dentry which, by the way, > > >>>> is different from the original dentry passed to autofs4_lookup. (This > > >>>> dentry also does not get the PENDING flag set, which is a bug addressed > > >>>> by a patch set that Ian and I have been working on; specifically, the > > >>>> idea is to reuse the dentry from the original lookup, but I digress). > > >>>> > > >>>> The daemon then mounts the share on the given directory and issues an > > >>>> ioctl to wakeup the waiter. When awakened, the waiter clears the > > >>>> DCACHE_AUTOFS_PENDING flag, does another lookup of the name in the > > >>>> dcache and returns that dentry if found. > > >>>> Later, the dentry gets expired via another ioctl. That path sets > > >>>> the AUTOFS_INF_EXPIRING flag in the d_fsdata associated with the dentry. > > >>>> It then calls out to the daemon to perform the unmount and rmdir. The > > >>>> rmdir unhashes the dentry (and places it on the rehash list). > > >>>> > > >>>> The dentry is removed from the rehash list if there was a racing expire > > >>>> and mount or if the dentry is released. > > >>>> > > >>>> This description is valid for the tree as it stands today. Ian and I > > >>>> have been working on fixing some other race conditions which will change > > >>>> the dentry life cycle (for the better, I hope). > > >>> So what happens if new lookup hits between umount and rmdir? > > >> It will wait for the expire to complete and then wait for a mount > > >> request to the daemon. > > > > > > Actually, that explanation is a bit simple minded. > > > > > > It should wait for the expire in ->revalidate(). > > > Following the expire completion d_invalidate() should return 0, since > > > the dentry is now unhashed, which causes ->revalidate() to return 0. > > > do_lookup() should see this and call a ->lookup(). > > > > > > But maybe I've missed something as I'm seeing a problem now. > > > > Ok. Ive been running on the patch for a few days now .. and didn't see > > any problems. But that being said, I also turned off the --ghost option > > to autofs so if it actually is the patch or the different codepaths > > being used, I dont know. Since this is a production system, I'm a bit > > reluctant to just change a working setup to test it out. > > No need to change anything. Mmmm .. that comment might not be accurate either. It's beginning to look like my original approach, a post from back in Feb 2007, to fix a deadlock bug, wasn't right at all. But we don't really have time to determine that for sure now as it can take several days for the bug to trigger. Ian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/