Blame SOURCES/autofs-5.1.7-fix-lookup_prune_one_cache-refactoring-change.patch

29d2b9
autofs-5.1.7 - fix lookup_prune_one_cache() refactoring change
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
Commit 256963d6b (autofs-5.1.7 - refactor lookup_prune_one_cache() a bit)
29d2b9
changed the position of the getting the next enumeration map entry but
29d2b9
failed to update a couple of other locations that assume the next map
29d2b9
entry has been set. Under certain fairly common conditions this leads
29d2b9
to an infinite loop.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG       |    1 +
29d2b9
 daemon/lookup.c |    5 ++++-
29d2b9
 2 files changed, 5 insertions(+), 1 deletion(-)
29d2b9
29d2b9
--- autofs-5.1.7.orig/CHANGELOG
29d2b9
+++ autofs-5.1.7/CHANGELOG
29d2b9
@@ -74,6 +74,7 @@
29d2b9
 - eliminate redundant cache lookup in tree_mapent_add_node().
29d2b9
 - fix hosts map offset order.
29d2b9
 - fix direct mount deadlock.
29d2b9
+- fix lookup_prune_one_cache() refactoring change.
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
--- autofs-5.1.7.orig/daemon/lookup.c
29d2b9
+++ autofs-5.1.7/daemon/lookup.c
29d2b9
@@ -1379,6 +1379,7 @@ void lookup_prune_one_cache(struct autof
29d2b9
 		if (!key || strchr(key, '*')) {
29d2b9
 			if (key)
29d2b9
 				free(key);
29d2b9
+			me = cache_enumerate(mc, me);
29d2b9
 			continue;
29d2b9
 		}
29d2b9
 
29d2b9
@@ -1386,6 +1387,7 @@ void lookup_prune_one_cache(struct autof
29d2b9
 		if (!path) {
29d2b9
 			warn(ap->logopt, "can't malloc storage for path");
29d2b9
 			free(key);
29d2b9
+			me = cache_enumerate(mc, me);
29d2b9
 			continue;
29d2b9
 		}
29d2b9
 
29d2b9
@@ -1413,9 +1415,10 @@ void lookup_prune_one_cache(struct autof
29d2b9
 		}
29d2b9
 		if (!valid &&
29d2b9
 		    is_mounted(path, MNTS_REAL)) {
29d2b9
-			debug(ap->logopt, "prune posponed, %s mounted", path);
29d2b9
+			debug(ap->logopt, "prune postponed, %s mounted", path);
29d2b9
 			free(key);
29d2b9
 			free(path);
29d2b9
+			me = cache_enumerate(mc, me);
29d2b9
 			continue;
29d2b9
 		}
29d2b9
 		if (valid)