Blame SOURCES/autofs-5.0.7-dont-schedule-new-alarms-after-readmap.patch

304803
autofs-5.0.7 - don't schedule new alarms after readmap
304803
304803
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
304803
304803
Currently, a new alarm is scheduled every time the daemon receives
304803
a SIGHUP (map re-read) or SIGUSR1 (forced expiration). Besides that,
304803
map re-reads started on demand when a map is found to be outdated
304803
also generate a new alarm.
304803
304803
Once added, these alarms are never deleted and hence increase the
304803
number of times the daemon wakes up to run the expiration procedure.
304803
After a couple of months, in setups with many mount points, it's
304803
normal to see automount waking up every second to handle the
304803
expiration timer.
304803
304803
This patch removes the alarm scheduling from the readmap cleanup
304803
routine and makes sure the alarm is re-added after the expiration
304803
process only when it was not triggered by SIGUSR1.
304803
304803
I couldn't think of any use case to justify keeping these alarms:
304803
it's critical to have the alarm ticking every timeout/4 seconds,
304803
but more than one periodic alarm running doesn't seem to make
304803
sense.
304803
---
304803
304803
 CHANGELOG      |    1 +
304803
 daemon/state.c |    6 +-----
304803
 2 files changed, 2 insertions(+), 5 deletions(-)
304803
304803
304803
diff --git a/CHANGELOG b/CHANGELOG
304803
index c9be73e..4cf5621 100644
304803
--- a/CHANGELOG
304803
+++ b/CHANGELOG
304803
@@ -22,6 +22,7 @@
304803
 - fix init script status return.
304803
 - fix use get_proximity() without libtirpc.
304803
 - don't use dirent d_type to filter out files in scandir()
304803
+- don't schedule new alarms after readmap.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
diff --git a/daemon/state.c b/daemon/state.c
304803
index b451c56..6e23022 100644
304803
--- a/daemon/state.c
304803
+++ b/daemon/state.c
304803
@@ -144,7 +144,7 @@ void expire_cleanup(void *arg)
304803
 					ap->submount = 2;
304803
 			}
304803
 
304803
-			if (!ap->submount)
304803
+			if (ap->state == ST_EXPIRE && !ap->submount)
304803
 				alarm_add(ap, ap->exp_runfreq);
304803
 
304803
 			/* FALLTHROUGH */
304803
@@ -330,13 +330,9 @@ static void do_readmap_cleanup(void *arg)
304803
 	ap = ra->ap;
304803
 
304803
 	st_mutex_lock();
304803
-
304803
 	ap->readmap_thread = 0;
304803
 	st_set_done(ap);
304803
-	if (!ap->submount)
304803
-		alarm_add(ap, ap->exp_runfreq);
304803
 	st_ready(ap);
304803
-
304803
 	st_mutex_unlock();
304803
 
304803
 	free(ra);