NFS, the Network File System from SUN Microsystems, is a system that allows files to be shared over a network. It is implemented using 4 protocols each built on-top of ONC-RPC, the Open Network Computing Remote Procedure Call protocol, also from SUN.
The four protocols are:
The basic file access protocol which allows files to be created, found, read and written. It is designed to be stateless, meaning that the only state that the server needs to store is the exposed contents of the filesystem. The server is not expected to retain any information about the state of the clients.
As well as being stateless, the NFS protocol is idempotent. This means that is a particular request arrives twice, the second will effectively be a NO-OP. This allows it to be used over an "unreliable" protocol such as UDP/IP.
The mountd protocol is used to gain initial access to a filesystem which can subsequently be accessed by NFS. The mountd protocol does expect the server to retain some state about clients, as it contains an unmount request to tell a server that the client is nolonger using a filesystem.
The Status Monitor protocol is used for monitoring the state of different nodes in a network. The particular intent is that any node can register an interest in another node and will be told in a timely fashion when that node restarts.
The Network Lock Manager protocol provides file and record locking. It relies on SM to determine when clients have restarted, and so released all of their locks, and when servers have restarted, and so need to be reminded of the current locks.
There is another protcol, the Kernel Lock Manager, or KLM that some NFS implementations use to communicate between the kernel and a user-level locking daemon. This protocol is not used by the Linux NFS implementation.
The knfsd implementation in Linux supports the NFS and NLM
protocols completely within the kernel, the NFS protocol by code in
linux/fs/nfsd and the NLM protocol by code in
linux/fs/lockd. The lockd code contains a client for
the SM protocol, but the server is provided by a user-level process
called statd. The MOUNTD protocol is served by a user-level
process called mountd. There is a system call interface to allow
mountd to communicate information about exported filesystems to
the kernel level NFS server.
There are two version of the NFS protocol that are commonly in use today, version 2 and version 3. The NFS server implementation in Linux currently only supports version 2. Unless otherwise stated, all statments about the protocols should be taken as referring the version 2.