]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - usr.sbin/nfsd/nfsv4.4
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / usr.sbin / nfsd / nfsv4.4
1 .\" Copyright (c) 2009 Rick Macklem, University of Guelph
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
12 .\"
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
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd May 15, 2011
28 .Dt NFSV4 4
29 .Os
30 .Sh NAME
31 .Nm NFSv4
32 .Nd NFS Version 4 Protocol
33 .Sh DESCRIPTION
34 The NFS client and server provides support for the
35 .Tn NFSv4
36 specification; see
37 .%T "Network File System (NFS) Version 4 Protocol RFC 3530" .
38 The protocol is somewhat similar to NFS Version 3, but differs in significant
39 ways.
40 It uses a single compound RPC that concatenates operations to-gether.
41 Each of these operations are similar to the RPCs of NFS Version 3.
42 The operations in the compound are performed in order, until one of
43 them fails (returns an error) and then the RPC terminates at that point.
44 .Pp
45 It has
46 integrated locking support, which implies that the server is no longer
47 stateless.
48 As such, the
49 .Nm
50 server remains in recovery mode for a grace period (always greater than the
51 lease duration the server uses) after a reboot.
52 During this grace period, clients may recover state but not perform other
53 open/lock state changing operations.
54 To provide for correct recovery semantics, a small file described by
55 .Xr stablerestart 5
56 is used by the server during the recovery phase.
57 If this file is missing or empty, there is a backup copy maintained by
58 .Xr nfsd 8
59 that will be used. If either file is missing, they will be
60 created by the
61 .Xr nfsd 8 .
62 If both the file and the backup copy are empty,
63 it will result in the server starting without providing a grace period
64 for recovery.
65 Note that recovery only occurs when the server
66 machine is rebooted, not when the
67 .Xr nfsd 8
68 are just restarted.
69 .Pp
70 It provides several optional features not present in NFS Version 3:
71 .sp
72 .Bd -literal -offset indent -compact
73 - NFS Version 4 ACLs
74 - Referrals, which redirect subtrees to other servers
75   (not yet implemented)
76 - Delegations, which allow a client to operate on a file locally
77 .Ed
78 .Pp
79 The
80 .Nm
81 protocol does not use a separate mount protocol and assumes that the
82 server provides a single file system tree structure, rooted at the point
83 in the local file system tree specified by one or more
84 .sp 1
85 .Bd -literal -offset indent -compact
86 V4: <rootdir> [-sec=secflavors] [host(s) or net]
87 .Ed
88 .sp 1
89 line(s) in the
90 .Xr exports 5
91 file.
92 (See
93 .Xr exports 5
94 for details.)
95 The
96 .Xr nfsd 8
97 allows a limited subset of operations to be performed on non-exported subtrees
98 of the local file system, so that traversal of the tree to the exported
99 subtrees is possible.
100 As such, the ``<rootdir>'' can be in a non-exported file system.
101 However,
102 the entire tree that is rooted at that point must be in local file systems
103 that are of types that can be NFS exported.
104 Since the
105 .Nm
106 file system is rooted at ``<rootdir>'', setting this to anything other
107 than ``/'' will result in clients being required to use different mount
108 paths for
109 .Nm
110 than for NFS Version 2 or 3.
111 Unlike NFS Version 2 and 3, Version 4 allows a client mount to span across
112 multiple server file systems, although not all clients are capable of doing
113 this.
114 .Pp
115 .Nm
116 uses names for users and groups instead of numbers.
117 On the wire, they
118 take the form:
119 .sp
120 .Bd -literal -offset indent -compact
121 <user>@<dns.domain>
122 .Ed
123 .sp
124 where ``<dns.domain>'' is not the same as the DNS domain used
125 for host name lookups, but is usually set to the same string.
126 Most systems set this ``<dns.domain>''
127 to the domain name part of the machine's
128 .Xr hostname 1
129 by default.
130 However, this can normally be overridden by a command line
131 option or configuration file for the daemon used to do the name<->number
132 mapping.
133 Under FreeBSD, the mapping daemon is called
134 .Xr nfsuserd 8
135 and has a command line option that overrides the domain component of the
136 machine's hostname.
137 For use of
138 .Nm ,
139 either client or server, this daemon must be running.
140 If this ``<dns.domain>'' is not set correctly or the daemon is not running, ``ls -l'' will typically
141 report a lot of ``nobody'' and ``nogroup'' ownerships.
142 .Pp
143 Although uid/gid numbers are no longer used in the
144 .Nm
145 protocol, they will still be in the RPC authentication fields when
146 using AUTH_SYS (sec=sys), which is the default.
147 As such, in this case both the user/group name and number spaces must
148 be consistent between the client and server.
149 .Pp
150 However, if you run
151 .Nm
152 with RPCSEC_GSS (sec=krb5, krb5i, krb5p), only names and KerberosV tickets
153 will go on the wire.
154 .Sh SERVER SETUP
155 .Pp
156 To set up the NFS server that supports
157 .Nm ,
158 you will need to either set the variables in
159 .Xr rc.conf 5
160 as follows:
161 .sp
162 .Bd -literal -offset indent -compact
163 nfs_server_enable="YES"
164 nfsv4_server_enable="YES"
165 nfsuserd_enable="YES"
166 .Ed
167 .sp
168 or start
169 .Xr mountd 8
170 and
171 .Xr nfsd 8
172 without the ``-o'' option, which would force use of the old server.
173 The
174 .Xr nfsuserd 8
175 daemon must also be running.
176 .Pp
177 You will also need to add at least one ``V4:'' line to the
178 .Xr exports 5
179 file for
180 .Nm
181 to work.
182 .Pp
183 If the file systems you are exporting are only being accessed via
184 .Nm
185 there are a couple of
186 .Xr sysctl 8
187 variables that you can change, which might improve performance.
188 .Bl -tag -width Ds
189 .It Cm vfs.nfsd.issue_delegations
190 when set non-zero, allows the server to issue Open Delegations to
191 clients.
192 These delegations permit the client to manipulate the file
193 locally on the client.
194 Unfortunately, at this time, client use of
195 delegations is limited, so performance gains may not be observed.
196 This can only be enabled when the file systems being exported to
197 .Nm
198 clients are not being accessed locally on the server and, if being
199 accessed via NFS Version 2 or 3 clients, these clients cannot be
200 using the NLM.
201 .It Cm vfs.nfsd.enable_locallocks
202 can be set to 0 to disable acquisition of local byte range locks.
203 Disabling local locking can only be done if neither local accesses
204 to the exported file systems nor the NLM is operating on them.
205 .El
206 .sp
207 Note that Samba server access would be considered ``local access'' for the above
208 discussion.
209 .Pp
210 To build a kernel with the NFS server that supports
211 .Nm
212 linked into it, the
213 .sp
214 .Bd -literal -offset indent -compact
215 options NFSD
216 .Ed
217 .sp
218 must be specified in the kernel's
219 .Xr config 5
220 file.
221 .Sh CLIENT MOUNTS
222 .Pp
223 To do an
224 .Nm
225 mount, specify the ``nfsv4'' option on the
226 .Xr mount_nfs 8
227 command line.
228 This will force use of the client that supports
229 .Nm
230 plus set ``tcp'' and
231 .Nm .
232 .Pp
233 The
234 .Xr nfsuserd 8
235 must be running, as above.
236 If the
237 .Nm
238 server that is being mounted on supports delegations, you can start the
239 .Xr nfscbd 8
240 daemon to handle client side callbacks.
241 This will occur if
242 .sp
243 .Bd -literal -offset indent -compact
244 nfsuserd_enable="YES"
245 nfscbd_enable="YES"
246 .Ed
247 .sp
248 are set in
249 .Xr rc.conf 5 .
250 .sp
251 Without a functioning callback path, a server will never issue Delegations
252 to a client.
253 .sp
254 By default, the callback address will be set to the IP address acquired via
255 rtalloc() in the kernel and port# 7745.
256 To override the default port#, a command line option for
257 .Xr nfscbd 8
258 can be used.
259 .sp
260 To get callbacks to work when behind a NAT gateway, a port for the callback
261 service will need to be set up on the NAT gateway and then the address
262 of the NAT gateway (host IP plus port#) will need to be set by assigning the
263 .Xr sysctl 8
264 variable vfs.nfs.callback_addr to a string of the form:
265 .sp
266 N.N.N.N.N.N
267 .sp
268 where the first 4 Ns are the host IP address and the last two are the
269 port# in network byte order (all decimal #s in the range 0-255).
270 .Pp
271 To build a kernel with the client that supports
272 .Nm
273 linked into it, the option
274 .sp
275 .Bd -literal -offset indent -compact
276 options NFSCL
277 .Ed
278 .sp
279 must be specified in the kernel's
280 .Xr config 5
281 file.
282 .Pp
283 Options can be specified for the
284 .Xr nfsuserd 8
285 and
286 .Xr nfscbd 8
287 daemons at boot time via the ``nfsuserd_flags'' and ``nfscbd_flags''
288 .Xr rc.conf 5
289 variables.
290 .Sh FILES
291 .Bl -tag -width /var/db/nfs-stablerestart.bak -compact
292 .It Pa /var/db/nfs-stablerestart
293 NFS V4 stable restart file
294 .It Pa /var/db/nfs-stablerestart.bak
295 backup copy of the file
296 .El
297 .Sh SEE ALSO
298 .Xr stablerestart 5 ,
299 .Xr mountd 8 ,
300 .Xr nfscbd 8 ,
301 .Xr nfsd 8 ,
302 .Xr nfsdumpstate 8 ,
303 .Xr nfsrevoke 8 ,
304 .Xr nfsuserd 8 ,
305 .Sh BUGS
306 At this time, there is no recall of delegations for local file system
307 operations.
308 As such, delegations should only be enabled for file systems
309 that are being used solely as NFS export volumes and are not being accessed
310 via local system calls nor services such as Samba.