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

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