summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-07-14 16:37:02 -0400
committerSteve Dickson <steved@redhat.com>2009-07-14 16:37:02 -0400
commit987ee0e340a413c3bf3187084df9834eefb37bb9 (patch)
tree96efa991b8b256c765e5494b081ca36035aa013c /utils
parentca4e817b083553b6244e81ac91d9db86c09948b1 (diff)
downloadnfs-utils-987ee0e340a413c3bf3187084df9834eefb37bb9.tar.gz
nfs-utils-987ee0e340a413c3bf3187084df9834eefb37bb9.tar.xz
nfs-utils-987ee0e340a413c3bf3187084df9834eefb37bb9.zip
mount.nfs: Clean up nfs_is_permanent_error()
Clean up: Move nfs_is_permanent_error() closer to the functions that call it, and update a documenting comment to reflect recent restructuring in this area. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/mount/stropts.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 6801569..6560f1c 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -287,26 +287,6 @@ static int nfs_validate_options(struct nfsmount_info *mi)
}
/*
- * Distinguish between permanent and temporary errors.
- *
- * Returns 0 if the passed-in error is temporary, thus the
- * mount system call should be retried; returns one if the
- * passed-in error is permanent, thus the mount system call
- * should not be retried.
- */
-static int nfs_is_permanent_error(int error)
-{
- switch (error) {
- case ESTALE:
- case ETIMEDOUT:
- case ECONNREFUSED:
- return 0; /* temporary */
- default:
- return 1; /* permanent */
- }
-}
-
-/*
* Get NFS/mnt server addresses from mount options
*
* Returns 1 and fills in @nfs_saddr, @nfs_salen, @mnt_saddr, and @mnt_salen
@@ -634,6 +614,31 @@ static int nfs_try_mount(struct nfsmount_info *mi)
}
/*
+ * Distinguish between permanent and temporary errors.
+ *
+ * Basically, we retry if communication with the server has
+ * failed so far, but fail immediately if there is a local
+ * error (like a bad mount option).
+ *
+ * ESTALE is also a temporary error because some servers
+ * return ESTALE when a share is temporarily offline.
+ *
+ * Returns 1 if we should fail immediately, or 0 if we
+ * should retry.
+ */
+static int nfs_is_permanent_error(int error)
+{
+ switch (error) {
+ case ESTALE:
+ case ETIMEDOUT:
+ case ECONNREFUSED:
+ return 0; /* temporary */
+ default:
+ return 1; /* permanent */
+ }
+}
+
+/*
* Handle "foreground" NFS mounts.
*
* Retry the mount request for as long as the 'retry=' option says.