Re: EACCES race when opening just-created file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 25, 2016 at 11:04:32PM -0400, Noah Misch wrote:
> 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.

Mounting with vers=4.1 eliminated the unwanted behavior.  Thanks for the tip.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux