diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-10-10 15:06:39 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-10-11 11:03:18 +1000 |
commit | 4ce9ddfb03de06e90fb4cf0eb5767cb0e3a98905 (patch) | |
tree | 7097a3dcdbb864c788ad8d32bc4c41f690570462 | |
parent | 9996ea948dd791066b190c5112d59b8e2ffcc9cc (diff) | |
download | nfs-utils-4ce9ddfb03de06e90fb4cf0eb5767cb0e3a98905.tar.gz nfs-utils-4ce9ddfb03de06e90fb4cf0eb5767cb0e3a98905.tar.xz nfs-utils-4ce9ddfb03de06e90fb4cf0eb5767cb0e3a98905.zip |
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.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r-- | utils/mount/stropts.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 13523f8..b6d3a12 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -238,6 +238,27 @@ static int set_mandatory_options(const char *type, } /* + * 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 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. |