|
|
d702dc |
autofs-5.1.6 - use a valid timeout in lookup_prune_one_cache()
|
|
|
d702dc |
|
|
|
d702dc |
From: Ian Kent <raven@themaw.net>
|
|
|
d702dc |
|
|
|
d702dc |
For a very long time the map entry cache has been allowed to grow
|
|
|
d702dc |
without pruning old entries until a map read is needed and there's
|
|
|
d702dc |
been a constant struggle to set the map stale only when really needed
|
|
|
d702dc |
so that in use entries aren't pruned.
|
|
|
d702dc |
|
|
|
d702dc |
But somewhere along the line that's become broken and the sss error
|
|
|
d702dc |
handling updates don't work properly because of this (or rather don't
|
|
|
d702dc |
work well).
|
|
|
d702dc |
|
|
|
d702dc |
Add a positive map entry cache timeout so that recently seen map
|
|
|
d702dc |
entries don't get removed in the map read following the lookup that
|
|
|
d702dc |
added them when the map isn't actually read such as with nobrowse
|
|
|
d702dc |
indirect mounts.
|
|
|
d702dc |
|
|
|
d702dc |
The valid timeout probably should become configurable at some point
|
|
|
d702dc |
too.
|
|
|
d702dc |
|
|
|
d702dc |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
d702dc |
---
|
|
|
d702dc |
CHANGELOG | 1 +
|
|
|
d702dc |
daemon/lookup.c | 15 +++++++++++++++
|
|
|
d702dc |
include/automount.h | 1 +
|
|
|
d702dc |
3 files changed, 17 insertions(+)
|
|
|
d702dc |
|
|
|
d702dc |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
d702dc |
index 309def2..3608345 100644
|
|
|
d702dc |
--- a/CHANGELOG
|
|
|
d702dc |
+++ b/CHANGELOG
|
|
|
d702dc |
@@ -108,6 +108,7 @@ xx/xx/2018 autofs-5.1.5
|
|
|
d702dc |
- update sss timeout documentation.
|
|
|
d702dc |
- refactor sss getautomntbyname().
|
|
|
d702dc |
- improve sss getautomntbyname() error handling.
|
|
|
d702dc |
+- use a valid timeout in lookup_prune_one_cache().
|
|
|
d702dc |
|
|
|
d702dc |
19/12/2017 autofs-5.1.4
|
|
|
d702dc |
- fix spec file url.
|
|
|
d702dc |
diff --git a/daemon/lookup.c b/daemon/lookup.c
|
|
|
d702dc |
index 2b9c7e8..8bf1335 100644
|
|
|
d702dc |
--- a/daemon/lookup.c
|
|
|
d702dc |
+++ b/daemon/lookup.c
|
|
|
d702dc |
@@ -1354,6 +1354,21 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
|
|
|
d702dc |
continue;
|
|
|
d702dc |
}
|
|
|
d702dc |
|
|
|
d702dc |
+ if (ap->type == LKP_INDIRECT) {
|
|
|
d702dc |
+ /* If the map hasn't been read (nobrowse
|
|
|
d702dc |
+ * indirect mounts) then keep cached entries
|
|
|
d702dc |
+ * for POSITIVE_TIMEOUT.
|
|
|
d702dc |
+ */
|
|
|
d702dc |
+ if (!(ap->flags & (MOUNT_FLAG_GHOST |
|
|
|
d702dc |
+ MOUNT_FLAG_AMD_CACHE_ALL))) {
|
|
|
d702dc |
+ time_t until = me->age + POSITIVE_TIMEOUT;
|
|
|
d702dc |
+ if ((long) age - (long) until < 0) {
|
|
|
d702dc |
+ me = cache_enumerate(mc, me);
|
|
|
d702dc |
+ continue;
|
|
|
d702dc |
+ }
|
|
|
d702dc |
+ }
|
|
|
d702dc |
+ }
|
|
|
d702dc |
+
|
|
|
d702dc |
key = strdup(me->key);
|
|
|
d702dc |
me = cache_enumerate(mc, me);
|
|
|
d702dc |
/* Don't consider any entries with a wildcard */
|
|
|
d702dc |
diff --git a/include/automount.h b/include/automount.h
|
|
|
d702dc |
index 49c9ff9..bb264a1 100644
|
|
|
d702dc |
--- a/include/automount.h
|
|
|
d702dc |
+++ b/include/automount.h
|
|
|
d702dc |
@@ -139,6 +139,7 @@ struct autofs_point;
|
|
|
d702dc |
|
|
|
d702dc |
#define NULL_MAP_HASHSIZE 64
|
|
|
d702dc |
#define NEGATIVE_TIMEOUT 10
|
|
|
d702dc |
+#define POSITIVE_TIMEOUT 120
|
|
|
d702dc |
#define UMOUNT_RETRIES 8
|
|
|
d702dc |
#define EXPIRE_RETRIES 3
|
|
|
d702dc |
|