tech-kern archive

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

Re: syncing a directory



On Thu, Jul 10, 2008 at 07:47:42AM +0000, Andrew Doran wrote:
> 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, ...).

I thought while we do have an API, we do not have a reliable
implementation, because we cannot reliably flush the write cache on
many disks, especially those that are connected through inexpensive
USB->IDE adapters.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933 ext 24


Home | Main Index | Thread Index | Old Index