autofs-5.0.9 - check for non existent negative entries in lookup_ghost()
From: Ian Kent <raven@themaw.net>
Map entries that have been created in the cache due to a negative lookup
but don't exist in the map source shouldn't have directories created.
This can be detected by checking me->status.
For negative entries that are present in the map source me->status will
have been set to 0 in lookup_prune_one_cache() and negavive entries that
have been created in the same second as the map read will always have
me->status > 0 and so will also be skipped by lookup_ghost().
---
CHANGELOG | 1 +
daemon/lookup.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index 8c1da44..113dfb8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
- amd lookup update lookup hesiod to handle amd keys
- inadvertantly drop from initial series.
- fix wildcard key lookup.
+- check for non existent negative entries in lookup_ghost().
28/03/2014 autofs-5.0.9
=======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 999be9d..b4cdcce 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -716,6 +716,17 @@ int lookup_ghost(struct autofs_point *ap, const char *root)
cache_readlock(mc);
me = cache_enumerate(mc, NULL);
while (me) {
+ /*
+ * Map entries that have been created in the cache
+ * due to a negative lookup but don't exist in the
+ * map source shouldn't have directories created.
+ * me->status of negative entries that are present
+ * in the map source will have me->status set to 0
+ * in lookup_prune_one_cache().
+ */
+ if (me->status && !me->mapent)
+ goto next;
+
if (!strcmp(me->key, "*"))
goto next;
@@ -1339,7 +1350,10 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
if (valid)
cache_delete(mc, key);
- else if (!is_mounted(_PROC_MOUNTS, path, MNTS_AUTOFS)) {
+ else if (this->status) {
+ cache_unlock(mc);
+ goto next;
+ } else if (!is_mounted(_PROC_MOUNTS, path, MNTS_AUTOFS)) {
dev_t devid = ap->dev;
status = CHE_FAIL;
if (ap->type == LKP_DIRECT)