Does fsync() commits rename() effects on a given file ?



Hi folks,

I can't find a clear answer to the following question: how to ensure that a rename() operation has been committed (wrt "synchronized I/O file integrity completion") ?

Is a fsync() to the renamed file sufficient ? Or is there a need to open the parent directory (with O_DIRECTORY, and O_RDWR ?) and fsync() it too ?

The fsync() function states:

http://pubs.opengroup.org/onlinepubs/009695399/functions/fsync.html

"If _POSIX_SYNCHRONIZED_IO is defined, the fsync() function shall force all currently queued I/O operations associated with the file indicated by file descriptor fildes to the synchronized I/O completion state. All I/O operations shall be completed as defined for synchronized I/O file integrity completion."

Assuming that _POSIX_SYNCHRONIZED_IO is defined, does it seems that the associated meta (the filename) is supposed to be sync'ed, too ?

Thanks in advance for any clue!
.