tech-kern archive

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

Re: syncing a directory



Edgar Fuß wrote:
Given some combination of filesystem, disk interface et al., there is a certain level of confidence to be achieved by fsync() that, after modifying a bunch of bytes in a specific file, those bytes are to be found in the modified state after a crash. So, given the same combination of filesystem etc., is there a method to obtain a comparable level of confidence, that, after moving a bunch of files to a specific directory, those files are still to be found where they have been moved to after a crash? Other than fsync()ing each of those files, I mean.
Sorry for this late arrival, but there is something I do not quite understand there: if dovecot is moving file from one directory to another, this requires write permission. So question is: - why open() the directory read only to fsyn() it? From my PoV, there is no point in fsync()ing an fd which is opened read only, as you can not modify it anyway. - if the copy/move operation went through rename() (thus, no fd was used), IMHO, the directory should be opened RW to fsync() it.

In case the move operation implied some modifications to the file, you should fsync() them separately. I am not sure that fsyncing a directory will also flush file caches for all inodes found under it.

Feel free to correct me :)

Cheers,

--
Jean-Yves Migeon
jean-yves.migeon%espci.fr@localhost




Home | Main Index | Thread Index | Old Index