text-based mount.nfs: sort between permanent and temporary errors
Subsystems (2)
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
@@ -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