@@ -711,6 +711,24 @@ done:
return 0;
}
+static unsigned int is_hosts_list_simple(struct host *list)
+{
+ struct host *this = list;
+ unsigned int ret = 1;
+
+ while (this) {
+ struct host *next = this->next;
+
+ if (this->rr) {
+ ret = 0;
+ break;
+ }
+ this = next;
+ }
+
+ return ret;
+}
+
int prune_host_list(unsigned logopt, struct host **list,
unsigned int vers, int port)
{
@@ -726,12 +744,6 @@ int prune_host_list(unsigned logopt, struct host **list,
if (!*list)
return 0;
- /* If we're using the host name then there's no point probing
- * avialability and respose time.
- */
- if (defaults_use_hostname_for_mounts())
- return 1;
-
/* Use closest hosts to choose NFS version */
first = *list;
@@ -767,6 +779,14 @@ int prune_host_list(unsigned logopt, struct host **list,
return 1;
}
+ /* If we're using the host name then there's no point probing
+ * avialability and respose time unless all host names in the
+ * list each resolve to a single address.
+ */
+ if (defaults_use_hostname_for_mounts() &&
+ !is_hosts_list_simple(this))
+ return 1;
+
proximity = this->proximity;
while (this) {
struct host *next = this->next;