autofs-5.0.9 - check for non existent negative entries in lookup_ghost() From: Ian Kent 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 cb63e22..65ebe09 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ ??/??/2014 autofs-5.0.10 ======================== - fix mistake in assignment. +- 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 d6d9af9..3665fca 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -668,6 +668,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; @@ -1205,7 +1216,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)