> But that still leaves the question how I can tell that > the work I did on the new file is on disk by the time > directory with the renamed files is on disk? Dirty > buffers are not written out in the same order they got > dirty, right? Given a continuous amount of disk I/O > could keep dirty blocks away from disk forever?
If you use a journalling fs and you use fsync() you can control the sequencing of events on your files. You can also fsync a directory on Linux to ensure its contents are on disk (not portable but logical) The guarantees a journal gives you depend on the journalling mode ranging from "who knows" through "disk will be valid" to "data hits disk in strict order". See the ext3 documentation
