Does the order/direction of fsync matter?
Question
Let's say I write out some files and directories to a usb thumb drive.
/media/drive1/newFolder1/
/media/drive1/newFolder1/newfile1
/media/drive1/newFolder1/newfile2
I've created a folder, newFolder1
and two files newfile1
and newfile2
.
Syncing does not happen automatically, so I'd need to fsync
the changes.
So I need to call fsync
on newFolder1
, newfile1
and newfile2
.
Question is, does it matter the order in which I do this?
Solution
It won't matter for content, but last-modified-times could be wrong if the directory is not synced after the files.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow