From: Chuck Lever Date: Tue, 14 Jul 2009 20:37:02 +0000 (-0400) Subject: mount.nfs: Clean up nfs_is_permanent_error() X-Git-Tag: nfs-utils-1-2-1-rc2~14 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=987ee0e340a413c3bf3187084df9834eefb37bb9;p=nfs-utils.git 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 Signed-off-by: Steve Dickson --- 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 @@ -286,26 +286,6 @@ static int nfs_validate_options(struct nfsmount_info *mi) return nfs_append_addr_option(sap, salen, mi->options); } -/* - * 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 * @@ -633,6 +613,31 @@ static int nfs_try_mount(struct nfsmount_info *mi) return nfs_try_nfs23mount(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. *