linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: EACCES race when opening just-created file
Date: Mon, 25 Jul 2016 23:04:32 -0400	[thread overview]
Message-ID: <20160726030432.GA2215551@tornado.leadboat.com> (raw)
In-Reply-To: <1469307057.2514.6.camel@redhat.com>

On Sat, Jul 23, 2016 at 04:50:57PM -0400, Jeff Layton wrote:
> On Sat, 2016-07-23 at 16:12 -0400, Noah Misch wrote:
> > With the Linux kernel as both NFS client and server, I'm seeing a race
> > condition where open() can return EACCES for a just-created file.  Is this
> > expected behavior?  POSIX implicitly allows it, but I failed to locate any
> > discussion of it.  I have attached a test program; here, it witnesses the race
> > for roughly a dozen of the 4096 files it creates (different files each time).

> This is due to a limitation of NFSv3 and NFSv4.0. When you do an
> exclusive create, the atime and mtime get set to a particular set of
> values (the verifier), and the client is expected to override those
> values with a follow-on SETATTR call once it gets those values back.
> This is to prevent problems during certain server reboot scenarios. 
> 
> The NFS server also sets the mode to 0000 during this time (since the
> client can't even set the mode during the operation).

Interesting; that fully explains it.  Thanks.

> NFSv4.1 is less subject to this problem. You may want to try using that
> and see if it's any better.

I will look into that.

  reply	other threads:[~2016-07-26  3:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23 20:12 EACCES race when opening just-created file Noah Misch
2016-07-23 20:50 ` Jeff Layton
2016-07-26  3:04   ` Noah Misch [this message]
2016-09-02  3:59     ` Noah Misch

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=20160726030432.GA2215551@tornado.leadboat.com \
    --to=noah@leadboat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.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).