1
autofs-5.0.5 - fix master map source server unavailable handling
3
From: Ian Kent <raven@themaw.net>
5
If we get an NSS_STATUS_UNAVAIL from any server when trying to read
6
the master map we have no choice but to not update mounted automounts
7
because we can't know what entries may have come from the server that
8
isn't avialable. So we leave everything the way it is and wait until
9
the next re-read to update our mounts.
13
daemon/automount.c | 5 +++--
14
daemon/lookup.c | 9 +++++++++
15
include/master.h | 1 +
16
lib/master.c | 9 ++++++++-
17
modules/lookup_file.c | 2 --
18
6 files changed, 22 insertions(+), 5 deletions(-)
21
diff --git a/CHANGELOG b/CHANGELOG
22
index d95542d..fc4e738 100644
26
- add locality as valid ldap master map attribute.
27
- add locality as valid ldap master map attribute fix.
28
- add simple bind authentication.
29
+- fix master map source server unavailable handling.
31
03/09/2009 autofs-5.0.5
32
-----------------------
33
diff --git a/daemon/automount.c b/daemon/automount.c
34
index 7c44d4b..915928b 100644
35
--- a/daemon/automount.c
36
+++ b/daemon/automount.c
37
@@ -1478,7 +1478,6 @@ static void handle_mounts_cleanup(void *arg)
38
master_free_mapent_sources(ap->entry, 1);
39
master_free_mapent(ap->entry);
41
- master_mutex_unlock();
44
if (rmdir(path) == -1) {
45
@@ -1497,7 +1496,9 @@ static void handle_mounts_cleanup(void *arg)
48
pthread_kill(state_mach_thid, SIGTERM);
51
+ master_mutex_unlock();
56
diff --git a/daemon/lookup.c b/daemon/lookup.c
57
index a4b9a80..8537861 100644
60
@@ -157,6 +157,9 @@ int lookup_nss_read_master(struct master *master, time_t age)
61
result = do_read_master(master, "file", age);
64
+ if (result == NSS_STATUS_UNAVAIL)
65
+ master->read_fail = 1;
69
char *name = master->name;
70
@@ -194,6 +197,9 @@ int lookup_nss_read_master(struct master *master, time_t age)
71
result = do_read_master(master, source, age);
74
+ if (result == NSS_STATUS_UNAVAIL)
75
+ master->read_fail = 1;
80
@@ -248,6 +254,9 @@ int lookup_nss_read_master(struct master *master, time_t age)
84
+ if (result == NSS_STATUS_UNAVAIL)
85
+ master->read_fail = 1;
87
status = check_nss_result(this, result);
89
free_sources(&nsslist);
90
diff --git a/include/master.h b/include/master.h
91
index c519e97..0d6aa82 100644
92
--- a/include/master.h
93
+++ b/include/master.h
94
@@ -56,6 +56,7 @@ struct master {
98
+ unsigned int read_fail;
99
unsigned int default_ghost;
100
unsigned int default_logging;
101
unsigned int default_timeout;
102
diff --git a/lib/master.c b/lib/master.c
103
index 83019aa..196b6b9 100644
106
@@ -794,6 +794,7 @@ struct master *master_new(const char *name, unsigned int timeout, unsigned int g
110
+ master->read_fail = 0;
111
master->default_ghost = ghost;
112
master->default_timeout = timeout;
113
master->default_logging = defaults_get_logging();
114
@@ -821,7 +822,13 @@ int master_read_master(struct master *master, time_t age, int readall)
117
lookup_nss_read_master(master, age);
118
- master_mount_mounts(master, age, readall);
119
+ if (!master->read_fail)
120
+ master_mount_mounts(master, age, readall);
122
+ master->read_fail = 0;
124
+ master_mount_mounts(master, age, readall);
129
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
130
index e43ab2f..6104d0c 100644
131
--- a/modules/lookup_file.c
132
+++ b/modules/lookup_file.c
133
@@ -656,8 +656,6 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
136
"failed to read included map %s", key);
138
- return NSS_STATUS_UNAVAIL;