The problem happens when a v3 mount fails with ETIMEDOUT after the v4 mount failed with EPROTONOSUPPORT, in mount auto negotiation. It immediately breaks from the "for" loop in nfsmount_fg() or nfsmount_child() due to EPROTONOSUPPORT, never doing the expected retries until timeout. [auto negotiation case]: It breaks immediately. # time mount.nfs -v 192.168.200.59:/exp /mnt mount.nfs: timeout set for Wed Oct 23 14:21:58 2024 mount.nfs: trying text-based options 'vers=4.2,addr=192.168.200.59,clientaddr=192.168.200.187' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=192.168.200.59,clientaddr=192.168.200.187' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'vers=4,addr=192.168.200.59,clientaddr=192.168.200.187' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'addr=192.168.200.59' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.200.59 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.200.59 prog 100005 vers 3 prot UDP port 20048 mount.nfs: portmap query retrying: RPC: Timed out mount.nfs: prog 100005, trying vers=3, prot=6 mount.nfs: trying 192.168.200.59 prog 100005 vers 3 prot TCP port 20048 mount.nfs: portmap query failed: RPC: Timed out mount.nfs: Protocol not supported for 192.168.200.59:/exp on /mnt real 0m13.027s user 0m0.002s sys 0m0.005s # [nfsvers=3 case]: It retries until exceeding timeout as expected. # time mount.nfs -v -o nfsvers=3 192.168.200.59:/exp /mnt mount.nfs: timeout set for Wed Oct 23 14:22:23 2024 mount.nfs: trying text-based options 'nfsvers=3,addr=192.168.200.59' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.200.59 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.200.59 prog 100005 vers 3 prot UDP port 20048 mount.nfs: portmap query retrying: RPC: Timed out mount.nfs: prog 100005, trying vers=3, prot=6 mount.nfs: trying 192.168.200.59 prog 100005 vers 3 prot TCP port 20048 mount.nfs: portmap query failed: RPC: Timed out (snip) mount.nfs: prog 100005, trying vers=3, prot=6 mount.nfs: trying 192.168.200.59 prog 100005 vers 3 prot TCP port 20048 mount.nfs: portmap query failed: RPC: Timed out mount.nfs: Connection timed out for 192.168.200.59:/exp on /mnt real 2m10.152s user 0m0.007s sys 0m0.015s # Let's retry in auto negotiation case, too. Signed-off-by: Seiichi Ikarashi <s.ikarashi@xxxxxxxxxxx> --- utils/mount/stropts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index a92c420..103c41f 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -981,7 +981,7 @@ fall_back: if ((result = nfs_try_mount_v3v2(mi, FALSE))) return result; - if (errno != EBUSY && errno != EACCES) + if (errno != EBUSY && errno != EACCES && errno != ETIMEDOUT) errno = olderrno; return result; -- 2.43.5