{"id":3478,"date":"2022-12-20T17:08:46","date_gmt":"2022-12-20T20:08:46","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/rpc-statd-man8-2\/"},"modified":"2022-12-20T17:08:46","modified_gmt":"2022-12-20T20:08:46","slug":"rpc-statd-man8-2","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/rpc-statd-man8-2\/","title":{"rendered":"RPC.STATD (man8)"},"content":{"rendered":"<h1 align=\"center\">RPC.STATD<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#NSM OPERATION IN DETAIL\">NSM OPERATION IN DETAIL<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#CONFIGURATION FILE\">CONFIGURATION FILE<\/a><br \/> <a href=\"#SECURITY\">SECURITY<\/a><br \/> <a href=\"#ADDITIONAL NOTES\">ADDITIONAL NOTES<\/a><br \/> <a href=\"#ENVIRONMENT\">ENVIRONMENT<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">rpc.statd \u2212 NSM service daemon<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>rpc.statd [-dh?FLNvV] [-H<\/b> <i>prog<\/i><b>] [-n<\/b> <i>my-name<\/i><b>] [-o<\/b> <i>outgoing-port<\/i><b>] <br \/> [-p<\/b> <i>listener-port<\/i><b>] [-P<\/b> <i>path<\/i><b>] <br \/> [&#8211;nlm-port<\/b> <i>port<\/i><b>] [&#8211;nlm-udp-port<\/b> <i>port<\/i><b>]<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">File locks are not part of persistent file system state. Lock state is thus lost when a host reboots.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Network file systems must also detect when lock state is lost because a remote host has rebooted. After an NFS client reboots, an NFS server must release all file locks held by applications that were running on that client. After a server reboots, a client must remind the server of file locks held by applications running on that client.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For NFS version 2 [RFC1094] and NFS version 3 [RFC1813], the <i>Network Status Monitor<\/i> protocol (or NSM for short) is used to notify NFS peers of reboots. On Linux, two separate user-space components constitute the NSM service: <b><br \/> rpc.statd<\/b><\/p>\n<p style=\"margin-left:22%;\">A daemon that listens for reboot notifications from other hosts, and manages the list of hosts to be notified when the local system reboots<\/p>\n<p style=\"margin-left:11%;\"><b>sm-notify<\/b><\/p>\n<p style=\"margin-left:22%;\">A helper program that notifies NFS peers after the local system reboots<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The local NFS lock manager alerts its local <b>rpc.statd<\/b> of each remote peer that should be monitored. When the local system reboots, the <b>sm-notify<\/b> command notifies the NSM service on monitored peers of the reboot. When a remote reboots, that peer notifies the local <b>rpc.statd<\/b>, which in turn passes the reboot notification back to the local NFS lock manager.<\/p>\n<h2>NSM OPERATION IN DETAIL <a name=\"NSM OPERATION IN DETAIL\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The first file locking interaction between an NFS client and server causes the NFS lock managers on both peers to contact their local NSM service to store information about the opposite peer. On Linux, the local lock manager contacts <b>rpc.statd<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>rpc.statd<\/b> records information about each monitored NFS peer on persistent storage. This information describes how to contact a remote peer in case the local system reboots, how to recognize which monitored peer is reporting a reboot, and how to notify the local lock manager when a monitored peer indicates it has rebooted.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">An NFS client sends a hostname, known as the client\u2019s <i>caller_name<\/i>, in each file lock request. An NFS server can use this hostname to send asynchronous GRANT calls to a client, or to notify the client it has rebooted.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The Linux NFS server can provide the client\u2019s <i>caller_name<\/i> or the client\u2019s network address to <b>rpc.statd<\/b>. For the purposes of the NSM protocol, this name or address is known as the monitored peer\u2019s <i>mon_name<\/i>. In addition, the local lock manager tells <b>rpc.statd<\/b> what it thinks its own hostname is. For the purposes of the NSM protocol, this hostname is known as <i>my_name<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">There is no equivalent interaction between an NFS server and a client to inform the client of the server\u2019s <i>caller_name<\/i>. Therefore NFS clients do not actually know what <i>mon_name<\/i> an NFS server might use in an SM_NOTIFY request. The Linux NFS client uses the server hostname from the mount command to identify rebooting NFS servers.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Reboot notification<\/b> <br \/> When the local system reboots, the <b>sm-notify<\/b> command reads the list of monitored peers from persistent storage and sends an SM_NOTIFY request to the NSM service on each listed remote peer. It uses the <i>mon_name<\/i> string as the destination. To identify which host has rebooted, the <b>sm-notify<\/b> command sends the <i>my_name<\/i> string recorded when that remote was monitored. The remote <b>rpc.statd<\/b> matches incoming SM_NOTIFY requests using this string, or the caller\u2019s network address, to one or more peers on its own monitor list.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If <b>rpc.statd<\/b> does not find a peer on its monitor list that matches an incoming SM_NOTIFY request, the notification is not forwarded to the local lock manager. In addition, each peer has its own <i>NSM state number<\/i>, a 32-bit integer that is bumped after each reboot by the <b>sm-notify<\/b> command. <b>rpc.statd<\/b> uses this number to distinguish between actual reboots and replayed notifications.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Part of NFS lock recovery is rediscovering which peers need to be monitored again. The <b>sm-notify<\/b> command clears the monitor list on persistent storage after each reboot.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>-d<\/b>, <b>&#8211;no-syslog<\/b><\/p>\n<p style=\"margin-left:22%;\">Causes <b>rpc.statd<\/b> to write log messages on <i>stderr<\/i> instead of to the system log, if the <b>-F<\/b> option was also specified.<\/p>\n<p style=\"margin-left:11%;\"><b>-F<\/b>, <b>&#8211;foreground<\/b><\/p>\n<p style=\"margin-left:22%;\">Keeps <b>rpc.statd<\/b> attached to its controlling terminal so that NSM operation can be monitored directly or run under a debugger. If this option is not specified, <b>rpc.statd<\/b> backgrounds itself soon after it starts.<\/p>\n<p style=\"margin-left:11%;\"><b>-h<\/b>, <b>-?<\/b>, <b>&#8211;help<\/b><\/p>\n<p style=\"margin-left:22%;\">Causes <b>rpc.statd<\/b> to display usage information on <i>stderr<\/i> and then exit.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212H, \u2212\u2212ha-callout<\/b> <i>prog<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies a high availability callout program. If this option is not specified, no callouts are performed. See the <b>High-availability callouts<\/b> section below for details.<\/p>\n<p style=\"margin-left:11%;\"><b>-L<\/b>, <b>&#8211;no-notify<\/b><\/p>\n<p style=\"margin-left:22%;\">Prevents <b>rpc.statd<\/b> from running the <b>sm-notify<\/b> command when it starts up, preserving the existing NSM state number and monitor list.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Note: the <b>sm-notify<\/b> command contains a check to ensure it runs only once after each system reboot. This prevents spurious reboot notification if <b>rpc.statd<\/b> restarts without the <b>-L<\/b> option.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212n, \u2212\u2212name<\/b> <i>ipaddr<\/i> <b>|<\/b> <i>hostname<\/i><\/p>\n<p style=\"margin-left:22%;\">This string is only used by the <b>sm-notify<\/b> command as the source address from which to send reboot notification requests.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>ipaddr<\/i> form can be expressed as either an IPv4 or an IPv6 presentation address. If this option is not specified, <b>rpc.statd<\/b> uses a wildcard address as the transport bind address. See <b>sm-notify<\/b>(8) for details.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><b>-N<\/b><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>Causes <b>rpc.statd<\/b> to run the <b>sm-notify<\/b> command, and then exit. Since the <b>sm-notify<\/b> command can also be run directly, this option is deprecated.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212o, \u2212\u2212outgoing\u2212port<\/b> <i>port<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies the source port number the <b>sm-notify<\/b> command should use when sending reboot notifications. See <b>sm-notify<\/b>(8) for details.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212p, \u2212\u2212port<\/b> <i>port<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies the port number used for RPC listener sockets. If this option is not specified, <b>rpc.statd<\/b> will try to consult <i>\/etc\/services<\/i>, if gets port succeed, set the same port for all listener socket, otherwise chooses a random ephemeral port for each listener socket.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">This option can be used to fix the port value of its listeners when SM_NOTIFY requests must traverse a firewall between clients and servers.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212T, \u2212\u2212nlm\u2212port<\/b> <i>port<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies the port number that <i>lockd<\/i> should listen on for <b>NLM<\/b> requests. This sets both the TCP and UDP ports unless the UDP port is set separately.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212U, \u2212\u2212nlm\u2212udp\u2212port<\/b> <i>port<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies the UDP port number that <i>lockd<\/i> should listen on for <b>NLM<\/b> requests.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212P, \u2212\u2212state\u2212directory\u2212path<\/b> <i>pathname<\/i><\/p>\n<p style=\"margin-left:22%;\">Specifies the pathname of the parent directory where NSM state information resides. If this option is not specified, <b>rpc.statd<\/b> uses <i>\/var\/lib\/nfs\/statd<\/i> by default.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">After starting, <b>rpc.statd<\/b> attempts to set its effective UID and GID to the owner and group of the subdirectory <b>sm<\/b> of this directory. After changing the effective ids, <b>rpc.statd<\/b> only needs to access files in <b>sm<\/b> and <b>sm.bak<\/b> within the state-directory-path.<\/p>\n<p style=\"margin-left:11%;\"><b>-v<\/b>, <b>-V<\/b>, <b>&#8211;version<\/b><\/p>\n<p style=\"margin-left:22%;\">Causes <b>rpc.statd<\/b> to display version information on <i>stderr<\/i> and then exit.<\/p>\n<h2>CONFIGURATION FILE <a name=\"CONFIGURATION FILE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Many of the options that can be set on the command line can also be controlled through values set in the <b>[statd]<\/b> or, in some cases, the <b>[lockd]<\/b> sections of the <i>\/etc\/nfs.conf<\/i> configuration file. Values recognized in the <b>[statd]<\/b> section include <b>port<\/b>, <b>outgoing-port<\/b>, <b>name<\/b>, <b>state-directory-path<\/b>, and <b>ha-callout<\/b> which each have the same effect as the option with the same name.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The values recognized in the <b>[lockd]<\/b> section include <b>port<\/b> and <b>udp-port<\/b> which have the same effect as the <b>&#8211;nlm-port<\/b> and <b>&#8211;nlm-udp-port<\/b> options, respectively.<\/p>\n<h2>SECURITY <a name=\"SECURITY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>rpc.statd<\/b> daemon must be started as root to acquire privileges needed to create sockets with privileged source ports, and to access the state information database. Because <b>rpc.statd<\/b> maintains a long-running network service, however, it drops root privileges as soon as it starts up to reduce the risk of a privilege escalation attack.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">During normal operation, the effective user ID it chooses is the owner of the state directory. This allows it to continue to access files in that directory after it has dropped its root privileges. To control which user ID <b>rpc.statd<\/b> chooses, simply use <b>chown<\/b>(1) to set the owner of the state directory.<\/p>\n<h2>ADDITIONAL NOTES <a name=\"ADDITIONAL NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Lock recovery after a reboot is critical to maintaining data integrity and preventing unnecessary application hangs. To help <b>rpc.statd<\/b> match SM_NOTIFY requests to NLM requests, a number of best practices should be observed, including:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The UTS nodename of your systems should match the DNS names that NFS peers use to contact them<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The UTS nodenames of your systems should always be fully qualified domain names<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The forward and reverse DNS mapping of the UTS nodenames should be consistent<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The hostname the client uses to mount the server should match the server\u2019s <i>mon_name<\/i> in SM_NOTIFY requests it sends<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Unmounting an NFS file system does not necessarily stop either the NFS client or server from monitoring each other. Both may continue monitoring each other for a time in case subsequent NFS traffic between the two results in fresh mounts and additional file locking.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">On Linux, if the <b>lockd<\/b> kernel module is unloaded during normal operation, all remote NFS peers are unmonitored. This can happen on an NFS client, for example, if an automounter removes all NFS mount points due to inactivity.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>High-availability callouts <br \/> rpc.statd<\/b> can exec a special callout program during processing of successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests, or when it receives SM_NOTIFY. Such a program may be used in High Availability NFS (HA-NFS) environments to track lock state that may need to be migrated after a system reboot.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The name of the callout program is specified with the <b>-H<\/b> option. The program is run with 3 arguments: The first is either <b>add-client del-client<\/b> or <b>sm-notify<\/b> depending on the reason for the callout. The second is the <i>mon_name<\/i> of the monitored peer. The third is the <i>caller_name<\/i> of the requesting lock manager for <b>add-client<\/b> or <b>del-client<\/b> , otherwise it is <i>IP_address<\/i> of the caller sending SM_NOTIFY. The forth is the <i>state_value<\/i> in the SM_NOTIFY request.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>IPv6 and TI-RPC support<\/b> <br \/> TI-RPC is a pre-requisite for supporting NFS on IPv6. If TI-RPC support is built into <b>rpc.statd<\/b>, it attempts to start listeners on network transports marked \u2019visible\u2019 in <i>\/etc\/netconfig<\/i>. As long as at least one network transport listener starts successfully, <b>rpc.statd<\/b> will operate.<\/p>\n<h2>ENVIRONMENT <a name=\"ENVIRONMENT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>RPC_STATD_NO_NOTIFY=<\/b><\/p>\n<p style=\"margin-left:22%;\">If set to a positive integer, has the same effect as <i>\u2212\u2212no\u2212notify<\/i>.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"32%\">\n<p style=\"margin-top: 1em\"><i>\/var\/lib\/nfs\/statd\/sm<\/i><\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"51%\">\n<p style=\"margin-top: 1em\">directory containing monitor list<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>\/var\/lib\/nfs\/statd\/sm.bak<\/i><\/p>\n<p style=\"margin-left:49%;\">directory containing notify list<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"37%\">\n<p><i>\/var\/lib\/nfs\/statd\/state<\/i><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"51%\">\n<p>NSM state number for this host<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"37%\">\n<p><i>\/var\/run\/run.statd.pid<\/i><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"51%\">\n<p>pid file<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"37%\">\n<p><i>\/etc\/netconfig<\/i><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"51%\">\n<p>network transport capability database<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>sm-notify<\/b>(8), <b>nfs<\/b>(5), <b>rpc.nfsd<\/b>(8), <b>rpcbind<\/b>(8), <b>tcpd<\/b>(8), <b>iptables<\/b>(8), <b>netconfig<\/b>(5)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">RFC 1094 &#8211; &#8220;NFS: Network File System Protocol Specification&#8221; <br \/> RFC 1813 &#8211; &#8220;NFS Version 3 Protocol Specification&#8221; <br \/> OpenGroup Protocols for Interworking: XNFS, Version 3W &#8211; Chapter 11<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Jeff Uphoff <juphoff@users.sourceforge.net> <br \/> Olaf Kirch <okir@monad.swb.de> <br \/> H.J. Lu <hjl@gnu.org> <br \/> Lon Hohberger <hohberger@missioncriticallinux.com> <br \/> Paul Clements <paul.clements@steeleye.com> Chuck Lever <chuck.lever@oracle.com><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  rpc.statd \u2212 NSM service daemon <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,224],"class_list":["post-3478","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-rpc"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3478"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3478\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}