If, on NFSv4 client 1, I:
Code:
strace flock -x ./test -c "sleep 60"
it succeeds:
Code:
flock(3, LOCK_EX) = 0
On client 2, the same line results in a block, as expected:
However, an flock() on the NFSv4 server gets the lock!
Code:
flock(3, LOCK_EX) = 0
Why is this? Shouldn't flock() syscall on the NFS server coordinate with the running nfs kernel server?
rpc.statd, lockd, (portmapper: nlockmgr, status) are all running on all clients and also the server.
I've reproduced this on 3.0 and 3.2 kernels and on Ubuntu (12.04) and SuSE (SLES11SP2) Is it expected behavior?
One workaround is to have the NFS server mount itself, then third-party apps depending on flock() still work.
I know that in the ancient past, flock() did not work over NFS, but now it ..almost does?
Does anyone get "proper" behavior with NFSv4 server and client flocks?