- add a fix for the "fix incorrect matching of cached wildcard key" patch.

This commit is contained in:
Ian Kent 2023-07-12 11:00:56 +08:00
parent c75ed87667
commit 04fb98e5e7
2 changed files with 27 additions and 5 deletions

View File

@ -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 <raven@themaw.net>
---
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 <raven@themaw.net>
- 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;
}

View File

@ -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 <ikent@redhat.com> - 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 <ikent@redhat.com> - 5.1.4-107
- bz2216877 - When looking up included maps, sometimes autofs does not
consult all the included files in order