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