RHEL5: Does NLM provide deadlock detection of NFS file locking

Solution Verified - Updated -

Issue

  • How does NLM protocol's deadlock detection work?
  • Does the NLM protocol implementation on Linux provide deadlock detection? Specifically:
On server1: Process A has fileA locked and is waiting to lock fileB and will not release fileA until fileB is locked
On server2: Process B has fileB locked and is waiting to lock fileA and will not release fileB until fileA is locked
  • We are expecting NFS to provide resource deadlock detection between the two servers. Can you please confirm if NFS does or does not provide this functionality?
  • Basically, when a file is being accessed by two or more sessions for write, the system (lock daemon) should return “Resource deadlock avoided” to the other sessions that are trying to get a write lock on the file. The other sessions continue to try until the lock is released. Without the lock feature, you get what is known as a “deadly embrace”, you get no error, no warning, no nothing, your application or running threads simply lock up and spin. This can have unpredictable results.
  • The NFS mount point options are as follows:
nfsserver.somedomain.net:/vol/vol1/foo on /export type nfs (rw,nosuid,remount,bg,hard,rsize=32768,wsize=32768,nfsvers=3,actimeo=0,nointr,timeo=600,tcp,addr=10.1.2.77)
  • We have checked and nfslock is on, lockd is running
# chkconfig --list | grep nfs
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
sisips.nfsd     0:off   1:off   2:off   3:on    4:off   5:on    6:off
# ps -ef | grep lockd
root       286   279  0 Dec13 ?        00:00:00 [kblockd/0]
root       287   279  0 Dec13 ?        00:00:00 [kblockd/1]
root       288   279  0 Dec13 ?        00:00:00 [kblockd/2]
root       289   279  0 Dec13 ?        00:00:00 [kblockd/3]
root      3700     1  0 Dec13 ?        00:00:00 [lockd]
root     12398 12249  0 11:08 pts/4    00:00:00 grep lockd
# ps -ef | grep rpc
rpc       3272     1  0 Dec13 ?        00:00:00 portmap
root      3309   279  0 Dec13 ?        00:00:01 [rpciod/0]
root      3310   279  0 Dec13 ?        00:00:00 [rpciod/1]
root      3311   279  0 Dec13 ?        00:00:00 [rpciod/2]
root      3312   279  0 Dec13 ?        00:00:35 [rpciod/3]
rpcuser   3321     1  0 Dec13 ?        00:00:00 rpc.statd
root      3366     1  0 Dec13 ?        00:00:00 rpc.idmapd -vvv
# ps -ef | grep portmap
rpc       3272     1  0 Dec13 ?        00:00:00 portmap

Environment

  • Red Hat Enterprise Linux 5
  • NFSv3 using locking via NLM
  • NetApp NFS Server

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In