3 ms·
The issue is that most programs do not do step 3: e.g. fsync is not called by C's stdio. Which means that the `rename` might get reordered before the `write`.
by daurnimator 11y ago
The issue is that most programs do not do step 3: e.g. fsync is not called by C's stdio.
Which means that the `rename` might get reordered before the `write`. Which means data loss. yay!
- jstimpfle 11y agoThe discussion hasn't been about stdio so far. Btw. my fflush(3) manpage does mention that fsync(2) is required to ensure data reaches the disk. Of course it's not nice that we have to drop abstractions (and portability) to go the safe way. Let's just say stdio is a bit simplistic. Btw. many file systems don't reorder write and rename for exactly this reason. But at least ext2 and btrfs seem to do it.