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

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