1 .\" Copyright (c) 2009 Rick Macklem, University of Guelph
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd NFS Version 4 Protocol
34 experimental client and server with NFSv4 support
36 The experimental nfs client and server provides support for the
39 .%T "Network File System (NFS) Version 4 Protocol \\*(tNRFC\\*(sP 3530" .
40 The protocol is somewhat similar to NFS Version 3, but differs in significant
42 It uses a single Compound RPC that concatenates operations to-gether.
43 Each of these operations are similar to the RPCs of NFS Version 3.
44 The operations in the compound are performed in order, until one of
45 them fails (returns an error) and then the RPC terminates at that point.
48 integrated locking support, which implies that the server is no longer
52 server remains in recovery mode for a Grace period (always greater than the
53 lease duration the server uses) after a reboot.
54 During this Grace period, clients may recover state but not perform other
55 open/lock state changing operations.
56 To provide for correct recovery semantics, a small file described by
58 is used by the server during the recovery phase.
59 If this file is missing,
60 the server will not start.
61 If this file is lost, it should be recovered from backups, since creating
64 file will result in the server starting without providing a Grace Period
66 Note that recovery only occurs when the server
67 machine is rebooted, not when the
71 It provides several optional features not in NFS Version 3:
73 .Bd -literal -offset indent -compact
75 - Referrals, which redirect subtrees to other servers
77 - Delegations, which allow a client to operate on a file locally
82 protocol does not use a separate mount protocol and assumes that the
83 server provides a single file system tree structure, rooted at the point
84 in the local file system tree specified by one or more
86 .Bd -literal -offset indent -compact
87 V4: <rootdir> [-sec=secflavors] [host(s) or net]
98 allows a limited subset of operations to be performed on non-exported subtrees
99 of the local file system, so that traversal of the tree to the exported
100 subtrees is possible.
101 As such, the ``<rootdir>'' can be in a non-exported file system.
103 the entire tree that is rooted at that point must be in local file systems
104 that are of types that can be NFS exported.
107 file system is rooted at ``<rootdir>'', setting this to anything other
108 than ``/'' will result in clients being required to use different mount
111 than for NFS Version 2 or 3.
112 Unlike NFS Version 2 and 3, Version 4 allows a client mount to span across
113 multiple server file systems, although not all clients are capable of doing
117 uses names for users and groups instead of numbers.
121 .Bd -literal -offset indent -compact
125 where ``<dns.domain>'' is not the same as the DNS domain used
126 for host name lookups, but is usually set to the same string.
127 Most systems set this ``<dns.domain>''
128 to the domain name part of the machine's
131 However, this can normally be overridden by a command line
132 option or configuration file for the daemon used to do the name<->number
134 On FreeBSD, the mapping daemon is called
136 and has a command line option that overrides the domain component of the
140 either client or server, this daemon must be running.
141 If this ``<dns.domain>'' is not set correctly or the daemon is not running, ``ls -l'' will typically
142 report a lot of ``nobody'' and ``nogroup'' ownerships.
144 Although uid/gid numbers are no longer used in the
146 protocol, they will still be in the RPC authentication fields when running
147 using AUTH_SYS (sec=sys), which is the default.
148 As such, in this case both the user/group name and number spaces must
149 be consistent between the client and server.
153 with RPCSEC_GSS (sec=krb5, krb5i, krb5p), only names and KerberosV tickets
157 To set up the experimental nfs server that supports
159 you will need to either build a kernel with:
161 .Bd -literal -offset indent -compact
165 .Bd -literal -offset indent -compact
173 with the ``-e'' option to force use of the experimental server.
176 daemon must also be running.
179 .Bd -literal -offset indent -compact
180 nfs_server_enable="YES"
181 nfsv4_server_enable="YES"
182 nfsuserd_enable="YES"
188 You will also need to add at least one ``V4:'' line to the
190 file and, before starting the server for the first time, create an empty
192 .Bd -literal -offset indent -compact
193 /var/db/nfs-stablerestart
199 .Bd -literal -offset indent -compact
200 install -o root -g wheel -m 600 /dev/null /var/db/nfs-stablerestart
203 executed as ``su'' should suffice.
204 This can only be done when the server is not running and there are no
206 file system mounts against the server.
207 If this file is lost during a crash, recovery from backups is
210 If the file systems you are exporting are only being accessed via
212 there are a couple of
214 variables that you can change, which might improve performance.
216 .It Cm vfs.newnfs.issue_delegations
217 when set non-zero, allows the server to issue Open Delegations to
219 These delegations permit the client to manipulate the file
220 locally on the client.
221 Unfortunately, at this time, client use of
222 delegations is limited, so performance gains may not be observed.
223 This can only be enabled when the file systems being exported to
225 clients are not being accessed locally on the server and, if being
226 accessed via NFS Version 2 or 3 clients, these clients cannot be
228 .It Cm vfs.newnfs.enable_locallocks
229 can be set to 0 to disable acquisition of local byte range locks.
230 Disabling local locking can only be done if neither local accesses
231 to the exported file systems nor the NLM is operating on them.
234 Note that Samba server access would be considered ``local access'' for the above
237 To build a kernel with the experimental
241 .Bd -literal -offset indent -compact
245 must be specified in the kernel's
252 mount, specify the ``nfsv4'' option on the
255 This will force use of the experimental client plus set ``tcp'' and
260 must be running, as above.
263 server that is being mounted on supports delegations, you can start the
265 daemon to handle client side callbacks.
268 .Bd -literal -offset indent -compact
269 nfsuserd_enable="YES"
276 Without a functioning callback path, a server will never issue Delegations
279 By default, the callback address will be set to the IP address acquired via
280 rtalloc() in the kernel and port# 7745.
281 To override the default port#, a command line option for
285 To get callbacks to work when behind a NAT gateway, a port for the callback
286 service will need to be set up on the NAT gateway and then the address
287 of the NAT gateway (host IP plus port#) will need to be set by assigning the
289 variable vfs.newnfs.callback_addr to a string of the form:
293 where the first 4 Ns are the host IP address and the last two are the
294 port# in network byte order (all decimal #s in the range 0-255).
296 To build a kernel with the experimental
298 client linked into it, the option
300 .Bd -literal -offset indent -compact
304 must be specified in the kernel's
308 Options can be specified for the
312 daemons at boot time via the ``nfsuserd_flags'' and ``nfscbd_flags''
316 .Bl -tag -width /var/db/nfs-stablerestart -compact
317 .It Pa /var/db/nfs-stablerestart
318 NFS V4 stable restart file
329 At this time, there is no recall of delegations for local file system
331 As such, delegations should only be enabled for file systems
332 that are being used soley as NFS export volumes and are not being accessed
333 via local system calls nor services such as Samba.