|
|
306fa1 |
autofs-5.0.7 - probe each nfs version in turn for singleton mounts
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
|
|
|
306fa1 |
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
include/replicated.h | 2 ++
|
|
|
306fa1 |
modules/mount_nfs.c | 35 ++++++++++++++++++++++++++++++++++-
|
|
|
306fa1 |
modules/replicated.c | 8 ++++----
|
|
|
306fa1 |
4 files changed, 41 insertions(+), 5 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
306fa1 |
index 39d7889..48e9806 100644
|
|
|
306fa1 |
--- a/CHANGELOG
|
|
|
306fa1 |
+++ b/CHANGELOG
|
|
|
306fa1 |
@@ -48,6 +48,7 @@
|
|
|
306fa1 |
- fix master map mount options matching.
|
|
|
306fa1 |
- fix master map bogus keywork match.
|
|
|
306fa1 |
- fix fix map entry duplicate offset detection.
|
|
|
306fa1 |
+- probe each nfs version in turn for singleton mounts.
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
diff --git a/include/replicated.h b/include/replicated.h
|
|
|
306fa1 |
index ff0e7b9..728f131 100644
|
|
|
306fa1 |
--- a/include/replicated.h
|
|
|
306fa1 |
+++ b/include/replicated.h
|
|
|
306fa1 |
@@ -68,6 +68,8 @@ struct host {
|
|
|
306fa1 |
};
|
|
|
306fa1 |
|
|
|
306fa1 |
void seed_random(void);
|
|
|
306fa1 |
+struct host *new_host(const char *, struct sockaddr *, size_t,
|
|
|
306fa1 |
+ unsigned int, unsigned int, unsigned int);
|
|
|
306fa1 |
void free_host_list(struct host **);
|
|
|
306fa1 |
int parse_location(unsigned, struct host **, const char *, unsigned int);
|
|
|
306fa1 |
int prune_host_list(unsigned, struct host **, unsigned int, int);
|
|
|
306fa1 |
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
|
|
|
306fa1 |
index 5424d74..81ba3ca 100644
|
|
|
306fa1 |
--- a/modules/mount_nfs.c
|
|
|
306fa1 |
+++ b/modules/mount_nfs.c
|
|
|
306fa1 |
@@ -180,9 +180,42 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
|
|
306fa1 |
* We can't probe protocol rdma so leave it to mount.nfs(8)
|
|
|
306fa1 |
* and and suffer the delay if a server isn't available.
|
|
|
306fa1 |
*/
|
|
|
306fa1 |
- if (!rdma)
|
|
|
306fa1 |
+ if (rdma)
|
|
|
306fa1 |
+ goto dont_probe;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ /*
|
|
|
306fa1 |
+ * If this is a singleton mount, and NFSv4 only hasn't been asked
|
|
|
306fa1 |
+ * for, and the default NFS protocol is set to v4 in the autofs
|
|
|
306fa1 |
+ * configuration only probe NFSv4 and let mount.nfs(8) do fallback
|
|
|
306fa1 |
+ * to NFSv3 (if it can). If the NFSv4 probe fails then probe as
|
|
|
306fa1 |
+ * normal.
|
|
|
306fa1 |
+ */
|
|
|
306fa1 |
+ if (!hosts->next &&
|
|
|
306fa1 |
+ mount_default_proto == 4 &&
|
|
|
306fa1 |
+ vers & NFS_VERS_MASK != 0 &&
|
|
|
306fa1 |
+ vers & NFS4_VERS_MASK != 0) {
|
|
|
306fa1 |
+ unsigned int v4_probe_ok = 0;
|
|
|
306fa1 |
+ struct host *tmp = new_host(hosts->name,
|
|
|
306fa1 |
+ hosts->addr, hosts->addr_len,
|
|
|
306fa1 |
+ hosts->proximity,
|
|
|
306fa1 |
+ hosts->weight, hosts->options);
|
|
|
306fa1 |
+ if (tmp) {
|
|
|
306fa1 |
+ tmp->rr = hosts->rr;
|
|
|
306fa1 |
+ prune_host_list(ap->logopt, &tmp,
|
|
|
306fa1 |
+ NFS4_VERS_MASK|TCP_SUPPORTED, port);
|
|
|
306fa1 |
+ /* If probe succeeds just try the mount with host in hosts */
|
|
|
306fa1 |
+ if (tmp) {
|
|
|
306fa1 |
+ v4_probe_ok = 1;
|
|
|
306fa1 |
+ free_host_list(&tmp);
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+ if (!v4_probe_ok)
|
|
|
306fa1 |
+ prune_host_list(ap->logopt, &hosts, vers, port);
|
|
|
306fa1 |
+ } else {
|
|
|
306fa1 |
prune_host_list(ap->logopt, &hosts, vers, port);
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
|
|
|
306fa1 |
+dont_probe:
|
|
|
306fa1 |
if (!hosts) {
|
|
|
306fa1 |
info(ap->logopt, MODPREFIX "no hosts available");
|
|
|
306fa1 |
return 1;
|
|
|
306fa1 |
diff --git a/modules/replicated.c b/modules/replicated.c
|
|
|
306fa1 |
index 6dbdade..0a044b9 100644
|
|
|
306fa1 |
--- a/modules/replicated.c
|
|
|
306fa1 |
+++ b/modules/replicated.c
|
|
|
306fa1 |
@@ -280,10 +280,10 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
|
|
|
306fa1 |
return PROXIMITY_OTHER;
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
-static struct host *new_host(const char *name,
|
|
|
306fa1 |
- struct sockaddr *addr, size_t addr_len,
|
|
|
306fa1 |
- unsigned int proximity, unsigned int weight,
|
|
|
306fa1 |
- unsigned int options)
|
|
|
306fa1 |
+struct host *new_host(const char *name,
|
|
|
306fa1 |
+ struct sockaddr *addr, size_t addr_len,
|
|
|
306fa1 |
+ unsigned int proximity, unsigned int weight,
|
|
|
306fa1 |
+ unsigned int options)
|
|
|
306fa1 |
{
|
|
|
306fa1 |
struct host *new;
|
|
|
306fa1 |
struct sockaddr *tmp2;
|