From: Ian Kent <raven@themaw.net>
To: Nick Piggin <npiggin@suse.de>, David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 1/3] autofs4 - fix get_next_positive_dentry()
Date: Tue, 18 Jan 2011 12:06:04 +0800 [thread overview]
Message-ID: <20110118040604.23109.71500.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110118040449.23109.33071.stgit@localhost6.localdomain6>
The initialization condition in fs/autofs4/expire.c:get_next_positive_dentry()
appears to be incorrect. If prev == NULL I believe that root should be
returned.
Further down, at the current dentry check for it being simple_positive()
it looks like the d_lock for dentry p should be dropped instead of dentry
ret, otherwise when p is assinged to ret we end up with no lock on p and
a lost lock on ret, which leads to a deadlock.
---
fs/autofs4/expire.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 3ed79d7..f43100b 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -96,7 +96,7 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev,
struct dentry *p, *ret;
if (prev == NULL)
- return dget(prev);
+ return dget(root);
spin_lock(&autofs4_lock);
relock:
@@ -133,7 +133,7 @@ again:
spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED);
/* Negative dentry - try next */
if (!simple_positive(ret)) {
- spin_unlock(&ret->d_lock);
+ spin_unlock(&p->d_lock);
p = ret;
goto again;
}
next prev parent reply other threads:[~2011-01-18 4:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-18 4:05 [PATCH 0/3] Fixes for vfs-scale and vfs-automount Ian Kent
2011-01-18 4:06 ` Ian Kent [this message]
2011-01-18 4:06 ` [PATCH 2/3] vfs - fix dentry ref count in do_lookup() Ian Kent
2011-01-18 4:44 ` Al Viro
2011-01-18 4:06 ` [PATCH 3/3] autofs4 - fix debug print in autofs4_lookup() Ian Kent
2011-01-19 7:06 ` [PATCH 0/3] Fixes for vfs-scale and vfs-automount Ian Kent
2011-02-15 14:25 ` Ian Kent
2011-02-23 7:22 ` Ian Kent
2011-02-23 16:37 ` Linus Torvalds
2011-02-24 1:58 ` Al Viro
2011-02-24 3:03 ` Ian Kent
2011-02-24 3:14 ` Al Viro
[not found] ` <20110224031439.GR22723-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-02-24 3:28 ` Ian Kent
2011-02-24 3:58 ` Al Viro
2011-02-24 5:47 ` Al Viro
2011-02-24 7:23 ` Ian Kent
[not found] ` <20110224035836.GS22723-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-02-24 6:34 ` Ian Kent
2011-02-24 7:07 ` Al Viro
[not found] ` <20110224070724.GW22723-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-02-24 10:07 ` Ian Kent
2011-02-24 14:59 ` Al Viro
2011-02-24 15:18 ` Al Viro
2011-02-25 3:07 ` Ian Kent
2011-02-24 19:10 ` Al Viro
2011-02-24 10:21 ` 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=20110118040604.23109.71500.stgit@localhost6.localdomain6 \
--to=raven@themaw.net \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.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;
as well as URLs for NNTP newsgroup(s).