Linux Enterprise Cluster: Build a Highly Available Cluster with Commodity Hardware and Free Software

The NFS was originally conceived and built to manage distributed access to a single data storage device, with separate programs added to provide a cooperative lock arbitration method. Because the filesystem and its locking method were implemented separately, the original NFS developers felt that they were providing a generic means of network lock arbitration that could be used in conjunction with any network file system. However, the network lock manager (NLM), as it became known, has only been widely used as a lock arbitration method by NFSv3 servers and NFS version 3 clients. The NFSv4 protocol does not use a separate daemon or protocol for locking, but many of the concepts are the same, so we'll introduce NFS locking by discussing the NFSv3 NLM.

The NLM consists of two daemons called statd and lockd. Both daemons are supposed to be running all the time on the NFS server and on all NFS clients to ensure that everyone agrees upon what is locked and which programs or processes own the locks. The statd daemon running on both the client and the server keeps a list of the hosts that are currently holding or granting locks (NFS clients, if the machine is acting as an NFS server, and NFS servers, if the machine is an NFS client[5]). The lockd daemon on the NFS client is in charge of making a lock request over the network by talking to the lockd daemon running on the NFS server.

Let's examine these two daemons more closely.

statd

Note 

statd or rpc.statd is sometimes described as an implementation of a network status monitor (NSM).

lockd

[5]Actually, it always keeps a list of both if the machine is both an NFS client and an NFS server.

[6]The lockd daemon actually runs inside the kernel as a kernel thread on Linux and is called klockd, but for our purposes, we'll talk about it as if it were outside the kernel.

[7]At least this is true for Posix fcntl locks in NFS version 3.

Категории