[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mutt-dev
Subject:    Re: safe_rename() and verifying the result of link(2)
From:       Vincent Lefevre <vincent () vinc17 ! org>
Date:       2018-08-31 15:55:41
Message-ID: 20180831155541.GA30644 () cventin ! lip ! ens-lyon ! fr
[Download RAW message or body]

On 2018-08-24 18:54:16 +0200, Steffen Nurpmeso wrote:
> Oh, wait!  This was false rememberance, i referred to a message
> from Casper Dik of Oracle who wrote on 2015-12-31
> 
>   >/* Create a unique file. O_EXCL does not really work over NFS so we follow
>   > * the following trick (inspired by S.R. van den Berg):
>   > * - make a mostly unique filename and try to create it
>   > * - link the unique filename to our target
>   > * - get the link count of the target
>   > * - unlink the mostly unique filename
>   > * - if the link count was 2, then we are ok; else we've failed */
> 
>   The problem of not being able to create a file with O_EXCL was, I think,
>   fixed in NFSv3 (if not, certainly in NFSv4)
> 
>   Casper
> 
> so this was not about link but about O_EXCL.

Yes, a well-known issue.

> About a year later
> (2016-11-02) there was a pair of message in between Stèphane and
> Jörg about links via NFS, as in "IIRC there were issues with ln on
> NFS for instance." and "Could you please explain what you have in
> mind?  I would like to understand whether there really is a NFS
> problem or whether there is just a NFS bug in Linux", but nothing
> more than that.

Perhaps it could just be the one already mentioned:

  On NFS filesystems, the return code may be wrong in case the NFS server
  performs the link creation and dies before it can say so.  Use  stat(2)
  to find out if the link got created.

which, I suppose, is impossible to solve.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic