Bug#711021: mount.nfs timeout for GETPORT is much too short

2022-03-19 Thread Ben Hutchings
I'm not sure that this bug was ever fixed.

nfs-utils actually uses nfs_getport() to get the port.  That passes a
timeout of {-1, 0} to libtirpc, which is invalid and should result in
using the rpcbind client's default timeout.

The TCP client interface is implemented in src/clnt_vc.c.  It has a
default timeout (ct_wait field) that can be set with CLNT_CONTROL(...,
CLSET_TIMEOUT, ...), but nfs-utils doesn't seem to do that.  So it
seems like there is a default timeout of 0!

Ben.

-- 
Ben Hutchings
Beware of programmers who carry screwdrivers. - Leonard Brandwein


signature.asc
Description: This is a digitally signed message part


Bug#711021: mount.nfs timeout for GETPORT is much too short

2013-06-03 Thread Ben Hutchings
Package: nfs-common
Version: 1:1.2.6-3
Severity: important

This NFS client stopped being able to mount from my NFS server at boot
time, around the time I upgraded them both to wheezy.  I think the
problem started when only the server was upgraded and was ultimately
triggered by avahi-daemon being installed.  Since cups now recommends
avahi-daemon, this can be considered a common configuration.

I took a packet capture on both sides (which matched, so no packets are
being lost) and saw that:

- The client makes a GETPORT call
- The client retries a few times at 1 second intervals, then (if using
  TCP) closes the connection
- About 5 seconds after the first call from the client, the server sends
  a reply.  (strace-ing rpcbind showed it requesting a reverse DNS lookup
  from avahi, which apparently has a 5 second timeout for mDNS lookups.
  The client should have had a proper reverse DNS entry, but didn't.)
- The client sends a RST (TCP) or ICMP port unreachable error (UDP) when
  receiving the reply

The relevant functions include nfs_pmap_getport() in
support/nfs/getport.c, which even has a comment to say:

 *  2.  This version times out quickly by default.  It time-limits the
 *  connect process as well as the actual RPC call, and even allows the
 *  caller to specify the timeout.

I don't know why it does this, though perhaps the intent was to
fail-over quickly when auto-detecting whether the remote portmap/rpcbind
uses TCP or UDP.  But having failed to query on both protocols, the
timeout ought to be increased when retrying.

Ben.

-- Package-specific info:
-- rpcinfo --
   program vers proto   port
104   tcp111  portmapper
103   tcp111  portmapper
102   tcp111  portmapper
104   udp111  portmapper
103   udp111  portmapper
102   udp111  portmapper
1000241   udp  46254  status
1000241   tcp  58492  status
1000211   udp  33374  nlockmgr
1000213   udp  33374  nlockmgr
1000214   udp  33374  nlockmgr
1000211   tcp  40195  nlockmgr
1000213   tcp  40195  nlockmgr
1000214   tcp  40195  nlockmgr
-- /etc/default/nfs-common --
NEED_STATD=
STATDOPTS=
NEED_IDMAPD=
NEED_GSSD=
-- /etc/idmapd.conf --
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
-- /etc/fstab --
shadbolt:/home  /home   nfs nfsvers=3,nodev,nosuid,mountproto=tcp   
0   0
shadbolt:/usr/local /usr/local  nfs nfsvers=3,nodev,nosuid,mountproto=tcp   
0   0
-- /proc/mounts --
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
shadbolt:/home /home nfs 
rw,nosuid,nodev,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.2.1,mountvers=3,mountport=33045,mountproto=tcp,local_lock=none,addr=192.168.2.1
 0 0
shadbolt:/usr/local /usr/local nfs 
rw,nosuid,nodev,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.2.1,mountvers=3,mountport=33045,mountproto=tcp,local_lock=none,addr=192.168.2.1
 0 0

-- System Information:
Debian Release: 7.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 
'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nfs-common depends on:
ii  adduser 3.113+nmu3
ii  initscripts 2.88dsf-41
ii  libc6   2.13-38
ii  libcap2 1:2.22-1.2
ii  libcomerr2  1.42.5-1.1
ii  libdevmapper1.02.1  2:1.02.74-7
ii  libevent-2.0-5  2.0.19-stable-3
ii  libgssglue1 0.4-2
ii  libk5crypto31.10.1+dfsg-5
ii  libkeyutils11.5.5-3
ii  libkrb5-3   1.10.1+dfsg-5
ii  libmount1   2.20.1-5.3
ii  libnfsidmap20.25-4
ii  libtirpc1   0.2.2-5
ii  libwrap07.6.q-24
ii  lsb-base4.1+Debian8
ii  rpcbind 0.2.0-8
ii  ucf 3.0025+nmu3

Versions of packages nfs-common recommends:
ii  python  2.7.3-4

Versions of packages nfs-common suggests:
pn  open-iscsi  none
pn  watchdognone

-- no debconf information



signature.asc
Description: This is a digitally signed message part