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

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