linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Hugh Dickins <hughd@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Dominique Martinet <dominique.martinet@cea.fr>,
	Al Viro <viro@zeniv.linux.org.uk>,
	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 07:58:45 +0200	[thread overview]
Message-ID: <20150801055845.GA1860@nautica> (raw)
In-Reply-To: <alpine.LSU.2.11.1507311709370.12383@eggly.anvils>

Hugh Dickins wrote on Fri, Jul 31, 2015:
> On Fri, 31 Jul 2015, Linus Torvalds wrote:
>> I'd be more suspicious about other effects. For example, iot's not at
>> all obvious that the commit in question just changes the order of the
>> flags/inode field accesses, there are potentialy bigger changes there.
>> For example, this part (in __d_obtain_alias):
>> 
>> -       tmp->d_inode = inode;
>> -       tmp->d_flags |= add_flags;
>> +       __d_set_inode_and_type(tmp, inode, add_flags);
>> 
>> looks a bit off, because it *used* to just add those flags, but now,
>> through __d_set_inode_and_type, it does
>> 
>> +       dentry->d_inode = inode;
>> +       smp_wmb();
>> +       flags = READ_ONCE(dentry->d_flags);
>> +       flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
>> +       flags |= type_flags;
>> +       WRITE_ONCE(dentry->d_flags, flags);
>> 
>> so it clears DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU.
>> 
>> 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.

Yeah, had spotted this and tried to fix just this bit, but it didn't
seem to change much for my problem.
Not saying it isn't a bug, but I have no idea what __d_obtain_alias
does and nobody seemed to care about this bit in my previous thread.

> Yes, the one which grabbed my attention is:
> 
> @@ -311,7 +346,7 @@ static void dentry_iput(struct dentry * dentry)
>  {
>  	struct inode *inode = dentry->d_inode;
>  	if (inode) {
> -		dentry->d_inode = NULL;
> +		__d_clear_type_and_inode(dentry);
>  		hlist_del_init(&dentry->d_u.d_alias);
>  		spin_unlock(&dentry->d_lock);
>  		spin_unlock(&inode->i_lock);

Oh, missed that one... Running tests with just that over the weekend,
it's a good candidate and the first 10 minutes of tests sound quite
positive!

I think it's wrong to call it a "fix" even if it stops the bug from
reproducing though, the way I understand the intent of the patch, they
want that checking d_flags be enough to take decisions without having to
check d_inode as well - so now things rely on that, it's still going to
be wrong on HEAD... I think?
(I'm running tests at this commit, so I don't have the patches that rely
on that yet)

As I understand things, the fact that lookup managed to get a
being-removed entry from rcu/wherever isn't changed, it's just that it
won't fail as fast and maybe something later will notice the lack of
inode and fallback graciously instead of that ENOTDIR I've been
tracking -- so that commit makes it possible to hit the bug, but there's
another issue about taking the dentry in the first place?


I really need to spend some time to understand vfs/dcache better as a
whole at some point, I've been looking at a small part of it without
context for too long...


Cheers,
-- 
Dominique

  reply	other threads:[~2015-08-01  5:59 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 [this message]
2015-08-01  7:26         ` Al Viro
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=20150801055845.GA1860@nautica \
    --to=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 \
    --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).