From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dominique Martinet <asmadeus@codewreck.org>,
Hugh Dickins <hughd@google.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
Dominique Martinet <dominique.martinet@cea.fr>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
David Howells <dhowells@redhat.com>
Subject: Re: v4.2-rc dcache regression, probably 75a6f82a0d10
Date: Sat, 1 Aug 2015 08:26:03 +0100 [thread overview]
Message-ID: <20150801072603.GV17109@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFz9jj_wAjXNoFbKFbV3M1Ki2KhHuoMwQGPi0wiQjMXdsw@mail.gmail.com>
On Fri, Jul 31, 2015 at 03:52:38PM -0700, Linus Torvalds wrote:
> Is that correct? Maybe, I haven't checked. And maybe it's a big bad
> bug. Regardless, it sure as hell isn't just changing the order of the
> access to those fields. That "DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU"
> clearing came from __d_instantiate(), but now it hits __d_obtain_alias
> too.
Actually, the shit had hit the fan earlier. Look: in
commit b18825a7c8e37a7cf6abb97a12a6ad71af160de7
Author: David Howells <dhowells@redhat.com>
Date: Thu Sep 12 19:22:53 2013 +0100
VFS: Put a small type field into struct dentry::d_flags
we have this:
@@ -1823,7 +1794,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (err)
return err;
}
- if (!can_lookup(nd->inode)) {
+ if (!d_is_directory(nd->path.dentry)) {
err = -ENOTDIR;
break;
}
And that has turned the check done to an inode that *was* ours at some
point (i.e. fetching it had been followed by checking that ->d_seq had
been still valid) into something completely unprotected. Suppose we
are in lazy mode and somebody had evicted nd->path.dentry after we'd looked
it up and before that check. Sure, its ->d_seq had been bumped by that,
and we would've failed anyway. With ECHILD. Which, unlike ENOTDIR, is
"repeat in non-lazy mode".
AFAICS, that's where the problem is. It affects only RCU mode and only
the places where dentry isn't pinned. That place in link_path_walk() is
trivial - we just need to do
if (unlikely(!d_can_lookup(nd->path.dentry))) {
if (nd->flags & LOOKUP_RCU) {
if (unlazy_walk(nd, NULL, 0))
return -ECHILD;
}
return -ENOTDIR;
}
there. AFAICS, other places of that sort are not a problem anymore.
Folks, could you check if this fixes the problems you are seeing?
diff --git a/fs/namei.c b/fs/namei.c
index ae4e4c1..b16c3a7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1954,7 +1954,11 @@ OK:
continue;
}
}
- if (unlikely(!d_can_lookup(nd->path.dentry)))
+ if (unlikely(!d_can_lookup(nd->path.dentry))) {
+ if (nd->flags & LOOKUP_RCU) {
+ if (unlazy_walk(nd, NULL, 0))
+ return -ECHILD;
+ }
return -ENOTDIR;
}
}
next prev parent reply other threads:[~2015-08-01 7:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 17:46 v4.2-rc dcache regression, probably 75a6f82a0d10 Hugh Dickins
2015-07-31 17:59 ` Dominique Martinet
2015-07-31 18:00 ` J. Bruce Fields
2015-07-31 18:42 ` Linus Torvalds
2015-07-31 19:42 ` Hugh Dickins
2015-07-31 20:50 ` Dominique Martinet
2015-07-31 22:52 ` Linus Torvalds
2015-08-01 0:20 ` Hugh Dickins
2015-08-01 5:58 ` Dominique Martinet
2015-08-01 7:26 ` Al Viro [this message]
2015-08-01 10:19 ` Dominique Martinet
2015-08-01 10:50 ` Dominique Martinet
2015-08-01 16:09 ` Linus Torvalds
2015-08-01 17:09 ` Al Viro
2015-08-02 0:14 ` [git pull] vfs.git spurious ENOTDIR fix Al Viro
2015-08-02 0:23 ` Al Viro
2015-08-02 0:42 ` Linus Torvalds
2015-08-02 0:57 ` Linus Torvalds
2015-08-02 1:41 ` Al Viro
2015-08-02 2:39 ` Linus Torvalds
2015-08-02 4:06 ` Hugh Dickins
2015-08-02 4:39 ` Al Viro
2015-08-02 4:42 ` Linus Torvalds
2015-08-02 18:53 ` Hugh Dickins
2015-08-01 0:09 ` v4.2-rc dcache regression, probably 75a6f82a0d10 Hugh Dickins
2015-08-01 4:20 ` Hugh Dickins
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=20150801072603.GV17109@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=asmadeus@codewreck.org \
--cc=bfields@fieldses.org \
--cc=dhowells@redhat.com \
--cc=dominique.martinet@cea.fr \
--cc=hughd@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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).