Skip to contentSkip to conversation

mount.nfs: Restore errno after v3 mounts on ECONNREFUSED errors

PATCH In review Steve Dickson 1 participant 2 messages May 4, 2017 – May 5, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 this case the errno value needs to be restored to ECONNREFUSED.

---
 utils/mount/stropts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
utils/mount/stropts.c +4 -1
index a9ff95d..0fbb375 100644
@@ -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;
Signature · 1 line
2.9.3
#1 lore raw
Quoted 9 lines · Steve Dickson

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 this case the errno value needs to be restored to ECONNREFUSED.

Committed...

steved.

Quoted 21 lines
---
 utils/mount/stropts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
utils/mount/stropts.c +4 -1
index a9ff95d..0fbb375 100644
@@ -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;