From: Linus Torvalds <torvalds@linux-foundation.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Alexey Dobriyan <adobriyan@gmail.com>,
ebiederm@xmission.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: 2.6.27-rc7-sha1: EIP at proc_sys_compare+0x36/0x50
Date: Sun, 28 Sep 2008 13:55:29 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0809281350410.3265@nehalem.linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0809282011020.1967@blonde.site>
On Sun, 28 Sep 2008, Hugh Dickins wrote:
>
> I got a couple of earlier instances of this on powerpc
> http://lkml.org/lkml/2008/8/14/289
> but saw nothing more of it, so asked Al to forget about it.
>
> But today I've got it again, this time on x86_64, with kdb in
> (but not serial console), similar kernel builds with swapping
> loads as before. Though with Andrew's latest mmotm, so some
> details different from 2.6.27-rc, and could be an mmotm bug.
Ok, you were definitely under memory pressure, and yes, it looks like the
exact same bug on ppc64 - access to a pointer that is two poointers offset
down from NULL.
> The dentry in question (it's for /proc/sys/kernel/ngroups_max)
> looks as if the __d_drop and d_kill of prune_one_dentry() came
> in on one cpu just after __d_lookup() had found the entry on
> parent's hashlist, just before it acquired dentry->d_lock.
Yes.
> That's plausible, isn't it, and would account for the rarity,
> and would say Linus's patch is good?
>
> Do ask me for any details you'd like out of the dentry.
I actually like my second patch better - it looks simpler, and it means
that the rules for filesystems using d_compare() are a bit clearer: at
least we'll only pass them dentries to look at that haven't gone through
d_drop (and we do hold dentry->d_lock that serializes all of that).
So here it is again (I sent it out just minutes ago, but you weren't on
that cc, you must have picked this up off the kernel list)
NOTE! Totally untested patch! It looks sane and really obvious, but maybe
it has some insane and non-obvious bug.
Linus
---
fs/dcache.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 80e9395..e7a1a99 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
if (dentry->d_parent != parent)
goto next;
+ /* non-existing due to RCU? */
+ if (d_unhashed(dentry))
+ goto next;
+
/*
* It is safe to compare names since d_move() cannot
* change the qstr (protected by d_lock).
@@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
goto next;
}
- if (!d_unhashed(dentry)) {
- atomic_inc(&dentry->d_count);
- found = dentry;
- }
+ atomic_inc(&dentry->d_count);
+ found = dentry;
spin_unlock(&dentry->d_lock);
break;
next:
next prev parent reply other threads:[~2008-09-28 20:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 15:20 Alexey Dobriyan
2008-09-26 15:47 ` Linus Torvalds
2008-09-27 8:44 ` Eric W. Biederman
2008-09-28 20:38 ` Linus Torvalds
2008-09-28 14:18 ` Al Viro
2008-09-28 19:28 ` Hugh Dickins
2008-09-28 20:55 ` Linus Torvalds [this message]
2008-09-28 20:59 ` Linus Torvalds
2008-09-28 22:07 ` Hugh Dickins
2008-09-29 3:05 ` Eric W. Biederman
2008-09-28 20:46 ` Linus Torvalds
2008-09-28 20:50 ` Linus Torvalds
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=alpine.LFD.1.10.0809281350410.3265@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome