|
|
aea863 |
autofs-5.1.4 - mark removed cache entry negative
|
|
|
aea863 |
|
|
|
aea863 |
From: Ian Kent <raven@themaw.net>
|
|
|
aea863 |
|
|
|
aea863 |
When re-reading a map entries that have been removed are detected
|
|
|
aea863 |
and deleted from the map entry cache by lookup_prune_cache().
|
|
|
aea863 |
|
|
|
aea863 |
If a removed map entry is mounted at the time lookup_prune_cache()
|
|
|
aea863 |
is called the map entry is skippedi. This is done becuase the next
|
|
|
aea863 |
lookup (following the mount expire, which needs the cache entry to
|
|
|
aea863 |
remain) will detect the stale cache entry and a map update done
|
|
|
aea863 |
resulting in the istale entry being removed.
|
|
|
aea863 |
|
|
|
aea863 |
But if a map re-read is performed while the cache entry is mounted
|
|
|
aea863 |
the cache will appear to up to date so the removed entry will remain
|
|
|
aea863 |
valid even after it has expired.
|
|
|
aea863 |
|
|
|
aea863 |
To cover this case it's sufficient to mark the mounted cache entry
|
|
|
aea863 |
negative during the cache prune which prevent further lookups from
|
|
|
aea863 |
using the stale entry.
|
|
|
aea863 |
|
|
|
aea863 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
aea863 |
---
|
|
|
aea863 |
CHANGELOG | 1 +
|
|
|
aea863 |
daemon/lookup.c | 12 +++++++++---
|
|
|
aea863 |
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
aea863 |
|
|
|
aea863 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
aea863 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
aea863 |
@@ -29,6 +29,7 @@ xx/xx/2018 autofs-5.1.5
|
|
|
aea863 |
- covarity fixes.
|
|
|
aea863 |
- fix program usage message.
|
|
|
aea863 |
- fix update_negative_cache() map source usage.
|
|
|
aea863 |
+- mark removed cache entry negative.
|
|
|
aea863 |
|
|
|
aea863 |
19/12/2017 autofs-5.1.4
|
|
|
aea863 |
- fix spec file url.
|
|
|
aea863 |
--- autofs-5.1.4.orig/daemon/lookup.c
|
|
|
aea863 |
+++ autofs-5.1.4/daemon/lookup.c
|
|
|
aea863 |
@@ -1417,15 +1417,21 @@ void lookup_prune_one_cache(struct autof
|
|
|
aea863 |
if (valid && valid->mc == mc) {
|
|
|
aea863 |
/*
|
|
|
aea863 |
* We've found a map entry that has been removed from
|
|
|
aea863 |
- * the current cache so it isn't really valid.
|
|
|
aea863 |
+ * the current cache so it isn't really valid. Set the
|
|
|
aea863 |
+ * mapent negative to prevent further mount requests
|
|
|
aea863 |
+ * using the cache entry.
|
|
|
aea863 |
*/
|
|
|
aea863 |
+ debug(ap->logopt, "removed map entry detected, mark negative");
|
|
|
aea863 |
+ if (valid->mapent) {
|
|
|
aea863 |
+ free(valid->mapent);
|
|
|
aea863 |
+ valid->mapent = NULL;
|
|
|
aea863 |
+ }
|
|
|
aea863 |
cache_unlock(valid->mc);
|
|
|
aea863 |
valid = NULL;
|
|
|
aea863 |
}
|
|
|
aea863 |
if (!valid &&
|
|
|
aea863 |
is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
|
|
|
aea863 |
- debug(ap->logopt,
|
|
|
aea863 |
- "prune check posponed, %s mounted", path);
|
|
|
aea863 |
+ debug(ap->logopt, "prune posponed, %s mounted", path);
|
|
|
aea863 |
free(key);
|
|
|
aea863 |
free(path);
|
|
|
aea863 |
continue;
|