Blame SOURCES/autofs-5.1.1-fix-direct-map-expire-not-set-for-initial-empty-map.patch

306fa1
autofs-5.1.1 - fix direct map expire not set for initial empty map
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
If an empty direct map is present at startup the expire alarm can't be
306fa1
set because the expire run frequency isn't known. But if the map is
306fa1
re-read and is no longer empty the expire alarm wasn't being set.
306fa1
306fa1
Fix suggested by xuw at redhat dot com, thanks.
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 CHANGELOG      |    1 +
306fa1
 daemon/state.c |   10 ++++++++++
306fa1
 2 files changed, 11 insertions(+)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -179,6 +179,7 @@
306fa1
 - make find_server() return a status.
306fa1
 - fix return handling of do_reconnect() in ldap module.
306fa1
 - fix direct mount stale instance flag reset.
306fa1
+- fix direct map expire not set for initail empty map.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/daemon/state.c
306fa1
+++ autofs-5.0.7/daemon/state.c
306fa1
@@ -488,6 +488,7 @@ static void *do_readmap(void *arg)
306fa1
 		status = lookup_ghost(ap, ap->path);
306fa1
 	} else {
306fa1
 		struct mapent *me;
306fa1
+		unsigned int append_alarm = !ap->exp_runfreq;
306fa1
 
306fa1
 		mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/");
306fa1
 		pthread_cleanup_push(tree_mnts_cleanup, mnts);
306fa1
@@ -517,6 +518,15 @@ static void *do_readmap(void *arg)
306fa1
 			map->stale = 0;
306fa1
 			map = map->next;
306fa1
 		}
306fa1
+
306fa1
+		/* If the direct mount map was empty at startup no expire
306fa1
+		 * alarm will have been added. So add it here if there are
306fa1
+		 * now map entries.
306fa1
+		 */
306fa1
+		if (append_alarm && ap->exp_runfreq)
306fa1
+			alarm_add(ap, ap->exp_runfreq +
306fa1
+				  rand() % ap->exp_runfreq);
306fa1
+
306fa1
 		pthread_cleanup_pop(1);
306fa1
 		pthread_cleanup_pop(1);
306fa1
 		pthread_cleanup_pop(1);