autofs-5.1.9 - fix state queue not processing state changes

From: Ian Kent <raven@themaw.net>

The task queue handler is not being woken up to check the task queue
often enough.

The task queue handler should be signaled at least every time a task
transitions to ST_READY so make sure that happens.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG      |    1 +
 daemon/state.c |   13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 1386d46a7..428fbd837 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -66,6 +66,7 @@
 - fix indirect expire's count of remaining mounts.
 - fix leak with non-strict mount fails.
 - fix timed_read() error return.
+- fix state queue not processing state changes.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/daemon/state.c b/daemon/state.c
index dbd22be61..d570fce97 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -165,12 +165,19 @@ void expire_cleanup(void *arg)
 
 static unsigned int st_ready(struct autofs_point *ap)
 {
+	int status;
+
 	debug(ap->logopt,
 	      "st_ready(): state = %d path %s", ap->state, ap->path);
 
 	ap->shutdown = 0;
 	ap->state = ST_READY;
 
+	signaled = 1;
+	status = pthread_cond_signal(&cond);
+	if (status)
+		fatal(status);
+
 	return 1;
 }
 
@@ -713,12 +720,6 @@ int __st_add_task(struct autofs_point *ap, enum states state)
 	/* Task termination marker, poke state machine */
 	if (state == ST_READY) {
 		st_ready(ap);
-
-		signaled = 1;
-		status = pthread_cond_signal(&cond);
-		if (status)
-			fatal(status);
-
 		return 1;
 	}
 
