]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/statd.man
Merge branch 'sid'
[nfs-utils.git] / utils / statd / statd.man
1 .\"@(#)rpc.statd.8"
2 .\"
3 .\" Copyright (C) 1999 Olaf Kirch <okir@monad.swb.de>
4 .\" Modified by Jeffrey A. Uphoff, 1999, 2002, 2005.
5 .\" Modified by Lon Hohberger, 2000.
6 .\" Modified by Paul Clements, 2004.
7 .\"
8 .\" Rewritten by Chuck Lever <chuck.lever@oracle.com>, 2009.
9 .\" Copyright 2009 Oracle.  All rights reserved.
10 .\"
11 .TH RPC.STATD 8 "1 November 2009
12 .SH NAME
13 rpc.statd \- NSM service daemon
14 .SH SYNOPSIS
15 .BI "rpc.statd [-dh?FLNvV] [-H " prog "] [-n " my-name "] [-o " outgoing-port "] [-p " listener-port "] [-P " path " ]
16 .SH DESCRIPTION
17 File locks are not part of persistent file system state.
18 Lock state is thus lost when a host reboots.
19 .PP
20 Network file systems must also detect when lock state is lost
21 because a remote host has rebooted.
22 After an NFS client reboots, an NFS server must release all file locks
23 held by applications that were running on that client.
24 After a server reboots, a client must remind the
25 server of file locks held by applications running on that client.
26 .PP
27 For NFS version 2 [RFC1094] and NFS version 3 [RFC1813], the
28 .I Network Status Monitor
29 protocol (or NSM for short)
30 is used to notify NFS peers of reboots.
31 On Linux, two separate user-space components constitute the NSM service:
32 .TP
33 .B rpc.statd
34 A daemon that listens for reboot notifications from other hosts, and
35 manages the list of hosts to be notified when the local system reboots
36 .TP
37 .B sm-notify
38 A helper program that notifies NFS peers after the local system reboots
39 .PP
40 The local NFS lock manager alerts its local
41 .B rpc.statd
42 of each remote peer that should be monitored.
43 When the local system reboots, the
44 .B sm-notify
45 command notifies the NSM service on monitored peers of the reboot.
46 When a remote reboots, that peer notifies the local
47 .BR rpc.statd ,
48 which in turn passes the reboot notification
49 back to the local NFS lock manager.
50 .SH NSM OPERATION IN DETAIL
51 The first file locking interaction between an NFS client and server causes
52 the NFS lock managers on both peers to contact their local NSM service to
53 store information about the opposite peer.
54 On Linux, the local lock manager contacts
55 .BR rpc.statd .
56 .PP
57 .B rpc.statd
58 records information about each monitored NFS peer on persistent storage.
59 This information describes how to contact a remote peer
60 in case the local system reboots,
61 how to recognize which monitored peer is reporting a reboot,
62 and how to notify the local lock manager when a monitored peer
63 indicates it has rebooted.
64 .PP
65 An NFS client sends a hostname, known as the client's
66 .IR caller_name ,
67 in each file lock request.
68 An NFS server can use this hostname to send asynchronous GRANT
69 calls to a client, or to notify the client it has rebooted.
70 .PP
71 The Linux NFS server can provide the client's
72 .I caller_name
73 or the client's network address to
74 .BR rpc.statd .
75 For the purposes of the NSM protocol,
76 this name or address is known as the monitored peer's
77 .IR mon_name .
78 In addition, the local lock manager tells
79 .B rpc.statd
80 what it thinks its own hostname is.
81 For the purposes of the NSM protocol,
82 this hostname is known as
83 .IR my_name .
84 .PP
85 There is no equivalent interaction between an NFS server and a client
86 to inform the client of the server's
87 .IR caller_name .
88 Therefore NFS clients do not actually know what
89 .I mon_name
90 an NFS server might use in an SM_NOTIFY request.
91 The Linux NFS client uses the server hostname from the mount command
92 to identify rebooting NFS servers.
93 .SS Reboot notification
94 When the local system reboots, the
95 .B sm-notify
96 command reads the list of monitored peers from persistent storage and
97 sends an SM_NOTIFY request to the NSM service on each listed remote peer.
98 It uses the
99 .I mon_name
100 string as the destination.
101 To identify which host has rebooted, the
102 .B sm-notify
103 command sends the
104 .I my_name
105 string recorded when that remote was monitored.
106 The remote
107 .B rpc.statd
108 matches incoming SM_NOTIFY requests using this string,
109 or the caller's network address,
110 to one or more peers on its own monitor list.
111 .PP
112 If
113 .B rpc.statd
114 does not find a peer on its monitor list that matches
115 an incoming SM_NOTIFY request,
116 the notification is not forwarded to the local lock manager.
117 In addition, each peer has its own
118 .IR "NSM state number" ,
119 a 32-bit integer that is bumped after each reboot by the
120 .B sm-notify
121 command.
122 .B rpc.statd
123 uses this number to distinguish between actual reboots
124 and replayed notifications.
125 .PP
126 Part of NFS lock recovery is rediscovering
127 which peers need to be monitored again.
128 The
129 .B sm-notify
130 command clears the monitor list on persistent storage after each reboot.
131 .SH OPTIONS
132 .TP
133 .BR -d , " --no-syslog
134 Causes
135 .B rpc.statd
136 to write log messages on
137 .I stderr
138 instead of to the system log,
139 if the
140 .B -F
141 option was also specified.
142 .TP
143 .BR -F , " --foreground
144 Keeps
145 .B rpc.statd
146 attached to its controlling terminal so that NSM
147 operation can be monitored directly or run under a debugger.
148 If this option is not specified,
149 .B rpc.statd
150 backgrounds itself soon after it starts.
151 .TP
152 .BR -h , " -?" , " --help
153 Causes
154 .B rpc.statd
155 to display usage information on
156 .I stderr
157 and then exit.
158 .TP
159 .BI "\-H," "" " \-\-ha-callout " prog
160 Specifies a high availability callout program.
161 If this option is not specified, no callouts are performed.
162 See the
163 .B High-availability callouts
164 section below for details.
165 .TP
166 .BR -L , " --no-notify
167 Prevents
168 .B rpc.statd
169 from running the
170 .B sm-notify
171 command when it starts up,
172 preserving the existing NSM state number and monitor list.
173 .IP
174 Note: the
175 .B sm-notify
176 command contains a check to ensure it runs only once after each system reboot.
177 This prevents spurious reboot notification if
178 .B rpc.statd
179 restarts without the
180 .B -L
181 option.
182 .TP
183 .BI "\-n, " "" "\-\-name " ipaddr " | " hostname
184 Specifies the bind address used for RPC listener sockets.
185 The
186 .I ipaddr
187 form can be expressed as either an IPv4 or an IPv6 presentation address.
188 If this option is not specified,
189 .B rpc.statd
190 uses a wildcard address as the transport bind address.
191 .IP
192 This string is also passed to the
193 .B sm-notify
194 command to be used as the source address from which
195 to send reboot notification requests.
196 See
197 .BR sm-notify (8)
198 for details.
199 .TP
200 .BR -N
201 Causes
202 .B rpc.statd
203 to run the
204 .B sm-notify
205 command, and then exit.
206 Since the
207 .B sm-notify
208 command can also be run directly, this option is deprecated.
209 .TP
210 .BI "\-o," "" " \-\-outgoing\-port "  port
211 Specifies the source port number the
212 .B sm-notify
213 command should use when sending reboot notifications.
214 See
215 .BR sm-notify (8)
216 for details.
217 .TP
218 .BI "\-p," "" " \-\-port " port
219 Specifies the port number used for RPC listener sockets.
220 If this option is not specified,
221 .B rpc.statd
222 will try to consult
223 .IR /etc/services ,
224 if gets port succeed, set the same port for all listener socket,
225 otherwise chooses a random ephemeral port for each listener socket.
226 .IP
227 This option can be used to fix the port value of its listeners when
228 SM_NOTIFY requests must traverse a firewall between clients and servers.
229 .TP
230 .BI "\-P, " "" \-\-state\-directory\-path " pathname
231 Specifies the pathname of the parent directory
232 where NSM state information resides.
233 If this option is not specified,
234 .B rpc.statd
235 uses
236 .I /var/lib/nfs
237 by default.
238 .IP
239 After starting,
240 .B rpc.statd
241 attempts to set its effective UID and GID to the owner
242 and group of this directory.
243 .TP
244 .BR -v ", " -V ", " --version
245 Causes
246 .B rpc.statd
247 to display version information on
248 .I stderr
249 and then exit.
250 .SH SECURITY
251 The
252 .B rpc.statd
253 daemon must be started as root to acquire privileges needed
254 to create sockets with privileged source ports, and to access the
255 state information database.
256 Because
257 .B rpc.statd
258 maintains a long-running network service, however, it drops root privileges
259 as soon as it starts up to reduce the risk of a privilege escalation attack.
260 .PP
261 During normal operation,
262 the effective user ID it chooses is the owner of the state directory.
263 This allows it to continue to access files in that directory after it
264 has dropped its root privileges.
265 To control which user ID
266 .B rpc.statd
267 chooses, simply use
268 .BR chown (1)
269 to set the owner of
270 the state directory.
271 .PP
272 You can also protect your
273 .B rpc.statd
274 listeners using the
275 .B tcp_wrapper
276 library or
277 .BR iptables (8).
278 To use the
279 .B tcp_wrapper
280 library, add the hostnames of peers that should be allowed access to
281 .IR /etc/hosts.allow .
282 Use the daemon name
283 .B statd
284 even if the
285 .B rpc.statd
286 binary has a different filename.
287 .P
288 For further information see the
289 .BR tcpd (8)
290 and
291 .BR hosts_access (5)
292 man pages.
293 .SH ADDITIONAL NOTES
294 Lock recovery after a reboot is critical to maintaining data integrity
295 and preventing unnecessary application hangs.
296 To help
297 .B rpc.statd
298 match SM_NOTIFY requests to NLM requests, a number of best practices
299 should be observed, including:
300 .IP
301 The UTS nodename of your systems should match the DNS names that NFS
302 peers use to contact them
303 .IP
304 The UTS nodenames of your systems should always be fully qualified domain names
305 .IP
306 The forward and reverse DNS mapping of the UTS nodenames should be
307 consistent
308 .IP
309 The hostname the client uses to mount the server should match the server's
310 .I mon_name
311 in SM_NOTIFY requests it sends
312 .PP
313 Unmounting an NFS file system does not necessarily stop
314 either the NFS client or server from monitoring each other.
315 Both may continue monitoring each other for a time in case subsequent
316 NFS traffic between the two results in fresh mounts and additional
317 file locking.
318 .PP
319 On Linux, if the
320 .B lockd
321 kernel module is unloaded during normal operation,
322 all remote NFS peers are unmonitored.
323 This can happen on an NFS client, for example,
324 if an automounter removes all NFS mount
325 points due to inactivity.
326 .SS High-availability callouts
327 .B rpc.statd
328 can exec a special callout program during processing of
329 successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests.
330 Such a program may be used in High Availability NFS (HA-NFS)
331 environments to track lock state that may need to be migrated after
332 a system reboot.
333 .PP
334 The name of the callout program is specified with the
335 .B -H
336 option.
337 The program is run with 3 arguments:
338 The first is either
339 .B add-client
340 or
341 .B del-client
342 depending on the reason for the callout.
343 The second is the
344 .I mon_name
345 of the monitored peer.
346 The third is the
347 .I caller_name
348 of the requesting lock manager.
349 .SS IPv6 and TI-RPC support
350 TI-RPC is a pre-requisite for supporting NFS on IPv6.
351 If TI-RPC support is built into
352 .BR rpc.statd ,
353 it attempts to start listeners on network transports marked 'visible' in
354 .IR /etc/netconfig .
355 As long as at least one network transport listener starts successfully,
356 .B rpc.statd
357 will operate.
358 .SH FILES
359 .TP 2.5i
360 .I /var/lib/nfs/sm
361 directory containing monitor list
362 .TP 2.5i
363 .I /var/lib/nfs/sm.bak
364 directory containing notify list
365 .TP 2.5i
366 .I /var/lib/nfs/state
367 NSM state number for this host
368 .TP 2.5i
369 .I /var/run/run.statd.pid
370 pid file
371 .TP 2.5i
372 .I /etc/netconfig
373 network transport capability database
374 .SH SEE ALSO
375 .BR sm-notify (8),
376 .BR nfs (5),
377 .BR rpc.nfsd (8),
378 .BR rpcbind (8),
379 .BR tcpd (8),
380 .BR hosts_access (5),
381 .BR iptables (8),
382 .BR netconfig (5)
383 .sp
384 RFC 1094 - "NFS: Network File System Protocol Specification"
385 .br
386 RFC 1813 - "NFS Version 3 Protocol Specification"
387 .br
388 OpenGroup Protocols for Interworking: XNFS, Version 3W - Chapter 11
389 .SH AUTHORS
390 Jeff Uphoff <juphoff@users.sourceforge.net>
391 .br
392 Olaf Kirch <okir@monad.swb.de>
393 .br
394 H.J. Lu <hjl@gnu.org>
395 .br
396 Lon Hohberger <hohberger@missioncriticallinux.com>
397 .br
398 Paul Clements <paul.clements@steeleye.com>
399 .br
400 Chuck Lever <chuck.lever@oracle.com>