Return to BSD News archive
Newsgroups: comp.os.386bsd.questions Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!library.ucla.edu!psgrain!neon!pluto!perryh From: perryh@pluto.rain.com (Perry Hutchison) Subject: Re: NFS locking in FreeBSD 1.0e Message-ID: <CLK9Mn.5oE@pluto.rain.com> Keywords: lockf(), flock(), mh Organization: Surely you jest References: <16F6363A8S85.BORMANN@purccvm.bitnet> Date: Mon, 21 Feb 1994 06:20:46 GMT Lines: 51 In article <16F6363A8S85.BORMANN@purccvm.bitnet> BORMANN@PURCCVM.BITNET (Bill Bormann) writes: > I'm trying to bring up mh 6.8.3 on my system running FreeBSD 1.0e but > ran into a hitch compiling the routine lock.c. > > The problem is that I mount the mail spooling directory -t nfs, so in > the configuration options for mh I selected LOCKF (kernel level locking). This is the correct selection. An equivalent (and equally acceptable) alternative is to use fcntl instead of lockf if the code supports that choice. > This did not compile. When I try to select FLOCK I get an error message > indicating the FLOCK feature is not available. flock does not work over NFS anyway. > A quick peruse through the FreeBSD source code suggests that file > locking is not really needed by mh since this detail is handled by the > nfs code in the kernel. The application still has to issue the lockf() or fcntl() request. The kernel and daemons are supposed to take care of forwarding the request to the server (but see below). > My question is quite simply, do I need to worry about file locking for > nfs mounted file systems? You do need to worry about it. You are likely to lose incoming mail if * you are mounting your mail spool via NFS, and * lockf (or the equivalent fcntl option) does not work, and * the server tries to deliver a new message while mh (or any other user agent, for that matter) is updating your mailbox, for example to remove messages which you have read or it has moved elsewhere. The killer is that NFS locking _in general_ does not work properly. This is not just a FreeBSD issue: Sun invented NFS and lockd, and yet the SunOS nfs locking patch is up to something like its 12th iteration. If the folks who invented it have that much trouble you can imagine how likely it is that anyone else will get it right. I do not trust NFS locking anywhere, and especially not between different implementations (which is probably what you are doing -- I don't suppose your mailbox server is running FreeBSD). IMO your best approach is to rlogin or telnet to the server and run mh (or whatever) there; or use a .forward file to have the server forward your mail to your FreeBSD system.