Linux-NFS Archive on lore.kernel.org
 help / Atom feed
* [PATCH] mount: Report correct error in the fall_back cases.
@ 2019-05-14 20:04 Steve Dickson
  2019-05-20 17:43 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Dickson @ 2019-05-14 20:04 UTC (permalink / raw)
  To: Linux NFS Mailing list

In mount auto negotiation, a v3 mount is tried
when the v4 fails with error that could mean
v4 is not supported.

When the v3 mount fails, the original v4 failure
should be used to set the errno, not the v3 failure.

Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/stropts.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 1bb7a73..901f995 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -889,7 +889,7 @@ out:
  */
 static int nfs_autonegotiate(struct nfsmount_info *mi)
 {
-	int result;
+	int result, olderrno;
 
 	result = nfs_try_mount_v4(mi);
 check_result:
@@ -949,7 +949,18 @@ fall_back:
 	if (mi->version.v_mode == V_GENERAL)
 		/* v2,3 fallback not allowed */
 		return result;
-	return nfs_try_mount_v3v2(mi, FALSE);
+
+	/*
+	 * Save the original errno in case the v3 
+	 * mount fails from one of the fall_back cases. 
+	 * Report the first failure not the v3 mount failure
+	 */
+	olderrno = errno;
+	if ((result = nfs_try_mount_v3v2(mi, FALSE)))
+		return result;
+
+	errno = olderrno;
+	return result;
 }
 
 /*
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mount: Report correct error in the fall_back cases.
  2019-05-14 20:04 [PATCH] mount: Report correct error in the fall_back cases Steve Dickson
@ 2019-05-20 17:43 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2019-05-20 17:43 UTC (permalink / raw)
  To: Linux NFS Mailing list



On 5/14/19 4:04 PM, Steve Dickson wrote:
> In mount auto negotiation, a v3 mount is tried
> when the v4 fails with error that could mean
> v4 is not supported.
> 
> When the v3 mount fails, the original v4 failure
> should be used to set the errno, not the v3 failure.
> 
> Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed.... 

steved,
> ---
>  utils/mount/stropts.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index 1bb7a73..901f995 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -889,7 +889,7 @@ out:
>   */
>  static int nfs_autonegotiate(struct nfsmount_info *mi)
>  {
> -	int result;
> +	int result, olderrno;
>  
>  	result = nfs_try_mount_v4(mi);
>  check_result:
> @@ -949,7 +949,18 @@ fall_back:
>  	if (mi->version.v_mode == V_GENERAL)
>  		/* v2,3 fallback not allowed */
>  		return result;
> -	return nfs_try_mount_v3v2(mi, FALSE);
> +
> +	/*
> +	 * Save the original errno in case the v3 
> +	 * mount fails from one of the fall_back cases. 
> +	 * Report the first failure not the v3 mount failure
> +	 */
> +	olderrno = errno;
> +	if ((result = nfs_try_mount_v3v2(mi, FALSE)))
> +		return result;
> +
> +	errno = olderrno;
> +	return result;
>  }
>  
>  /*
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 20:04 [PATCH] mount: Report correct error in the fall_back cases Steve Dickson
2019-05-20 17:43 ` Steve Dickson

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org linux-nfs@archiver.kernel.org
	public-inbox-index linux-nfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox