tech-kern archive

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

Re: syncing a directory




On Jul 9, 2008, at 9:40 AM, Edgar Fuß wrote:

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's not in non-volatile storage unless you also tell the disk to flush its cache. NetBSD does not currently have a file descriptor- based API to do that.



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?

-- thorpej



Home | Main Index | Thread Index | Old Index