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

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