No description
  • C 77.4%
  • Roff 11.6%
  • Python 5.9%
  • M4 2.1%
  • Makefile 1.5%
  • Other 1.5%
Find a file
Benjamin Coddington 79770ef914 nfsdctl: bound the rpcbind calls to one 1s attempt
libtirpc's rpcb_set() and rpcb_unset() create a client for every call
and wait 60s for each reply. A local rpcbind that accepts the connection
and never answers stalls nfsdctl for a minute per call: five UNSETs when
the threads stop, and five UNSETs plus one SET per listener netid and
program when they start. libtirpc's setter for that timeout is private.

Make the SET and UNSET calls on a client of nfsdctl's own, built with
nfs_get_rpcclient(): AF_LOCAL on _PATH_RPCBINDSOCK first, then TCP to
127.0.0.1 port 111, as libtirpc's local_rpcb() orders them. Each pass
uses one client, and each call is one attempt of 1s, matching
17ceb2fecc7c ("SUNRPC: bound the local rpcbind client timeout to 1s"):
"The local rpcbind is on loopback or on an AF_LOCAL socket, and it
answers in microseconds."

A call that gets no answer ends the pass with one warning, as
ba8c47f04942 and df1ff8e4e275 do for the kernel's svc_register() and
svc_unregister() sweep. A registration pass whose opening UNSET sweep
gets no answer makes no SET. A reply of FALSE is logged and the pass
continues, as before.

nfs_svc_unregister() is unchanged, and a build without TI-RPC keeps
using it.

With the local rpcbind SIGSTOPped, on a kernel that leaves the nfsd
registration to nfsdctl, "nfsdctl threads 0" returned after 3.4s, where
it took 302.7s before. lockd's own registration in the kernel accounts
for 2s of that. "nfsdctl autostart" now ends its registration pass after
1s. The THREADS_SET that follows still fails with EIO, because lockd
cannot register.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
2026-11-18 07:24:19 -05:00
aclocal support: Add a mini-library to extract and apply RPC credentials 2026-03-07 12:06:46 -05:00
linux-nfs Remove **/Makefile.in, aclocal.m4, configure, and 2006-04-17 17:07:39 +10:00
scripts Add MAINTAINERS file and get_maintainer.pl 2026-11-13 13:53:50 -05:00
support mountd: limit caching after managed-group passwd lookup errors 2026-11-16 07:52:17 -05:00
systemd nfsdctl/rpc.nfsd: Add support for passing encrypted filehandle key 2026-03-29 16:08:54 -04:00
tests Add MAINTAINERS file and get_maintainer.pl 2026-11-13 13:53:50 -05:00
tools gssd: fix build failure with musl libc 2026-11-16 07:52:17 -05:00
utils nfsdctl: bound the rpcbind calls to one 1s attempt 2026-11-18 07:24:19 -05:00
.gitignore systemd: Add a generator to mount /sysroot via NFSv4 in the initrd 2025-06-05 06:48:56 -04:00
autogen.sh set +x on autogen.sh 2010-04-23 12:18:27 -04:00
configure.ac nfsd-iomode-advisor: recommend read_io= and write_io= for an export 2026-11-14 08:43:03 -05:00
COPYING pdate addres for Free Software Foundation 2011-08-29 12:57:07 -04:00
INSTALL Add some missing files needed for ./configure;make 2005-12-20 05:26:17 +00:00
install-dep install-dep: Use command -v instead of which 2021-09-23 11:39:07 -04:00
MAINTAINERS Add MAINTAINERS file and get_maintainer.pl 2026-11-13 13:53:50 -05:00
Makefile.am Add MAINTAINERS file and get_maintainer.pl 2026-11-13 13:53:50 -05:00
NEWS Fix typos in the root folder 2022-12-05 15:59:13 -05:00
nfs.conf nfs.conf: add no-netlink option to exportd and mountd stanzas 2026-07-11 06:51:00 -04:00
README README: fix mount command 2022-11-19 14:44:30 -05:00

This is nfs-utils, the Linux NFS userland utility package.


0. PROJECT RESOURCES

Home page:  http://sourceforge.net/projects/nfs/

To use the 'gss' support you must have kerberos-5 development 
libraries installed.
Otherwise use  "--disable-gss"

To use nfsv4 support you need libevent and libnfsidmap development
libraries.  They are available from 
   http://www.monkey.org/~provos/libevent/
   http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap/
Otherwise use --disable-nfsv4

To use the nfsdcld tracking daemon, nfsv4 support must be enabled,
and the libsqlite3 development libraries must be installed.

1. COMPILING

Unpack the sources and run these commands:

    # ./configure
    # make

To install binaries and documentation, run this command:

    # make install


2. COMPILING FROM GIT

Getting nfs-utils for the first time:

	git clone git://git.linux-nfs.org/~steved/nfs-utils.git

Updating to the latest head after you've already got it.

	git pull

Building requires that autotools be installed. To invoke them
simply

	sh autogen.sh

Finally, build as usual as above.

3. DAEMON STARTUP ORDER

This nfs-utils packages does not provide any scripts for starting
various daemons as most distributions replace them with their own, so
any scripts we package would not get much testing.
Instead, we explain the dependencies involved in startup so that
scripts can be written to work correctly.

3.0   PREREQUISITES 

   Name service (host name lookup) should be working before any
   NFS services are started.

   "portmap" must be running before any NFS services (server or
   client) are started.
   
   Normally network interfaces should be configured first as well,
   though this isn't critical for the NFS server (providing name
   service is handled locally).
   
3.1.  SERVER STARTUP


   A/  mount -t nfsd nfsd /proc/fs/nfsd
      This filesystem needs to be mount before most daemons,
      particularly exportfs, mountd, svcgssd, idmapd.
      It could be mounted once, or the script that starts each daemon
      could test if it is mounted and mount it if not.

   B/ svcgssd ; idmapd
       These supply services to nfsd and so should be started before
       rpc.nfsd.  Where they come between mounting the nfsd filesystem
       and starting the nfsd server is not important.
       idmapd is only needed for NFSv4 support.
       svcgssd is only needed if exportfs NFS filesystem with crypto-
       security (Kerberos).

   C/ exportfs -av ; rpc.mountd
       It is important that exportfs be run before mountd so that
       mountd is working from current information (in
       /var/lib/nfs/etab).
       It is also important that both of these are run before
       rpc.nfsd.
       If not, any NFS requests that arrive before mountd is started
       will get replied to with a 'Stale NFS File handle' error.

   D/ rpc.statd --no-notify
       It is best if statd is started before nfsd though this isn't
       critical. Certainly, it should be at most a few seconds after
       nfsd.
       When nfsd starts it will start lockd. If lockd then receives a
       lock request, it will communicate with statd. If statd is not
       running lockd will retry, but it won't wait forever for a
       reply.
       Note that if statd is started before nfsd, the --no-notify
       option must be used. If notify requests are sent out before
       nfsd start, clients may try to reclaim locks and, on finding
       that lockd isn't running, they will give up and never reclaim
       the lock.
       rpc.statd is only needed for NFSv2 and NFSv3 support.

   E/ rpc.nfsd
       Starting nfsd will automatically start lockd. The nfs server
       will now be fully active and respond to any requests from
       clients.
       
   F/ sm-notify
       This will notify any client which might have locks from before
       a reboot to try to reclaim their locks. This should start
       immediately after rpc.nfsd is started so that clients have a
       chance to reclaim locks within the 90 second grace period.
       sm-notify is only needed for NFSv2 and NFSv3 support.


3.2.  CLIENT STARTUP

   A/ sm-notify
      This should be run shortly after boot and before any NFS
      filesystems are mounted with remote-locking support -
      filesystems can be mounted with "-o nolock" before sm-notify.
      This is appropriate for '/', '/usr', and '/var'.

   B/ gssd ; idmapd
      idmapd should be started before mounting any NFSv4 filesystems.
      gssd should be started before mounting any NFS filesystems
      securely (with Kerberos).

   C/ statd should be run before any NFSv2 or NFSv3 filesystem is
      mounted with remote locking (i.e. without -o nolock).
      'mount' will try to use "/usr/sbin/start-statd" to start statd
      if it is not already running, so there is no need to explicitly
      start statd in boot-time scripts.

3.3.  SERVER/CLIENT INTERACTIONS

   A/ sm-notify
      Both the server and the client need sm-notify to be run.
      It should be run after the NFS server is started, but before
      and NFS filesystems are mounted with remote locking.

   B/ rpc.statd
      Both the server and the client need rpc.statd to be running.
      Each should try to start when they need it.

   C/ idmapd

      Both the server and client need idmapd to be running.  If idmapd
      is started (for the client) before starting nfsd the 'nfsd'
      filesystem is mounted, then idmapd should be sent a HUP signal
      afterwards to signal that the server channels should be opened.

   
      

Share And Enjoy!

    --	the nfs-utils developers
	<linux-nfs@vger.kernel.org>