tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: syncing a directory
On Wed, Jul 09, 2008 at 03:42:27PM -0700, Jason Thorpe wrote:
>
> 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.
Actually, we do have that: fsync_range(fd, FDISKSYNC, ...).
Andrew
Home |
Main Index |
Thread Index |
Old Index