tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

syncing a directory

Is there a way (other than sync()) to make sure a rename() has made it to non-volatile storage?

Dovecot wants to be sure that having moved a file from (maildir) tmp/ to new/ is going to survive a crash before reporting success to the client. The (possible Linuxish) way it attempts to do this is to open the directory (O_RDONLY, of course) and then fsync()ing the file handle. Set aside the question whether this does anything useful on Linux, NetBSD objects, presumably because fsync() on a read-only descriptor doesn't make sense.

I know well that metadata writes used to be synchronous anyway, but they are no more in the age of soft updates.

It looks reasonable what dovecot demands, and it seems reasonable NetBSD objects to the specific way it tries doing that. But what would be the correct way of doing it? What if the files in question reside on NFS?

Home | Main Index | Thread Index | Old Index