Earlier quoted context omitted.
> - "Unit" files commit when closed properly (this does not include a program exit without close), and then replace the old version of the file. The file system should guarantee that, after a crash, you have either the old version or the new complete version. Incidentally, this is the way it currently is. From rename(2) : If "newpath already exists, it will be atomically replaced". Just don't forget that "replacing"…
rename(2) atomic replacement only means atomic with respect to processes running on the system at the same time: anyone looking up the newpath will get either the old file or the new file (and won't, for example, see a spurious ENOENT). It doesn't mean atomic with respect to a system crash. The easiest way to get asynchronous fsync(2) is to do the fsync(2) in a different thread.
However you would need to create a new thread for each simultaneous asynchronous fsync to get the benefits of asynchronicity.