6bbd11
autofs-5.0.9 - fix amd entry not found at expire
6bbd11
6bbd11
From: Ian Kent <raven@themaw.net>
6bbd11
6bbd11
Due to the way amd matches keys in its map it's possible that
6bbd11
distinct key entries aren't present in the map.
6bbd11
6bbd11
The indirect mount expire procedure needs to lookup cache entries
6bbd11
for offset mounts in order to get the control file handle needed
6bbd11
to send an expire check to them.
6bbd11
6bbd11
So we need to make sure that when a distinct match isn't found
6bbd11
an expire check is still done. That's OK because the mounts in
6bbd11
the expire list are under the autofs directory so they should
6bbd11
be checked and the ap control file handle can be used for it.
6bbd11
---
6bbd11
 daemon/indirect.c |   12 +++++-------
6bbd11
 1 file changed, 5 insertions(+), 7 deletions(-)
6bbd11
6bbd11
diff --git a/daemon/indirect.c b/daemon/indirect.c
6bbd11
index 6dfbd25..a04a624 100644
6bbd11
--- a/daemon/indirect.c
6bbd11
+++ b/daemon/indirect.c
6bbd11
@@ -513,15 +513,13 @@ void *expire_proc_indirect(void *arg)
6bbd11
 		if (!me && ind_key)
6bbd11
 			me = lookup_source_mapent(ap, ind_key, LKP_NORMAL);
6bbd11
 		pthread_cleanup_pop(1);
6bbd11
-		if (!me)
6bbd11
-			continue;
6bbd11
 
6bbd11
-		if (*me->key == '/') {
6bbd11
-			ioctlfd = me->ioctlfd;
6bbd11
-		} else {
6bbd11
-			ioctlfd = ap->ioctlfd;
6bbd11
+		ioctlfd = ap->ioctlfd;
6bbd11
+		if (me) {
6bbd11
+			if (*me->key == '/')
6bbd11
+				ioctlfd = me->ioctlfd;
6bbd11
+			cache_unlock(me->mc);
6bbd11
 		}
6bbd11
-		cache_unlock(me->mc);
6bbd11
 
6bbd11
 		debug(ap->logopt, "expire %s", next->path);
6bbd11