News for hackers. Stuff that matters.
Re:Durability: Linux File APIs by nh2 on Tuesday October 13, 2020 @05:08AM (#24763669)
Programs that care about durability should use `openat(int dirfd, char *pathname, ...)` to get an FD on the file after after getting an FD on the parent dir anyway, instead of using `/path/to/dir/file` style paths, because otherwise there's always the chance that something in hierarchy was moved away or mounted over.

In that case, you always have a handle on the directory.

Opening the dir for fsyncing separately after having written the file is similar to doing close()+re-open()+fsync() on a file, which does not provide as strong guarantees as direct open()+fsync(): https://stackoverflow.com/questions/37288453/calling-fsync2-...

There are no comments on this comment yet.