Skip to contentSkip to conversation

text-based mount.nfs: sort between permanent and temporary errors

PATCH New Chuck Lever 1 participant 1 message Sep 12, 2007

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

PATCH 17/24 text-based mount.nfs: sort between permanent and temporary errors

The text-based mount.nfs program must distinguish between different types of errors returned from the kernel. Permanent errors, like bad mount options, should cause an immediate failure. Temporary errors, such as a connection timeout, should result in a retry of some type.

Add a function that sorts between the two types of errors. The list of permanent errors can be adjusted later if needed.

---

 utils/mount/stropts.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
utils/mount/stropts.c +20 -0
index d4777df..7f5a5bc 100644
@@ -210,6 +210,26 @@ static int fix_up_mounthost_opt(struct mount_options *options)
 }
 
 /*
+ * Distinguish between permanent and temporary errors.
+ *
+ * Returns 0 if the passed-in error code represents a
+ * temporary error that can be retried, and one if
+ * the error code represents a permanent error.
+ */
+static int is_permanent_error(int error)
+{
+	switch (error) {
+	case EACCES:
+	case ESTALE:
+	case ETIMEDOUT:
+	case ECONNREFUSED:
+		return 0;	/* temporary */
+	default:
+		return 1;	/* permanent */
+	}
+}
+
+/*
  * Reconstruct the mount option string based on a portmapper probe
  * of the server.  Returns one if the server's portmapper returned
  * something we can use, otherwise zero.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs