Posted Mar 14, 2009 5:33 UTC (Sat) by flewellyn (subscriber, #5047)
[Link]
Hmm...in that case, definitely fsync after rename.
Where the the correctness go?
Posted Mar 15, 2009 1:43 UTC (Sun) by droundy (subscriber, #4559)
[Link]
Sorry, that's wrong. fsync before rename.
Where the the correctness go?
Posted Mar 14, 2009 6:21 UTC (Sat) by bojan (subscriber, #14302)
[Link]
Please read the manual page for close(). Just because you closed the file doesn't mean your data is on disk.
As for rename, your file gets renamed _atomically_ just fine. However, if you don't _commit_ your writes (make the changes durable, call fsync), the renamed file will have zero size.
This is not a file system problem, but an application problem.