Blame SOURCES/autofs-5.0.9-amd-lookup-fix-expire-of-amd-nfs-mounts.patch

304803
autofs-5.0.9 - amd lookup fix expire of amd nfs mounts
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Becuase of the way map entries are matched for amd maps there
304803
might not be an entry in the map entry cache for mounts. This
304803
was causing mounts to not expire.
304803
---
304803
 daemon/automount.c |   20 +++++++++++---------
304803
 1 file changed, 11 insertions(+), 9 deletions(-)
304803
304803
diff --git a/daemon/automount.c b/daemon/automount.c
304803
index 0ba3580..9d9ba7b 100644
304803
--- a/daemon/automount.c
304803
+++ b/daemon/automount.c
304803
@@ -462,7 +462,7 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
304803
 {
304803
 	struct mapent_cache *mc;
304803
 	struct mapent *me;
304803
-	unsigned int is_mm_root;
304803
+	unsigned int is_mm_root = 0;
304803
 	int left;
304803
 
304803
 	me = lookup_source_mapent(ap, path, LKP_DISTINCT);
304803
@@ -474,22 +474,22 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
304803
 			ind_key++;
304803
 
304803
 		me = lookup_source_mapent(ap, ind_key, LKP_NORMAL);
304803
-		if (!me)
304803
-			return 0;
304803
 	}
304803
 
304803
-	mc = me->mc;
304803
-	is_mm_root = (me->multi == me);
304803
+	if (me) {
304803
+		mc = me->mc;
304803
+		is_mm_root = (me->multi == me);
304803
+	}
304803
 
304803
 	left = 0;
304803
 
304803
-	pthread_cleanup_push(cache_lock_cleanup, mc);
304803
-
304803
-	if (me->multi) {
304803
+	if (me && me->multi) {
304803
 		char root[PATH_MAX];
304803
 		char *base;
304803
 		int cur_state;
304803
 
304803
+		pthread_cleanup_push(cache_lock_cleanup, mc);
304803
+
304803
 		if (!strchr(me->multi->key, '/'))
304803
 			/* Indirect multi-mount root */
304803
 			/* sprintf okay - if it's mounted, it's
304803
@@ -516,9 +516,11 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
304803
 		    (ap->entry->maps->flags & MAP_FLAG_FORMAT_AMD))
304803
 			cache_pop_mapent(me);
304803
 		pthread_setcancelstate(cur_state, NULL);
304803
+		pthread_cleanup_pop(0);
304803
 	}
304803
 
304803
-	pthread_cleanup_pop(1);
304803
+	if (me)
304803
+		cache_unlock(mc);
304803
 
304803
 	if (left || is_autofs_fs)
304803
 		return left;