From owner-freebsd-hackers Thu Nov 11 19:41:46 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dt054n7c.san.rr.com (dt054n7c.san.rr.com [24.30.152.124]) by hub.freebsd.org (Postfix) with ESMTP id 1B52014DD2 for ; Thu, 11 Nov 1999 19:41:43 -0800 (PST) (envelope-from Doug@gorean.org) Received: from gorean.org (master [10.0.0.2]) by dt054n7c.san.rr.com (8.9.3/8.8.8) with ESMTP id TAA41356; Thu, 11 Nov 1999 19:41:05 -0800 (PST) (envelope-from Doug@gorean.org) Message-ID: <382B8C51.A80EC784@gorean.org> Date: Thu, 11 Nov 1999 19:41:05 -0800 From: Doug Barton X-Mailer: Mozilla 4.7 [en] (X11; I; FreeBSD 4.0-CURRENT-0927 i386) X-Accept-Language: en MIME-Version: 1.0 To: Conrad Minshall Cc: Alfred Perlstein , freebsd-hackers@FreeBSD.ORG Subject: Re: Serious locking problem over NFS References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Conrad Minshall wrote: > > At 4:39 PM -0800 11/11/99, Alfred Perlstein wrote: > >On Thu, 11 Nov 1999, Doug Barton wrote: > > >> The following small program illustrates an obscure problem with > >> file locking with freebsd as an NFS client. I'm aware of the problems with > > > >We currently don't support client or server locking. > > > >work is in progress, but the dolt that took the job is extremely busy > >right now. (me) Hrrrmm... well to me the weird thing is that it *does* work when both processes run on the same FreeBSD NFS client. Where it doesn't work is when the two access points to the same file are on different clients, which, unfortunately is where (and why) we need it to work. > Yup, byte range locking fcntl APIs are present but over NFS they don't work. > > So shouldn't one be able to get entire-file locking with the old-fashioned: > > open("foo.lockfile", O_CREAT | O_EXCL, 0644) > > You would think so, but my experience is that reliably protects critical > sections only when using NFS Version 3. Not V2. Read about EXCLUSIVE in > the CREATE procedure in RFC 1813 for another level of detail. Ok, thanks for the tip. We are using V3, in fact I'm forcing it. I considered using O_EXCL but I'm not 100% sure about some of the implications for the particular application. I'll give it a try though, thanks for the tip, and the reference. Doug -- "Stop it, I'm gettin' misty." - Mel Gibson as Porter, "Payback" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message