Subject: Re: PostgreSQL, NetBSD and NFS
To: D'Arcy J.M. Cain <darcy@druid.net>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 01/31/2003 14:07:09
[ On Friday, January 31, 2003 at 11:54:27 (-0500), D'Arcy J.M. Cain wrote: ]
> Subject: Re: PostgreSQL, NetBSD and NFS
>
> On Thursday 30 January 2003 18:32, Simon J. Gerraty wrote:
> > Is postgreSQL trying to lock a file perhaps?  Would seem a sensible thing
> > for it to be doing...
> 
> Is that a problem?  FWIW I am running statd and lockd on the NetBSD box.

NetBSD's NFS implementation only supports locking as a _server_, not a
client.

http://www.unixcircle.com/features/nfs.php

   Optional for file locking (lockd+statd):

   lockd:

   Rpc.lockd is a daemon which provides file and record-locking services
   in an NFS environment.

   FreeBSD, NetBSD and OpenBSD file locking is only supported on server
   side.

NFS server support for locking was introduced in NetBSD-1.5:

http://www.netbsd.org/Releases/formal-1.5/NetBSD-1.5.html

     * Server part of NFS locking (implemented by rpc.lockd(8)) now works.      

and as you can also see from rcp.lockd/lockd.c:

----------------------------
revision 1.5
date: 2000/06/07 14:34:40;  author: bouyer;  state: Exp;  lines: +67 -25
Implement file locking in lockd. All the stuff is done in userland, using
fhopen() and flock(). This means that if you kill lockd, all locks will
be relased (but you're supposed to kill statd at the same time, so
remote hosts will know it and re-establish the lock).
Tested against solaris 2.7 and linux 2.2.14 clients.
Shared lock are not handled efficiently, they're serialised in lockd when they
could be granted.
----------------------------


Terry Lambert has some proposed fixes to add NFS client level locking to
the FreeBSD kernel:

	http://www.freebsd.org/~terry/DIFF.LOCKS.txt
	http://www.freebsd.org/~terry/DIFF.LOCKS.MAN
	http://www.freebsd.org/~terry/DIFF.LOCKS

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>