From: Steve Dickson <SteveD@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2/3] nfsmount.conf: New variables that explicitly set default (Release 2)
Date: Mon, 12 Oct 2009 17:38:55 -0400 [thread overview]
Message-ID: <4AD3A1EF.9020007@RedHat.com> (raw)
In-Reply-To: <4AD3A0BA.3080104-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
commit c1cf5467f3e6355b8cb19ecda5688895b912bf49
Author: Steve Dickson <steved@redhat.com>
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@redhat.com>
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
next prev parent reply other threads:[~2009-10-12 21:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-12 21:33 [PATCH 0/3] nfsmount.conf: New variables that explicitly set default (Release 2) Steve Dickson
[not found] ` <4AD3A0BA.3080104-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2009-10-12 21:37 ` [PATCH 1/3] " Steve Dickson
2009-10-12 21:38 ` Steve Dickson [this message]
2009-10-12 21:39 ` [PATCH 3/3] " Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD3A1EF.9020007@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox