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

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