commit c1cf5467f3e6355b8cb19ecda5688895b912bf49 Author: Steve Dickson <steved@xxxxxxxxxx> Date: Mon Oct 12 17:08:59 2009 -0400 If a mount fails due to the server not supporting the version or network proto and either one of those options were set as defaults in the configuration file, retry the mount, after removing the options from list optlist allow the mount to negotiate to the supported version or network protocol. Signed-off-by: Steve Dickson <steved@xxxxxxxxxx> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 069bdc1..35b0797 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -92,6 +92,13 @@ struct nfsmount_info { child; /* forked bg child? */ }; +#ifdef MOUNT_CONFIG +#include "conffile.h" +int inline config_defaults(struct nfsmount_info *mi); +#else +int inline config_defaults(struct nfsmount_info *mi) {return 0;} +#endif + /* * Obtain a retry timeout value based on the value of the "retry=" option. * @@ -610,10 +617,22 @@ static int nfs_try_mount(struct nfsmount_info *mi) case 2: case 3: result = nfs_try_mount_v3v2(mi); + if (result) + break; + + if (config_defaults(mi)) + result = nfs_try_mount_v3v2(mi); break; + case 4: result = nfs_try_mount_v4(mi); + if (result) + break; + + if (config_defaults(mi)) + result = nfs_try_mount_v3v2(mi); break; + default: errno = EIO; } @@ -819,3 +838,36 @@ int nfsmount_string(const char *spec, const char *node, const char *type, free(mi.hostname); return retval; } + +#ifdef MOUNT_CONFIG +/* + * If the mount fails due to a ENOSUPPORT type of error + * and a default options were set in the configuration file + * try the mount again without that default options set. + */ +int inline config_defaults(struct nfsmount_info *mi) +{ + if (!config_default_opts) + return 0; + + switch(mi->version) { + case 4: + if (errno != EPROTONOSUPPORT) + return 0; + break; + case 3: + if (errno != ESPIPE) + return 0; + break; + default: + return 0; + } + if (config_default_opts && DEFAULT_VERS) + po_remove_all(mi->options, "vers"); + + if (config_default_opts && DEFAULT_PROTO) + po_remove_all(mi->options, "proto"); + + return 1; +} +#endif -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html