~ubuntu-branches/ubuntu/precise/autofs5/precise

« back to all changes in this revision

Viewing changes to debian/patches/autofs-5.0.5-fix-master-map-source-server-unavialable-handling.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-03 14:35:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110703143546-nej26krjij0rf792
Tags: 5.0.6-0ubuntu1
* New upstream release:
  - Dropped upstream patches 
  - Refreshed debian/patches/17ld.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
autofs-5.0.5 - fix master map source server unavailable handling
2
 
 
3
 
From: Ian Kent <raven@themaw.net>
4
 
 
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.
10
 
---
11
 
 
12
 
 CHANGELOG             |    1 +
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(-)
19
 
 
20
 
 
21
 
diff --git a/CHANGELOG b/CHANGELOG
22
 
index d95542d..fc4e738 100644
23
 
--- a/CHANGELOG
24
 
+++ b/CHANGELOG
25
 
@@ -29,6 +29,7 @@
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.
30
 
 
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);
40
 
        }
41
 
-       master_mutex_unlock();
42
 
 
43
 
        if (clean) {
44
 
                if (rmdir(path) == -1) {
45
 
@@ -1497,7 +1496,9 @@ static void handle_mounts_cleanup(void *arg)
46
 
         */
47
 
        if (!submount)
48
 
                pthread_kill(state_mach_thid, SIGTERM);
49
 
-       
50
 
+
51
 
+       master_mutex_unlock();
52
 
+
53
 
        return;
54
 
 }
55
 
 
56
 
diff --git a/daemon/lookup.c b/daemon/lookup.c
57
 
index a4b9a80..8537861 100644
58
 
--- a/daemon/lookup.c
59
 
+++ b/daemon/lookup.c
60
 
@@ -157,6 +157,9 @@ int lookup_nss_read_master(struct master *master, time_t age)
61
 
                        result = do_read_master(master, "file", age);
62
 
                }
63
 
 
64
 
+               if (result == NSS_STATUS_UNAVAIL)
65
 
+                       master->read_fail = 1;
66
 
+
67
 
                return !result;
68
 
        } else {
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);
72
 
                                master->name = name;
73
 
 
74
 
+                               if (result == NSS_STATUS_UNAVAIL)
75
 
+                                       master->read_fail = 1;
76
 
+
77
 
                                return !result;
78
 
                        }
79
 
                }
80
 
@@ -248,6 +254,9 @@ int lookup_nss_read_master(struct master *master, time_t age)
81
 
                        continue;
82
 
                }
83
 
 
84
 
+               if (result == NSS_STATUS_UNAVAIL)
85
 
+                       master->read_fail = 1;
86
 
+
87
 
                status = check_nss_result(this, result);
88
 
                if (status >= 0) {
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 {
95
 
        unsigned int recurse;
96
 
        unsigned int depth;
97
 
        unsigned int reading;
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
104
 
--- a/lib/master.c
105
 
+++ b/lib/master.c
106
 
@@ -794,6 +794,7 @@ struct master *master_new(const char *name, unsigned int timeout, unsigned int g
107
 
        master->recurse = 0;
108
 
        master->depth = 0;
109
 
        master->reading = 0;
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)
115
 
        master_init_scan();
116
 
 
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);
121
 
+       else {
122
 
+               master->read_fail = 0;
123
 
+               if (!readall)
124
 
+                       master_mount_mounts(master, age, readall);
125
 
+       }
126
 
 
127
 
        master_mutex_lock();
128
 
 
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)
134
 
                        if (!status) {
135
 
                                warn(ap->logopt,
136
 
                                     "failed to read included map %s", key);
137
 
-                               fclose(f);
138
 
-                               return NSS_STATUS_UNAVAIL;
139
 
                        }
140
 
                } else {
141
 
                        char *s_key;