mount: Report correct error in the fall_back cases (bz 1709961)

Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Steve Dickson 2019-05-20 14:07:40 -04:00
parent ab75e67f4c
commit 2f9cba1767
2 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,49 @@
commit a709f25c1da4a2fb44a1f3fd060298fbbd88aa3c
Author: Steve Dickson <steved@redhat.com>
Date: Tue May 14 15:52:50 2019 -0400
mount: Report correct error in the fall_back cases.
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>
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;
}
/*

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils Name: nfs-utils
URL: http://linux-nfs.org/ URL: http://linux-nfs.org/
Version: 2.3.4 Version: 2.3.4
Release: 0%{?dist} Release: 1%{?dist}
Epoch: 1 Epoch: 1
# group all 32bit related archs # group all 32bit related archs
@ -16,6 +16,8 @@ Source4: nfsconvert.py
Source5: nfsconvert.sh Source5: nfsconvert.sh
Source6: nfs-convert.service Source6: nfs-convert.service
Patch001: nfs-utils-2.3.4-mount-fallback.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
Patch102: nfs-utils-1.2.5-idmap-errmsg.patch Patch102: nfs-utils-1.2.5-idmap-errmsg.patch
@ -42,7 +44,7 @@ Provides: start-statd = %{epoch}:%{version}-%{release}
License: MIT and GPLv2 and GPLv2+ and BSD License: MIT and GPLv2 and GPLv2+ and BSD
Requires: rpcbind, sed, gawk, grep Requires: rpcbind, sed, gawk, grep
Requires: kmod, keyutils, quota Requires: kmod, keyutils, quota
BuildRequires: libevent-devel libcap-devel BuildRequires: libevent-devel libcap-devel libuuid-devel
BuildRequires: libtirpc-devel libblkid-devel BuildRequires: libtirpc-devel libblkid-devel
BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2
BuildRequires: automake, libtool, gcc, device-mapper-devel BuildRequires: automake, libtool, gcc, device-mapper-devel
@ -358,6 +360,9 @@ fi
%{_pkgdir}/*/var-lib-nfs-rpc_pipefs.mount %{_pkgdir}/*/var-lib-nfs-rpc_pipefs.mount
%changelog %changelog
* Mon May 20 2019 Steve Dickson <steved@redhat.com> 2.3.4-1
- mount: Report correct error in the fall_back cases (bz 1709961)
* Fri May 10 2019 Steve Dickson <steved@redhat.com> 2.3.4-0 * Fri May 10 2019 Steve Dickson <steved@redhat.com> 2.3.4-0
- Updated to the latest upstream release: 2.3.4 (bz 1708690) - Updated to the latest upstream release: 2.3.4 (bz 1708690)