* [PATCH 1/2] autofs-5.0.5 - fix next task list update
2011-03-30 5:49 [PATCH 0/2] Series for the non-expiring mounts problem Ian Kent
@ 2011-03-30 5:49 ` Ian Kent
2011-03-30 5:49 ` [PATCH 2/2] autofs-5.0.5 - fix stale map read Ian Kent
2011-03-30 16:13 ` [PATCH 0/2] Series for the non-expiring mounts problem Leonardo Chiquitto
2 siblings, 0 replies; 5+ messages in thread
From: Ian Kent @ 2011-03-30 5:49 UTC (permalink / raw)
To: Leonardo Chiquitto; +Cc: autofs, Philip Ong Jr.
When the state queue task manager transfered an automount point pending
task to its task queue for execution the state queue as mistakenly being
seen as empty when the completing task was the only task in the state
queue.
---
CHANGELOG | 1 +
daemon/state.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 347d7d7..a9687b7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -62,6 +62,7 @@
- fix mountd vers retry.
- fix expire race.
- replace GPLv3 code.
+- fix next task list update.
03/09/2009 autofs-5.0.5
-----------------------
diff --git a/daemon/state.c b/daemon/state.c
index 38617c3..85587bd 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -1150,11 +1150,13 @@ remove:
next = list_entry((&task->pending)->next,
struct state_queue, pending);
- list_del_init(&next->pending);
- list_add_tail(&next->list, p);
-
list_del(&task->list);
free(task);
+
+ list_del_init(&next->pending);
+ list_add_tail(&next->list, head);
+ if (p == head)
+ p = head->next;
}
if (list_empty(head))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] autofs-5.0.5 - fix stale map read
2011-03-30 5:49 [PATCH 0/2] Series for the non-expiring mounts problem Ian Kent
2011-03-30 5:49 ` [PATCH 1/2] autofs-5.0.5 - fix next task list update Ian Kent
@ 2011-03-30 5:49 ` Ian Kent
2011-03-30 16:13 ` [PATCH 0/2] Series for the non-expiring mounts problem Leonardo Chiquitto
2 siblings, 0 replies; 5+ messages in thread
From: Ian Kent @ 2011-03-30 5:49 UTC (permalink / raw)
To: Leonardo Chiquitto; +Cc: autofs, Philip Ong Jr.
A previous patch to fix direct maps not updating on re-read has
a side effect of causing maps to always be re-read on lookup.
This is because, following the application of the previous patch,
the map stale status is no longer being updated on a successful
map read.
---
CHANGELOG | 1 +
daemon/lookup.c | 1 +
daemon/state.c | 1 -
include/master.h | 1 +
lib/master.c | 37 +++++++++++++++++++++++++------------
5 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index a9687b7..fcf9145 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -63,6 +63,7 @@
- fix expire race.
- replace GPLv3 code.
- fix next task list update.
+- fix stale map read.
03/09/2009 autofs-5.0.5
-----------------------
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 36e60c9..0f7051b 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -1139,6 +1139,7 @@ int lookup_prune_cache(struct autofs_point *ap, time_t age)
cache_readlock(map->mc);
lookup_prune_one_cache(ap, map->mc, age);
pthread_cleanup_pop(1);
+ clear_stale_instances(map);
map->stale = 0;
map = map->next;
}
diff --git a/daemon/state.c b/daemon/state.c
index 85587bd..3645440 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -501,7 +501,6 @@ static void *do_readmap(void *arg)
pthread_cleanup_pop(1);
pthread_cleanup_pop(1);
pthread_cleanup_pop(1);
- lookup_prune_cache(ap, now);
}
pthread_cleanup_pop(1);
diff --git a/include/master.h b/include/master.h
index bef59d3..1c1a7d5 100644
--- a/include/master.h
+++ b/include/master.h
@@ -89,6 +89,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 **);
+void clear_stale_instances(struct map_source *);
void send_map_update_request(struct autofs_point *);
void master_source_writelock(struct master_mapent *);
void master_source_readlock(struct master_mapent *);
diff --git a/lib/master.c b/lib/master.c
index 95bd3fb..4b48883 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -465,7 +465,26 @@ master_add_source_instance(struct map_source *source, const char *type, const ch
return new;
}
-static void check_stale_instances(struct map_source *source)
+static int check_stale_instances(struct map_source *source)
+{
+ struct map_source *map;
+
+ if (!source)
+ return 0;
+
+ map = source->instance;
+ while (map) {
+ if (map->stale)
+ return 1;
+ if (check_stale_instances(map))
+ return 1;
+ map = map->next;
+ }
+
+ return 0;
+}
+
+void clear_stale_instances(struct map_source *source)
{
struct map_source *map;
@@ -474,11 +493,9 @@ static void check_stale_instances(struct map_source *source)
map = source->instance;
while (map) {
- if (map->stale) {
- source->stale = 1;
- break;
- }
- check_stale_instances(map->instance);
+ clear_stale_instances(map);
+ if (map->stale)
+ map->stale = 0;
map = map->next;
}
@@ -496,12 +513,8 @@ void send_map_update_request(struct autofs_point *ap)
map = ap->entry->maps;
while (map) {
- check_stale_instances(map);
- map = map->next;
- }
-
- map = ap->entry->maps;
- while (map) {
+ if (check_stale_instances(map))
+ map->stale = 1;
if (map->stale) {
need_update = 1;
break;
^ permalink raw reply related [flat|nested] 5+ messages in thread