Bug 30449

Summary: NFS lock manager grants multiple locks on same file
Product: Base System Reporter: Andrew Lentvorski <buzmeg>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Andrew Lentvorski 2001-09-09 02:30:01 UTC
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.
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2003-07-13 07:00:33 UTC
State Changed
From-To: open->closed

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.