Blame SOURCES/nfs-utils-2.3.3-mount-fallback.patch

bc9fd4
commit a709f25c1da4a2fb44a1f3fd060298fbbd88aa3c
bc9fd4
Author: Steve Dickson <steved@redhat.com>
bc9fd4
Date:   Tue May 14 15:52:50 2019 -0400
bc9fd4
bc9fd4
    mount: Report correct error in the fall_back cases.
bc9fd4
    
bc9fd4
    In mount auto negotiation, a v3 mount is tried
bc9fd4
    when the v4 fails with error that could mean
bc9fd4
    v4 is not supported.
bc9fd4
    
bc9fd4
    When the v3 mount fails, the original v4 failure
bc9fd4
    should be used to set the errno, not the v3 failure.
bc9fd4
    
bc9fd4
    Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961
bc9fd4
    Signed-off-by: Steve Dickson <steved@redhat.com>
bc9fd4
bc9fd4
diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c
bc9fd4
--- nfs-utils-2.3.3/utils/mount/stropts.c.orig	2019-08-12 10:58:32.610650773 -0400
bc9fd4
+++ nfs-utils-2.3.3/utils/mount/stropts.c	2019-08-12 11:10:39.661142985 -0400
bc9fd4
@@ -888,7 +888,7 @@ out:
bc9fd4
  */
bc9fd4
 static int nfs_autonegotiate(struct nfsmount_info *mi)
bc9fd4
 {
bc9fd4
-	int result;
bc9fd4
+	int result, olderrno;
bc9fd4
 
bc9fd4
 	result = nfs_try_mount_v4(mi);
bc9fd4
 check_result:
bc9fd4
@@ -948,7 +948,18 @@ fall_back:
bc9fd4
 	if (mi->version.v_mode == V_GENERAL)
bc9fd4
 		/* v2,3 fallback not allowed */
bc9fd4
 		return result;
bc9fd4
-	return nfs_try_mount_v3v2(mi, FALSE);
bc9fd4
+
bc9fd4
+	/*
bc9fd4
+	 * Save the original errno in case the v3 
bc9fd4
+	 * mount fails from one of the fall_back cases. 
bc9fd4
+	 * Report the first failure not the v3 mount failure
bc9fd4
+	 */
bc9fd4
+	olderrno = errno;
bc9fd4
+	if ((result = nfs_try_mount_v3v2(mi, FALSE)))
bc9fd4
+		return result;
bc9fd4
+
bc9fd4
+	errno = olderrno;
bc9fd4
+	return result;
bc9fd4
 }
bc9fd4
 
bc9fd4
 /*