Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262186AbVBQBRt (ORCPT ); Wed, 16 Feb 2005 20:17:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262187AbVBQBRt (ORCPT ); Wed, 16 Feb 2005 20:17:49 -0500 Received: from wombat.indigo.net.au ([202.0.185.19]:34317 "EHLO wombat.indigo.net.au") by vger.kernel.org with ESMTP id S262186AbVBQBRq (ORCPT ); Wed, 16 Feb 2005 20:17:46 -0500 Date: Thu, 17 Feb 2005 09:19:43 +0800 (WST) From: Ian Kent X-X-Sender: raven@wombat.indigo.net.au To: Jeff Moyer cc: Jan Blunck , viro@parcelfarce.linux.theplanet.co.uk, Linux-Kernel Mailing List , Andrew Morton , Martin Schwidefsky Subject: Re: [PATCH] dcache d_drop() bug fix / __d_drop() use fix In-Reply-To: <16915.27837.309170.73909@segfault.boston.redhat.com> Message-ID: References: <421355A4.6000305@tu-harburg.de> <16915.27837.309170.73909@segfault.boston.redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-102.5, required 8, EMAIL_ATTRIBUTION, IN_REP_TO, QUOTED_EMAIL_TEXT, REFERENCES, REPLY_WITH_QUOTES, USER_AGENT_PINE, USER_IN_WHITELIST) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1840 Lines: 57 On Wed, 16 Feb 2005, Jeff Moyer wrote: > ==> Regarding Re: [PATCH] dcache d_drop() bug fix / __d_drop() use fix; raven@themaw.net adds: > > raven> On Wed, 16 Feb 2005, Jan Blunck wrote: > >> This is a re-submission of the patch I sent about a month ago. > >> > >> While working on my code I realized that d_drop() might race against > >> __d_lookup(). __d_drop() (which is called by d_drop() after acquiring the > >> dcache_lock) is accessing dentry->d_flags to set the DCACHE_UNHASHED flag. > >> This shouldn't be done without holding dentry->d_lock, like stated in > >> dcache.h: > >> > >> struct dentry { > >> ... > >> unsigned int d_flags; /* protected by d_lock */ > >> ... > >> }; > >> > >> Therefore d_drop() must acquire the dentry->d_lock. Likewise every use of > >> __d_drop() must acquire that lock. > >> > >> This patch fixes d_drop() and every grep'able __d_drop() use. This patch is > >> against today's http://linux.bkbits.net/linux-2.5. > >> > > raven> For my part, in autofs4, I would prefer: > > > --- linux-2.6.9/fs/autofs4/root.c.d_lock 2005-02-16 23:15:18.000000000 +0800 > > +++ linux-2.6.9/fs/autofs4/root.c 2005-02-16 23:15:35.000000000 +0800 > > @@ -621,7 +621,7 @@ > > spin_unlock(&dcache_lock); > > return -ENOTEMPTY; > > } > > - __d_drop(dentry); > > + d_drop(dentry); > > spin_unlock(&dcache_lock); > > > dput(ino->dentry); > > Ian, this would deadlock. You already hold the dcache lock here, and > d_drop takes it: Ha! Yes. There is a difference between d_lock and dcache_lock. I need glasses! Please ignore what I said. 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/