From nobody@FreeBSD.org  Sat Sep  8 18:29:10 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 6820737B403
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  8 Sep 2001 18:29:10 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f891TAU84505;
	Sat, 8 Sep 2001 18:29:10 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200109090129.f891TAU84505@freefall.freebsd.org>
Date: Sat, 8 Sep 2001 18:29:10 -0700 (PDT)
From: Andrew Lentvorski <buzmeg@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NFS lock manager grants multiple locks on same file
X-Send-Pr-Version: www-1.0

>Number:         30449
>Category:       bin
>Synopsis:       NFS lock manager grants multiple locks on same file
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 08 18:30:01 PDT 2001
>Closed-Date:    Sat Jul 12 23:01:03 PDT 2003
>Last-Modified:  Sat Jul 12 23:01:03 PDT 2003
>Originator:     Andrew Lentvorski
>Release:        4.4-20010827-RC2
>Organization:
>Environment:
FreeBSD daffy.buzmeg.com 4.4-20010827-RC2 FreeBSD 4.4-20010827-RC2 #0: Mon Aug 27 20:53:32 PDT 2001     murray@ref4:/usr/src/sys/compile/GENERIC  i386
>Description:
Multiple requests to exclusively lock a file over NFS will succeed.  

I stumbled across this behavior when using a Solaris box to use fcntl
to do a SETLKW (sample program is available if desired).  The use of
SETLKW bypasses the normal cacheing of lock requests when initiated by
the same client.  Thus, you have to set up the following scenario:

Client 1 ----------------------
                              V
                           NFS Server
                              ^
Client 2 ----------------------

In order to test even the basic SETLK behavior since there is no longer
any cacheing going on at the client level.

Once you bypass the local cacheing, FreeBSD will hand out lock and
unlock requests multiple times on the same file.

I would dearly love to have the developer of the rpc.lockd code contact me
so that I can help write (or at least carry out) regression tests for
the NFS locking system.
>How-To-Repeat:
See above, or contact me for a sample program.
>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 23:00:33 PDT 2003 
State-Changed-Why:  
This is the documented behaviour of rpc.lockd on 4.x and 
earlier.  5.x has a complete implementation that should not 
suffer from this problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30449 
>Unformatted:
