Blame SOURCES/autofs-5.1.6-fix-program-map-multi-mount-lookup-after-mount-fail.patch

49b67f
autofs-5.1.6 - fix program map multi-mount lookup after mount fail
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
For the case of a singleton multi-mount program map lookup following
49b67f
a mount fail (and the negative timeout has passed) the lookup key is
49b67f
what's expected for an indirect map key but the the root offset map
49b67f
entry already exists. This causes autofs to think it has an incorrect
49b67f
lookup key and it fails the lookup when it should take the opptunity
49b67f
to delete and update the cache entry since it's not actually in use
49b67f
yet.
49b67f
49b67f
If a check is done to see if the lookup is for the root offset,
49b67f
deleting the entry fails because it contains an offset. Later when
49b67f
parsing is done the offset will get updated and can get out of sync
49b67f
with the entry of the multi-mount owner. That's not a problem as the
49b67f
offsets would be deleted on eventual expire but it's best to clean
49b67f
out the entry and start a fresh so the most up to date map entry
49b67f
is being used.
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG                |    1 +
49b67f
 modules/lookup_program.c |    7 +++++--
49b67f
 2 files changed, 6 insertions(+), 2 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -27,6 +27,7 @@
49b67f
 - rename path to m_offset in update_offset_entry().
49b67f
 - don't pass root to do_mount_autofs_offset().
49b67f
 - rename tree implementation functions.
49b67f
+- fix program map multi-mount lookup after mount fail.
49b67f
 
49b67f
 xx/xx/2018 autofs-5.1.5
49b67f
 - fix flag file permission.
49b67f
--- autofs-5.1.4.orig/modules/lookup_program.c
49b67f
+++ autofs-5.1.4/modules/lookup_program.c
49b67f
@@ -664,7 +664,7 @@ int lookup_mount(struct autofs_point *ap
49b67f
 				 name_len, ent, ctxt->parse->context);
49b67f
 			goto out_free;
49b67f
 		} else {
49b67f
-			if (me->multi) {
49b67f
+			if (me->multi && me->multi != me) {
49b67f
 				cache_unlock(mc);
49b67f
 				warn(ap->logopt, MODPREFIX
49b67f
 				     "unexpected lookup for active multi-mount"
49b67f
@@ -674,8 +674,11 @@ int lookup_mount(struct autofs_point *ap
49b67f
 			cache_unlock(mc);
49b67f
 			cache_writelock(mc);
49b67f
 			me = cache_lookup_distinct(mc, name);
49b67f
-			if (me)
49b67f
+			if (me) {
49b67f
+				if (me->multi)
49b67f
+					cache_delete_offset_list(mc, name);
49b67f
 				cache_delete(mc, name);
49b67f
+			}
49b67f
 			cache_unlock(mc);
49b67f
 		}
49b67f
 	}