2 ms·
I don't see why you would have to fsync the "parent of the directory", too. That may not be explicitly specified, but it works just this way: Everything is a f
by jstimpfle 11y ago
I don't see why you would have to fsync the "parent of the directory", too. That may not be explicitly specified, but it works just this way:
Everything is a file ("object"), whether it's a standard file, or a directory. If you create a new file, you want two things synced: the contents of the file, and the linking of the file (that is the pointer from the directory in which you created the file, to the file object). If you don't sync the link you may not be able to find the file again, even though it was synced to the disk just fine. (It's just how git works btw.)
The link to the file is part of the directory object's contents. That's why the directory needs to be synced.
There is no need to sync the "parent of the directory" because that was never modified.