News for hackers. Stuff that matters.
Re:Non-Posix File Systems by ynik on Wednesday September 09, 2020 @06:47AM (#24419612)
It doesn't require severe FS corruption. In reality "write 'foo~'" just starts an asynchronous write; it's possible for rename to happen before that async write is complete.

So in case of a system crash you might end up seeing partial data in 'foo'.

fsync() may or may not protect against that depending on what system we're talking about.

Re:Non-Posix File Systems by tomtomtom777 on Wednesday September 09, 2020 @07:26AM (#24419816)
Sure, you are still dependent on constraints to durability and atomicity of the filesystem write of the new data. But this is handled properly in most modern filesystems (ext3,ext4,zfs) by default (as data=ordered ensures data writes precede metadata writes).

The point of rename() is to prevent a version to ever exist that mixes the old and the new version, which it always does, regardless of the filesystem.