From kde-core-devel Thu Nov 23 23:36:22 2000 From: Waldo Bastian Date: Thu, 23 Nov 2000 23:36:22 +0000 To: kde-core-devel Subject: Re: ksycoca corruption over NFS (Re: Bug#15720: Mounted home dirscause heavy NFS load) X-MARC-Message: https://marc.info/?l=kde-core-devel&m=97502254108121 On Thursday, November 23, 2000 00:26, Rik Hemsley wrote: > On Wed, 22 Nov 2000 23:56:55 -0800 > > Alex Zepeda 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