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

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