diff mbox series

[RESEND] mount.nfs: retry NFSv3 mount after NFSv4 failure in auto negotiation

Message ID OSZPR01MB77727651A22E3D89E72954DD88522@OSZPR01MB7772.jpnprd01.prod.outlook.com (mailing list archive)
State New
Headers show
Series [RESEND] mount.nfs: retry NFSv3 mount after NFSv4 failure in auto negotiation | expand

Commit Message

Seiichi Ikarashi (Fujitsu) Nov. 5, 2024, 5:43 a.m. UTC
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@fujitsu.com>
---
 utils/mount/stropts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Scott Mayhew Nov. 5, 2024, 12:30 p.m. UTC | #1
On Tue, 05 Nov 2024, Seiichi Ikarashi (Fujitsu) wrote:

> 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@fujitsu.com>

Should probably also have Fixes: a709f25c ("mount: Report correct error in the fall_back cases.")

Reviewed-by: Scott Mayhew <smayhew@redhat.com>

> ---
>  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
>
Steve Dickson Nov. 11, 2024, 5:25 p.m. UTC | #2
On 11/4/24 11:43 PM, Seiichi Ikarashi (Fujitsu) wrote:
> 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@fujitsu.com>
Committed... (tag: nfs-utils-2-8-2-rc1)

steved.
> ---
>   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;
diff mbox series

Patch

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;