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

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