The Network File System (NFS) is a client/server protocol that allows a directory hierarchy located on an NFS server to be mounted on one or more NFS clients. Once this is done, the NFS client can transparently access the NFS server files. The NFS server-side daemons arbitrate simultaneous access by multiple clients. Entire files, or individual regions of files, can be locked by a client to avoid race conditions caused by concurrent modification or by viewing partial updates.
The nfslock daemon provides the ability to lock regions of NFS files. It is run only on an NFS server; NFS clients do not need to run this service. This service runs the daemon /sbin/rpc.lockd.
Service Control
How to immediately start or stop this service:
# service nfslock start Starting NFS statd: [ OK ]
# service nfslock stop Stopping NFS locking: [ OK ] Stopping NFS statd: [ OK ]
How to control the service on subsequent boots:
# chkconfig --list nfslock nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Other options:
# service nfslock Usage: /etc/init.d/nfslock {start|stop|status|restart|reload|force-reload|probe|condrestart|try-restart|condstop}
The probe function is special to this service. The command:
# service nfslock probe
will return the string “start” if the NFS lock daemon is not running or “restart” if it is currently running.
Configuration
Package name for this service is – nfs-utils. The service may be configured by editing the /etc/sysconfig/nfs file. Below is a sample /etc/sysconfig/nfs file.
# cat /etc/sysconfig/nfs # # Define which protocol versions mountd # will advertise. The values are "no" or "yes" # with yes being the default #MOUNTD_NFS_V2="no" #MOUNTD_NFS_V3="no" # # # Path to remote quota server. See rquotad(8) #RQUOTAD="/usr/sbin/rpc.rquotad" # Port rquotad should listen on. #RQUOTAD_PORT=875 # Optinal options passed to rquotad #RPCRQUOTADOPTS="" # # # Optional arguments passed to in-kernel lockd #LOCKDARG= # TCP port rpc.lockd should listen on. #LOCKD_TCPPORT=32803 # UDP port rpc.lockd should listen on. #LOCKD_UDPPORT=32769 # # # Optional arguments passed to rpc.nfsd. See rpc.nfsd(8) # Turn off v2 and v3 protocol support #RPCNFSDARGS="-N 2 -N 3" # Turn off v4 protocol support #RPCNFSDARGS="-N 4" # Number of nfs server processes to be started. # The default is 8. #RPCNFSDCOUNT=8 # Stop the nfsd module from being pre-loaded #NFSD_MODULE="noload" # Set V4 and NLM grace periods in seconds # # Warning, NFSD_V4_GRACE should not be less than # NFSD_V4_LEASE was on the previous boot. # # To make NFSD_V4_GRACE shorter, with active v4 clients, # first make NFSD_V4_LEASE shorter, then restart server. # This will make the clients aware of the new value. # Then NFSD_V4_GRACE can be decreased with another restart. # # When there are no active clients, changing these values # can be done in a single server restart. # #NFSD_V4_GRACE=90 #NFSD_V4_LEASE=90 #NLM_GRACE_PERIOD=90 # # # # Optional arguments passed to rpc.mountd. See rpc.mountd(8) #RPCMOUNTDOPTS="" # Port rpc.mountd should listen on. #MOUNTD_PORT=892 # # # Optional arguments passed to rpc.statd. See rpc.statd(8) #STATDARG="" # Port rpc.statd should listen on. #STATD_PORT=662 # Outgoing port statd should used. The default is port # is random #STATD_OUTGOING_PORT=2020 # Specify callout program #STATD_HA_CALLOUT="/usr/local/bin/foo" # # # Optional arguments passed to rpc.idmapd. See rpc.idmapd(8) #RPCIDMAPDARGS="" # # Set to turn on Secure NFS mounts. #SECURE_NFS="yes" # Optional arguments passed to rpc.gssd. See rpc.gssd(8) #RPCGSSDARGS="" # Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8) #RPCSVCGSSDARGS="" # # To enable RDMA support on the server by setting this to # the port the server should listen on #RDMA_PORT=20049