From: Al Viro <viro@ZenIV.linux.org.uk>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: David Howells <dhowells@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] VFS: Add back check for !inode in walk_component()
Date: Thu, 7 May 2015 19:13:35 +0100 [thread overview]
Message-ID: <20150507181335.GE889@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150507133935.2d2e3181@gandalf.local.home>
On Thu, May 07, 2015 at 01:39:35PM -0400, Steven Rostedt wrote:
> I had them printed in my previous traces. The flags were 0x200088, and
> they were 0 just before the call.
Not dentry->d_flags, nd->flags. Most interesting part is bit 6 in those
(LOOKUP_RCU, 0x40).
As for creation... I think I see what might be going on:
A: finds a negative dentry, picks NULL ->d_inode from it and whatever
->d_seq it had.
B: d_instantiate(): sets ->d_inode non-NULL, ->d_flags accordingly and
bumps ->d_seq.
A: fetches ->d_flags, sees non-negative, assumes ->d_inode is non-NULL.
In reality, the last assumption should've been "->d_inode is non-NULL or
we have a stale ->d_seq and will end up discarding that fscker anyway".
Hmm... Smells like we ought to
a) in lookup_fast() turn
if (read_seqcount_retry(&dentry->d_seq, seq))
return -ECHILD;
into
if (unlikely(d_is_negative(dentry))) {
if (read_seqcount_retry(&dentry->d_seq, seq))
return -ECHILD;
else
return -ENOENT;
}
if (read_seqcount_retry(&dentry->d_seq, seq))
return -ECHILD;
and
if (likely(!err))
*inode = path->dentry->d_inode;
into
if (likely(!err)) {
*inode = path->dentry->d_inode;
if (unlikely(d_is_negative(dentry))) {
path_to_nameidata(path, nd);
err = -ENOENT;
}
}
b) in walk_component() and do_last():finish_lookup move the d_is_negative()
checks a bit up - into the body of preceding if () in the former and just
prior to the finish_lookup: in the latter.
AFAICS, the rest of d_is_negative() in fs/namei.c doesn't suffer that kind
of problem...
next prev parent reply other threads:[~2015-05-07 18:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 16:52 [PATCH] VFS: Add back check for !inode in walk_component() Steven Rostedt
2015-05-07 17:28 ` Al Viro
2015-05-07 17:39 ` Steven Rostedt
2015-05-07 17:43 ` Steven Rostedt
2015-05-07 18:13 ` Al Viro [this message]
2015-05-07 18:43 ` Al Viro
2015-05-07 19:33 ` Steven Rostedt
2015-05-07 21:47 ` Al Viro
2015-05-07 22:02 ` Steven Rostedt
2015-05-08 13:36 ` Steven Rostedt
2015-05-07 19:20 ` Steven Rostedt
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=20150507181335.GE889@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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).