All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominique Martinet <dominique.martinet@cea.fr>
To: <linux-fsdevel@vger.kernel.org>
Cc: David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Aurelien CEDEYN <aurelien.cedeyn@cea.fr>
Subject: Re: Race condition introduced in 4bf46a27 VFS: Impose ordering on accesses of d_inode and d_flags
Date: Fri, 31 Jul 2015 14:28:10 +0200	[thread overview]
Message-ID: <20150731122810.GA17247@u-michard> (raw)
In-Reply-To: <20150730115045.GA24790@u-michard>

Dominique Martinet wrote on Thu, Jul 30, 2015 at 01:50:45PM +0200:
> > My guess is that I'm just seeing a race condition that already existed
> > but the barriers make it easier to reproduce it.
> > This commit came with 2b0143b5c9 "VFS: normal filesystems (and lustre):
> > d_inode() annotations" which made 9P access d_inode through the helper,
> > which could have helped with ordering, but I'm still hitting the bug
> > "easily" with that commit.
> 
> Still looking for ideas to help diagnose further...

Slowly progressing, through carefully placed systemtap probes I got down
to this check in link_path_walk in fs/namei.c:

	        if (!d_can_lookup(nd->path.dentry)) {
			err = -ENOTDIR;
                        break;
		}

going all the way to path_init -> path_openat -> do_filp_open -> user.


Could then add a break in gdb on the err = -ENOTDIR instruction:
#0  link_path_walk (name=0xffff88042b47b027 "f", nd=0xffff88042c19eff8)
    at fs/namei.c:1845
#1  0xffffffff81209209 in path_init (dfd=<optimized out>, name=<optimized out>, 
    flags=64, nd=0x1 <irq_stack_union+1>) at fs/namei.c:1952
#2  0xffffffff8120bd42 in path_openat (dfd=<optimized out>, pathname=0xffff88042b47b000, 
    nd=0xffff88042a9cfe28, op=0xffff88042a9cff1c, flags=65) at fs/namei.c:3230
#3  0xffffffff8120d8e9 in do_filp_open (dfd=-100, pathname=0xffff88042b47b000, 
    op=0xffff88042a9cff1c) at fs/namei.c:3280
#4  0xffffffff811fb2d7 in do_sys_open (dfd=683933728, filename=<optimized out>, 
    flags=<optimized out>, mode=<optimized out>) at fs/open.c:1010
#5  0xffffffff811fb3fe in SYSC_open (mode=<optimized out>, flags=<optimized out>, 
    filename=<optimized out>) at fs/open.c:1028
#6  SyS_open (filename=<optimized out>, flags=<optimized out>, mode=<optimized out>)
    at fs/open.c:1023

Unfortunately can't seem to get much more out of it, nd->path is borked
by the time gdb gets here:
(gdb) p nd->path
$1 = {mnt = 0x6f666e69000064, dentry = 0x7379656b64616564}

Looking at other values around:
 - next->dentry seems to be the last dir (need to rename directories in
 my test to check, bad idea to name them all the same)
 - name is the name of the file that does exist

It's easy enough to reproduce for me with the script I got, so happy to
give more infos if someone has an idea...

-- 
Dominique


  reply	other threads:[~2015-07-31 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 15:45 Race condition introduced in 4bf46a27 VFS: Impose ordering on accesses of d_inode and d_flags Dominique Martinet
2015-07-23  9:43 ` Dominique Martinet
2015-07-30 11:50 ` Dominique Martinet
2015-07-31 12:28   ` Dominique Martinet [this message]
2015-07-31 15:28     ` Dominique Martinet

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=20150731122810.GA17247@u-michard \
    --to=dominique.martinet@cea.fr \
    --cc=aurelien.cedeyn@cea.fr \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.