From: Jeff Moyer <jmoyer@redhat.com>
To: raven@themaw.net
Cc: Jan Blunck <j.blunck@tu-harburg.de>,
viro@parcelfarce.linux.theplanet.co.uk,
Linux-Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH] dcache d_drop() bug fix / __d_drop() use fix
Date: Wed, 16 Feb 2005 10:54:37 -0500 [thread overview]
Message-ID: <16915.27837.309170.73909@segfault.boston.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0502162318240.8161@donald.themaw.net>
==> 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:
static inline void d_drop(struct dentry *dentry)
{
spin_lock(&dcache_lock);
__d_drop(dentry);
spin_unlock(&dcache_lock);
}
The proposed patch was to take the dentry->d_lock.
-Jeff
next prev parent reply other threads:[~2005-02-16 15:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 14:16 Jan Blunck
2005-02-16 15:20 ` raven
2005-02-16 15:54 ` Jeff Moyer [this message]
2005-02-17 1:19 ` Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16915.27837.309170.73909@segfault.boston.redhat.com \
--to=jmoyer@redhat.com \
--cc=akpm@osdl.org \
--cc=j.blunck@tu-harburg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=raven@themaw.net \
--cc=schwidefsky@de.ibm.com \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®