summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2017-05-04 09:50:49 -0400
committerSteve Dickson <steved@redhat.com>2017-05-05 11:07:00 -0400
commit0277815d9509ffc197c27973313f364616245704 (patch)
treeb1e4f13eb0e8ec60e0fa167d4369bf8b97a1f468
parent7b33590fee9515e49cda460285acc5d347a800b5 (diff)
downloadnfs-utils-0277815d9509ffc197c27973313f364616245704.tar.gz
mount.nfs: Restore errno after v3 mounts on ECONNREFUSED errors
Commit 65ac59cd introduced code that tries v3 mounts when the the v4 mount fails with ECONNREFUSED. This code allows failing back to v3 to work correctly. When the v3 mount fails the original errno value has been over rewritten. In these case the errno value needs to be restored to ECONNREFUSED. Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mount/stropts.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index a9ff95d..0fbb375 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -868,7 +868,10 @@ check_result:
result = nfs_try_mount_v4(mi);
if (result == 0 && errno != ECONNREFUSED)
goto check_result;
- }
+ } else if (result == 0)
+ /* Restore original errno with v3 failures */
+ errno = ECONNREFUSED;
+
return result;
default:
return result;