Subject: Re: corrupt METALOG files on SMP machines with UNPRIVED build
To: Luke Mewburn" , "Ben Harris <>
From: Christian Limpach <chris@Pin.LU>
List: tech-toolchain
Date: 05/21/2002 16:43:42
Luke Mewburn wrote:
> Does reiserfs on Linux correctly support flock(2) with LOCK_EX ?
> install(1) updates the METALOG like this:

Ben Harris wrote:
> FWIW, I've seem the same on Linux with ext2fs.  I'm inclined to suspect
> Linux's flock() implementation is subtly different from the NetBSD one.

I couldn't find much locking related in the reiserfs code and I've verified
that flock(2) does do basic locking...  Also comments in the Linux source
for flock(2) mention that race conditions have been removed, FWIW...

I found this in man fflush on Linux:
       Note that fflush() only flushes the user space buffers provided by
       C  library.   To ensure that the data is physically stored on disk
       kernel buffers must be flushed too, e.g. with sync(2) or fsync(2).

Could this be the cause of the problem?  I'm going to try adding a call to
fsync(2) after fflush and see if that helps.