Sun Network File System
Sun Network File System
• Client integration •
The NFS client module plays the role described for the client module
in our architectural model, supplying an interface suitable for use by
conventional application programs. But unlike our model client module, it
emulates the semantics of the standard UNIX file system primitives
precisely and is integrated with the UNIX kernel. It is integrated with the
kernel and not supplied as a library for loading into client processes so that:
• user programs can access files via UNIX system calls without
recompilation or reloading;
• a single client module serves all of the user-level processes, with a
shared cache of recently used blocks (described below);
• the encryption key used to authenticate user IDs passed to the
server (see below) can be retained in the kernel, preventing impersonation
by user-level clients.
The NFS client module cooperates with the virtual file system in each
client machine. It operates in a similar manner to the conventional UNIX file
system, transferring blocks of files to and from the server and caching the
blocks in the local memory whenever possible. It shares the same buffer
cache that is used by the local input-output system.
• Mount service
• The mounting of subtrees of remote filesystems by clients is
supported by a separate mount service process that runs at user level on
each NFS server computer. On each server, there is a file with a well-known
name (/etc/exports) containing the names of local filesystems that are
available for remote mounting. An access list is associated with each
filesystem name indicating which hosts are permitted to mount the
filesystem. Clients use a modified version of the UNIX mount command to
request mounting of a remote filesystem, specifying the remote host’s
name, the pathname of a directory in the remote filesystem and the local
name with which it is to be mounted. The remote directory may be any
subtree of the required remote filesystem, enabling clients to mount any part
of the remote filesystem. The modified mount command communicates
with the mount service process on the remote host using a mount protocol.
This is an RPC protocol and includes an operation that takes a directory
pathname and returns the file handle of the specified directory if the client
has access permission for the relevant filesystem. The location (IP address
and port number) of the server and the file handle for the remote directory
are passed on to the VFS layer and the NFS client.
• Automounter
• The automounter was added to the UNIX implementation of NFS in
order to mount a remote directory dynamically whenever an ‘empty’ mount
point is referenced by a client. The original implementation of the
automounter ran as a user level UNIX process in each client computer. Later
versions (called autofs) were implemented in the kernel for Solaris and
Linux. We describe the original version here.
• Server caching
• Caching in both the client and the server computer are
indispensable features of NFS implementations in order to achieve
adequate performance. In conventional UNIX systems, file pages,
directories and file attributes that have been read from disk are retained in a
main memory buffer cache until the buffer space is required for other pages.
If a process then issues a read or a write request for a page that is already in
the cache, it can be satisfied without another disk access. Read-ahead
anticipates read accesses and fetches the pages following those that have
most recently been read, and delayed-write optimizes writes: when a page
has been altered (by a write request), its new contents are written to disk
only when the buffer page is required for another page. To guard against loss
of data in a system crash, the UNIX sync operation flushes altered pages to
disk every 30 seconds. These caching techniques work in a conventional
UNIX environment because all read and write requests issued by user level
processes pass through a single cache that is implemented in the UNIX
kernel space. The cache is always kept up-to-date, and file accesses cannot
bypass the cache.
• Client caching
• The NFS client module caches the results of read, write, getattr,
lookup and readdir operations in order to reduce the number of requests
transmitted to servers. Client caching introduces the potential for different
versions of files or portions of files to exist in different client nodes, because
writes by a client do not result in the immediate updating of cached copies
of the same file in other clients. Instead, clients are responsible for polling
the server to check the currency of the cached data that they hold.