Blob Blame History Raw
autofs-5.0.3 - check replicated list after probe

From: Ian Kent <raven@themaw.net>

When checking a list of servers for proximity and NFS version
the list may become empty after after the initial probe. This
case isn't handled and this patch adds it.
---

 modules/replicated.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/modules/replicated.c b/modules/replicated.c
index 925f641..271907c 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -768,6 +768,15 @@ int prune_host_list(unsigned logopt, struct host **list,
 		this = next;
 	}
 
+	/*
+	 * The list of hosts that aren't proximity local may now
+	 * be empty if we haven't been able probe any so we need
+	 * to check again for a list containing only proximity
+	 * local hosts.
+	 */
+	if (!first)
+		return 1;
+
 	last = this;
 
 	/* Select NFS version of highest number of closest servers */