fsync()-in webdav PUT

Nagy, Attila bra at fsn.hu
Fri Mar 2 10:02:13 UTC 2018

On 02/28/2018 10:41 PM, Aziz Rozyev wrote:
>> Without fsyncing file's data and metadata a client will receive a positive reply before data has reached the storage, thus leaving non-zero probability that states of two systems involved into a web transaction end up inconsistent.
> I understand why one may need consistency, but doing so with fsyncing is non-sense.
> Here is what man page says in that regard:
> fsync()  transfers  ("flushes")  all  modified  in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent
>         storage device) so that all changed information can be retrieved even after the system crashed or was rebooted.  This includes writing through or flushing a disk cache if present.  The call
>         blocks until the device reports that the transfer has completed.  It also flushes metadata information associated with the file (see stat(2)).
Could you please elaborate what do you mean by calling this a nonsense?
Also I don't understand why you cited the man page. It clearly says this 
is what ensures that when fsync return, the file will be on stable storage.

What else method do you recommend if somebody wants to get an 
acknowledgement to the HTTP PUT only after the file is safely stored?

More information about the nginx mailing list