From 04fb98e5e7c8ec0df8313db713f0d6b59a040ced Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Wed, 12 Jul 2023 11:00:56 +0800 Subject: [PATCH] - add a fix for the "fix incorrect matching of cached wildcard key" patch. --- ...rect-matching-of-cached-wildcard-key.patch | 24 +++++++++++++++---- autofs.spec | 8 ++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/autofs-5.1.8-fix-incorrect-matching-of-cached-wildcard-key.patch b/autofs-5.1.8-fix-incorrect-matching-of-cached-wildcard-key.patch index 0ba5860..e1832f4 100644 --- a/autofs-5.1.8-fix-incorrect-matching-of-cached-wildcard-key.patch +++ b/autofs-5.1.8-fix-incorrect-matching-of-cached-wildcard-key.patch @@ -13,11 +13,16 @@ the wildcard key may be found during lookup but the map it blongs to isn't checked so it can be incorrectly returned instead of a matching entry in a subsequent included map. +Another problem case is when there's a wildcard match and a cache prune +occurs while the mount is being done. In this case the matched cache +entry that has been added is seen as stale and removed along with the +mount point directory during the prune leading to a mount fail. + Signed-off-by: Ian Kent --- CHANGELOG | 1 + - lib/parse_subs.c | 5 ++++- - 2 files changed, 5 insertions(+), 1 deletion(-) + lib/parse_subs.c | 9 +++++++-- + 2 files changed, 8 insertions(+), 2 deletions(-) --- autofs-5.1.4.orig/CHANGELOG +++ autofs-5.1.4/CHANGELOG @@ -38,9 +43,20 @@ Signed-off-by: Ian Kent - if (!me) + if (!me) { me = cache_lookup_distinct(mc, "*"); -+ if (me != source) -+ goto done; ++ if (me && (me->source != source)) ++ me = NULL; + } } if (!me) +@@ -545,7 +548,9 @@ struct mapent *match_cached_key(struct a + */ + if (!(ap->flags & MOUNT_FLAG_REMOUNT) && + ap->type == LKP_INDIRECT && *me->key == '*') { +- ret = cache_update(mc, source, key, me->mapent, me->age); ++ time_t now = monotonic_time(NULL); ++ ++ ret = cache_update(mc, source, key, me->mapent, now); + if (!(ret & (CHE_OK | CHE_UPDATED))) + me = NULL; + } diff --git a/autofs.spec b/autofs.spec index 248ddb2..5982213 100644 --- a/autofs.spec +++ b/autofs.spec @@ -8,7 +8,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.1.4 -Release: 107%{?dist} +Release: 108%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -784,6 +784,12 @@ fi %dir /etc/auto.master.d %changelog +* Wed Jul 12 2023 Ian Kent - 5.1.4-108 +- bz2216877 - When looking up included maps, sometimes autofs does not + consult all the included files in order + - fix the "fix incorrect matching of cached wildcard key" patch. +- Relates: rhbz#2216877 + * Wed Jul 05 2023 Ian Kent - 5.1.4-107 - bz2216877 - When looking up included maps, sometimes autofs does not consult all the included files in order