Skip to contentSkip to conversation

Series for the non-expiring mounts problem

PATCH In review Ian Kent 3 participants 5 messages Mar 30, 2011 – Apr 29, 2011

Subsystems (2)
lore
Share & tools
lore

Ian Kent

author maintainer
#0 lore raw

cover Series for the non-expiring mounts problem

These two patches should fix the problem you reported where a USR1 signal fails to trigger an expire. They should also fix the unnecessary map reload problem.

Please test these for me.

---

Ian Kent (2):
autofs-5.0.5 - fix stale map read
autofs-5.0.5 - fix next task list update

 CHANGELOG        |    2 ++
 daemon/lookup.c  |    1 +
 daemon/state.c   |    9 +++++----
 include/master.h |    1 +
 lib/master.c     |   37 +++++++++++++++++++++++++------------
 5 files changed, 34 insertions(+), 16 deletions(-)
Signature · 1 line
Ian
author maintainer
#1 lore raw

PATCH 1/2 autofs-5.0.5 - fix next task list update

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(-)
CHANGELOG +1 -0
index 347d7d7..a9687b7 100644
@@ -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
 -----------------------
daemon/state.c +5 -3
index 38617c3..85587bd 100644
@@ -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))
author maintainer
#2 lore raw

PATCH 2/2 autofs-5.0.5 - fix stale map read

In reply to Ian Kent

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(-)
CHANGELOG +1 -0
index a9687b7..fcf9145 100644
@@ -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
 -----------------------
daemon/lookup.c +1 -0
index 36e60c9..0f7051b 100644
@@ -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;
 	}
daemon/state.c +0 -1
index 85587bd..3645440 100644
@@ -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);
include/master.h +1 -0
index bef59d3..1c1a7d5 100644
@@ -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 *);
lib/master.c +25 -12
index 95bd3fb..4b48883 100644
@@ -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;
#3 lore raw
In reply to Ian Kent
Quoted 5 lines · Ian Kent

These two patches should fix the problem you reported where a USR1 signal fails to trigger an expire. They should also fix the unnecessary map reload problem.

Please test these for me.

Ian, thanks for the patches. I just tested them here and confirm that the problem is resolved. I tested direct and indirect mounts letting them expire after the default timeout and forcing the expiration with SIGUSR1.

I also confirmed that the "unmountable directories" problem reported in
http://linux.kernel.org/pipermail/autofs/2011-March/006509.html is fixed as well (the patch I suggested back then is *not* needed).

Thanks,
Leonardo

Quoted 16 lines

---

Ian Kent (2):
     autofs-5.0.5 - fix stale map read
     autofs-5.0.5 - fix next task list update

 CHANGELOG        |    2 ++
 daemon/lookup.c  |    1 +
 daemon/state.c   |    9 +++++----
 include/master.h |    1 +
 lib/master.c     |   37 +++++++++++++++++++++++++------------

 5 files changed, 34 insertions(+), 16 deletions(-)

--
Ian

#4 lore raw

Have the patches been released yet?

Quoted 33 lines · Leonardo Chiquitto
Quoted 5 lines · Ian Kent

These two patches should fix the problem you reported where a USR1 signal fails to trigger an expire. They should also fix the unnecessary map reload problem.

Please test these for me.

Ian, thanks for the patches. I just tested them here and confirm that the problem is resolved. I tested direct and indirect mounts letting them expire after the default timeout and forcing the expiration with SIGUSR1.

I also confirmed that the "unmountable directories" problem reported in
http://linux.kernel.org/pipermail/autofs/2011-March/006509.html is fixed as well (the patch I suggested back then is *not* needed).

Thanks,
Leonardo

Quoted 16 lines

---

Ian Kent (2):
autofs-5.0.5 - fix stale map read
autofs-5.0.5 - fix next task list update

  CHANGELOG        |    2 ++
  daemon/lookup.c  |    1 +
  daemon/state.c   |    9 +++++----
  include/master.h |    1 +
  lib/master.c     |   37 +++++++++++++++++++++++++------------
  5 files changed, 34 insertions(+), 16 deletions(-)

--
Ian