LWN.net Logo

Quotes of the week

Quotes of the week

Posted Mar 26, 2009 17:24 UTC (Thu) by iabervon (subscriber, #722)
In reply to: Quotes of the week by nix
Parent article: Quotes of the week

If you look at the POSIX standard, it doesn't actually imply that fsync() before rename() matters at all. There's not really even a suggestion that the stable storage representation of the directory gets atomic changes, or, in particular, that it won't go through a state where the directory would appear with something different from either the original inode or the replacement inode. fsync() is important if you want to be sure that there is an inode that contains your new data, but there's no particular reason (aside from filesystem internals) to think that your filename will point to it.

The standards don't talk about system crashes, so anything that applications do in order to cope with system crashes is inherently ritual. (The rename() trick, ignoring fsync(), is defined to be helpful against application crashes and poorly-timed SIGKILL.)


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds