Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 265

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff --git a/modules/replicated.c b/modules/replicated.c
index 14b20a9..90b2925 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -725,19 +725,21 @@ int prune_host_list(unsigned logopt, struct host **list,
 	while (this && this->proximity == PROXIMITY_LOCAL)
 		this = this->next;
 
-	proximity = PROXIMITY_LOCAL;
-	if (this)
-		proximity = this->proximity;
+	/*
+	 * Check for either a list containing only proximity local hosts
+	 * or a single host entry whose proximity isn't local. If so
+	 * return immediately as we don't want to add probe latency for
+	 * the common case of a single filesystem mount request.
+	 */
+	if (!this || !this->next)
+		return 1;
 
+	proximity = this->proximity;
+	first = this;
 	this = first;
 	while (this) {
 		struct host *next = this->next;
 
-		if (this->proximity == PROXIMITY_LOCAL) {
-			this = next;
-			continue;
-		}
-
 		if (this->proximity != proximity)
 			break;
 
@@ -758,10 +760,6 @@ int prune_host_list(unsigned logopt, struct host **list,
 
 	last = this;
 
-	/* If there are only local entries on the list, just return it. */
-	if (!first)
-		return 0;
-
 	/* Select NFS version of highest number of closest servers */
 
 	v4_tcp_count = v3_tcp_count = v2_tcp_count = 0;