NFSv4 and file locking

Leon Meßner l.messner at
Sat Jan 14 01:25:36 UTC 2012

On Thu, Jan 12, 2012 at 05:37:57PM +0100, Leon Meßner wrote:
> Hi,
> Does anyone know what you have to do to get locking working under NFSv4?
> I tried the following:
> # mount_nfs -o nfsv4,sec=sys ip.nfsv4:/nfstest /mnt/test
> # mount | grep ip.nfsv4
> ip.nfsv4:/nfstest on /mnt/test (newnfs)
> # kldstat | grep nfs
> 6    2 0xffffffff8103f000 1015f    nfscommon.ko
> 9    1 0xffffffff81054000 3008f    nfscl.ko
> # cd /mnt/test
> # lockf testlockfile ls
> lockf: cannot open testlockfile: Operation not supported

Looks like lockf is the wrong tool for this job. I tried the NFSv4 lock
testing suite from [1] and this worked flawlessly. I don't know if this
test actually does what it claims to do but as i couldn't find any
freebsd specific testing tool this will probably suffice.


[1] (see locks

More information about the freebsd-questions mailing list