Mats Lofkvist <mal(at)algonet(dot)se> writes:
> [ mdsync is ugly and not completely reliable ]
Yup, it is. Do you have a better solution?
fsync is not the answer, since the checkpoint process has no way to know
what files may have been touched since the last checkpoint ... and even
if it could find that out, a string of retail fsync calls would kill
performance, cf. Curtis Faith's complaint.
In practice I am not sure there is a problem. The local man page for
sync() says
The writing, although scheduled, is not necessarily complete upon
return from sync.
Now if "scheduled" means "will occur before any subsequently-commanded
write occurs" then we're fine. I don't know if that's true though ...
regards, tom lane