Subject: Re: corrupt METALOG files on SMP machines with UNPRIVED build
To: Christian Limpach <chris@Pin.LU>
From: Luke Mewburn <lukem@wasabisystems.com>
List: tech-toolchain
Date: 05/21/2002 23:36:27
On Tue, May 21, 2002 at 03:25:07PM +0200, Christian Limpach wrote:
  | Hi!
  | 
  | I've noticed on several occasions now that an UNPRIVED build on a SMP
  | machine will fail because the METALOG file gets messed up when two instances
  | of install update it at the same time.  The corrupt lines will look like
  | this:
  | ./devel/netbsd/build/current-next6./devel/netbsd/build/current-next68k/root/
  | usr/include/sys/ptrace.h type=file mode=0444
  |  uname=root gname=wheel time=1021321141.0
  | [...  several lines which are ok...]
  | 8k/root/usr/include/sys/protosw.h type=file mode=044
  | 4 uname=root gname=wheel time=985202549.0
  | 
  | This is with -j 3 on Linux.  The filesystem is reiserfs.  Has anybody seen
  | this with NetBSD?

No.

Does reiserfs on Linux correctly support flock(2) with LOCK_EX ?
install(1) updates the METALOG like this:

	flock(fileno(metafp), LOCK_EX);
	// ...
	fprintf(metafp, "....");
	// ...
	fflush(metafp);
	flock(fileno(metafp), LOCK_UN);

That should work, although flock sets advisory and not mandatory locks,
but I can't see how that's a problem.

Luke.

-- 
Luke Mewburn  <lukem@wasabisystems.com>  http://www.wasabisystems.com
Luke Mewburn     <lukem@netbsd.org>      http://www.netbsd.org
Wasabi Systems - NetBSD hackers for hire
NetBSD - the world's most portable UNIX-like operating system