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

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