linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.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 12:19:13 +0200	[thread overview]
Message-ID: <20150801101913.GA24028@nautica> (raw)
In-Reply-To: <20150801072603.GV17109@ZenIV.linux.org.uk>

Al Viro wrote on Sat, Aug 01, 2015:
> 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".

That sounds like a good find, I was looking at how to claim/protect the
entry somehow as well but I just have no idea...

> 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;
>  	}
>  }

Unfortunately, still happens for me.

I had to adapt a bit because using an old kernel (4bf46a272), will try
again with a recent master to doublecheck, but I had a break on
the "if (nd->flags & LOOKUP_RCU)" check:
 - sometimes fails without ever hitting the check. I think this fixes
the "ENOTDIR" I had described, but there's at least another way to
fail?
 - When we do hit it, we're into LOOKUP_RCU at this point alright,
unlazy_walk fails and we try again without RCU -- can confirm the
recovery process goes OK (well, that it went OK at least once)


Thanks,
-- 
Dominique

  reply	other threads:[~2015-08-01 10:19 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
2015-08-01 10:19           ` Dominique Martinet [this message]
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=20150801101913.GA24028@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).