Blob Blame History Raw
autofs-5.1.2 - don't return until after master map retry read

From: Ian Kent <raven@themaw.net>

The master map read retry needs to be done before returning success
at startup or there can be problems trying to access automount mounts
before they are mounted.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG          |    1 +
 daemon/automount.c |   31 ++++++++++---------------------
 2 files changed, 11 insertions(+), 21 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -211,6 +211,7 @@
 - fix included master map not found return.
 - dont exit on master map read fail timeout.
 - set sane default master read wait timeout.
+- don't return until after master map retry read.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -2483,27 +2483,6 @@ int main(int argc, char *argv[])
 
 	master_read = master_read_master(master_list, age, 0);
 	if (!master_read) {
-		if (foreground)
-			logerr("%s: failed to read master map, "
-			       "will retry!",
-			       program);
-		else
-			logerr("%s: failed to read master map, "
-			       "will retry in background!",
-			       program);
-	}
-
-	/*
-	 * Mmm ... reset force unlink umount so we don't also do this
-	 * in future when we receive a HUP signal.
-	 */
-	do_force_unlink = 0;
-
-	st_stat = 0;
-	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
-	close(start_pipefd[1]);
-
-	if (!master_read) {
 		/*
 		 * Read master map, waiting until it is available, unless
 		 * a signal is received, in which case exit returning an
@@ -2521,6 +2500,16 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	/*
+	 * Mmm ... reset force unlink umount so we don't also do this
+	 * in future when we receive a HUP signal.
+	 */
+	do_force_unlink = 0;
+
+	st_stat = 0;
+	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
+	close(start_pipefd[1]);
+
 	state_mach_thid = pthread_self();
 	statemachine(NULL);