http://stackoverflow.com/questions/3764822/how-to-durably-rename-a-file-in-posix
So, you need to open directory where file exists (O_DIRECOTRY), and fsync() it's FD after rename. If not, application may think that rename is durable, but on accidental reboot, old file may appear.