News for hackers. Stuff that matters.
Re:Files Are Hard by jorangreef on Sunday December 13, 2015 @07:20AM (#10726164)
"That's not guaranteed to work in the face of crashes. The problem is that the directory update could get flushed to disk before the file data."

No, it can work, provided that the temporary file is fsynced before being renamed, the parent directory is fsynced after renaming the file, and that the application only considers the rename to have taken place after the parent directory is fsynced (not after the rename call itself).

Re:Files Are Hard by lisper on Sunday December 13, 2015 @12:09PM (#10726920)
FSYNC is not enough. You also have to make sure that NCQ is disabled:

https://en.wikipedia.org/wiki/Native_Command_Queuing

Re:Files Are Hard by chemodax on Sunday December 13, 2015 @02:08PM (#10727427)
OS can use Force Unit Access flag with NCQ to control disk buffering: https://en.wikipedia.org/wiki/Disk_buffer#Force_Unit_Access_...