Atomicity vs durability
Posted Mar 15, 2009 11:02 UTC (Sun) by man_ls
In reply to: Atomicity vs durability
Parent article: Ts'o: Delayed allocation and the zero-length file problem
No, you are just blurring the issue; transactionality does not work that way. I think the interpretation of alexl is correct here. It does not matters if the contents of the file are still cached; other processes can see either the old contents or the new contents, but not both and not a broken file. The rename cannot be atomic if the name points to e.g. an empty file; not only the filename must be valid but the contents of the file as well, up to the point when the rename is done. It is no good if the file appears as it was before the atomic operation was issued (e.g. empty).
With fsync you make the contents persistent i.e. durable, but the operation should be atomic even without the fsync.
to post comments)