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

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