[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: ksycoca corruption over NFS (Re: Bug#15720: Mounted home dirscause heavy NFS load)
From:       Waldo Bastian <bastian () kde ! org>
Date:       2000-11-23 23:36:22
[Download RAW message or body]

On Thursday, November 23, 2000 00:26, Rik Hemsley wrote:
> On Wed, 22 Nov 2000 23:56:55 -0800
>
> Alex Zepeda <jazepeda@pacbell.net> wrote:
> > On Wed, Nov 22, 2000 at 09:12:23PM +0000, David Faure wrote:
> > > We don't use mmap for writing, we use QDataStream over a QFile.
> > >
> > > You're right. The problem has nothing to do with mmap, it's when
> > > writing that some data became corrupted.
> >
> > Quickly, the most reliable NFS implementations are usually v2 over UDP.
> > Anything else often runs into problems, especially in a heterogeneous
> > environment.
> >
> > Also perhaps it would be safer to write to a separate file, and then move
> > it, instead of appending to it.
>
> Right. That's the only way to be safe.
>
> * Open a temporary file for writing.
> * Check the number of bytes returned from each write() call.
> * Call fsync() and checking the retval.
> * Call close() and checking the retval.
> * Move the file to the 'real' name.
>
> You need to check the retval of close because some NFS implementations
> get fsync() wrong. Thankfully you can use the retval of close() to check
> you fsync()ed ok.

This is what KSaveFile does. KSaveFile is used by ksycoca.

Cheers,
Waldo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic