File autofs-5-1-3-check-map-instances-for-staleness-on-map-update.patch of Package autofs.6209
From: Ian Kent <raven@themaw.net>
Subject: autofs-5.1.3 - check map instances for staleness on map update
Git-commit: 3823e051ecd31c06fdb1c4390860178a32898b2b
Patch-mainline: 5.1.4
References: bsc#1038198
When there are multiple map source instances bypassing the cache update
when any one of the map sources returns NSS_STATUS_UNAVAIL is too strong.
When the map is marked not stale also check the instances before skipping
the cache update.
Signed-off-by: Ian Kent <raven@themaw.net>
Acked-by: Jeff Mahoney <jeffm@suse.com>
---
daemon/lookup.c | 5 +++--
daemon/state.c | 2 +-
include/master.h | 1 +
lib/master.c | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -603,7 +603,8 @@ int lookup_nss_read_map(struct autofs_po
if (result == NSS_STATUS_UNKNOWN)
continue;
- /* Don't try to update the map cache if it's unavailable */
+ /* Try to avoid updating the map cache if an instance
+ * is unavailable */
if (result == NSS_STATUS_UNAVAIL)
map->stale = 0;
@@ -1254,7 +1255,7 @@ int lookup_prune_cache(struct autofs_poi
map = entry->maps;
while (map) {
/* Is the map stale */
- if (!map->stale) {
+ if (!map->stale && !check_stale_instances(map)) {
map = map->next;
continue;
}
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -499,7 +499,7 @@ static void *do_readmap(void *arg)
map = ap->entry->maps;
while (map) {
/* Is map source up to date or no longer valid */
- if (!map->stale) {
+ if (!map->stale && !check_stale_instances(map)) {
map = map->next;
continue;
}
--- a/include/master.h
+++ b/include/master.h
@@ -90,6 +90,7 @@ struct map_source *
master_find_source_instance(struct map_source *, const char *, const char *, int, const char **);
struct map_source *
master_add_source_instance(struct map_source *, const char *, const char *, time_t, int, const char **);
+int check_stale_instances(struct map_source *);
void clear_stale_instances(struct map_source *);
void send_map_update_request(struct autofs_point *);
void master_source_writelock(struct master_mapent *);
--- a/lib/master.c
+++ b/lib/master.c
@@ -468,7 +468,7 @@ master_add_source_instance(struct map_so
return new;
}
-static int check_stale_instances(struct map_source *source)
+int check_stale_instances(struct map_source *source)
{
struct map_source *map;