Subject: Re: Simultaneous builds
To: Amitai Schlair <schmonz@schmonz.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-pkg
Date: 01/11/2002 18:34:12
On Fri, Jan 11, 2002 at 11:05:28AM -0500, Amitai Schlair wrote:
> "Alistair Crooks" <agc@pkgsrc.org> wrote:
> 
> > PR 7590 is a good start, but it relies on shlock, which doesn't do too
> > well on NFS-mounted partitions.
> >
> > I'm also not too sure of its availability on other platforms.
> 
> I don't use NFS. To lock reliably over NFS, is it sufficient to use PID
> + hostname? I searched Google for "reliable NFS locking" and found this
> in a Linux man page:
> 
> "The solution for performing atomic file locking using a lockfile is to
> create a unique file on the same fs (e.g., incorporating hostname and
> pid), use link(2) to make a link to the lockfile and use stat(2) on the
> unique file to check if its link count has increased to 2."

I think this is because of broken linux NFS client, for which file
creation isn't atomic (it can delay file creation on the server,
instead of checking immediatly if the file already exists), making
open(O_CREAT|O_EXCL) broken.
On NetBSD shlock should be fine.

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--