News for hackers. Stuff that matters.
Re:Things Unix can do atomically (2010) by gpderetta on Tuesday May 31, 2016 @05:43AM (#11805619)
That's what people would expect. But there was some drama around ext4, renames and fsync a few years ago.
Re:Things Unix can do atomically (2010) by zAy0LfpBZLC8mAC on Tuesday May 31, 2016 @08:51AM (#11806225)
You mean around truncation and rewrite?
Re:Things Unix can do atomically (2010) by gpderetta on Tuesday May 31, 2016 @09:22AM (#11806344)
It is not necessarily about truncation. IIRC the problem was that rename doesn't (didn't?) act as a full barrier on ext4 and the metadata write that updates the name from the old file to the new file can be committed to disk before the updates to the new file. This means that after a crash the new name might point to a corrupted file.

The barrier behavior wasn't explicitly mandated by POSIX, but it is an intuitive release consistency-like model which was implicitly expected by most programmers.

edit: spurious words and parens.