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

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