diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
commit | 1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch) | |
tree | 0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch | |
download | meta-openembedded-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch')
-rw-r--r-- | meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch | 225 |
1 files changed, 225 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch new file mode 100644 index 0000000000..44e4a18e32 --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-fix-wildcard-multi-map-regression.patch | |||
@@ -0,0 +1,225 @@ | |||
1 | autofs-5.0.7 - fix wildcard multi map regression | ||
2 | |||
3 | From: Ian Kent <raven@themaw.net> | ||
4 | |||
5 | A recent patch that removed code to add the current map entry when | ||
6 | being parsed if it didn't already exist cause wildcard indirect | ||
7 | multi-mount map entries to fail to mount. | ||
8 | |||
9 | Indirect multi-mount map entries need the entry matched by a wildcard | ||
10 | lookup to be added to the map entry cache because subsequent operations | ||
11 | expect a distinct map entry to be present or they will fail. This is | ||
12 | what the code that was removed did but it did so in the wrong place | ||
13 | which caused a deadlock situation. | ||
14 | --- | ||
15 | CHANGELOG | 1 + | ||
16 | modules/lookup_file.c | 23 ++++++++++++++++------- | ||
17 | modules/lookup_ldap.c | 19 +++++++++++++++---- | ||
18 | modules/lookup_nisplus.c | 21 ++++++++++++++++----- | ||
19 | modules/lookup_sss.c | 17 ++++++++++++++--- | ||
20 | modules/lookup_yp.c | 21 ++++++++++++++++----- | ||
21 | 6 files changed, 78 insertions(+), 24 deletions(-) | ||
22 | |||
23 | diff --git a/CHANGELOG b/CHANGELOG | ||
24 | index 97d6f48..46ef335 100644 | ||
25 | --- a/CHANGELOG | ||
26 | +++ b/CHANGELOG | ||
27 | @@ -29,6 +29,7 @@ | ||
28 | - modules/replicated.c: use sin6_addr.s6_addr32. | ||
29 | - workaround missing GNU versionsort extension. | ||
30 | - dont fail on master map self include. | ||
31 | +- fix wildcard multi map regression. | ||
32 | |||
33 | 25/07/2012 autofs-5.0.7 | ||
34 | ======================= | ||
35 | diff --git a/modules/lookup_file.c b/modules/lookup_file.c | ||
36 | index f37bed9..65e5ee6 100644 | ||
37 | --- a/modules/lookup_file.c | ||
38 | +++ b/modules/lookup_file.c | ||
39 | @@ -1040,7 +1040,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
40 | return NSS_STATUS_UNAVAIL; | ||
41 | } | ||
42 | |||
43 | - cache_readlock(mc); | ||
44 | + cache_writelock(mc); | ||
45 | me = cache_lookup_first(mc); | ||
46 | if (me && st.st_mtime <= me->age) { | ||
47 | /* | ||
48 | @@ -1082,7 +1082,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
49 | } | ||
50 | } | ||
51 | |||
52 | - cache_readlock(mc); | ||
53 | + cache_writelock(mc); | ||
54 | do_cache_lookup: | ||
55 | me = cache_lookup(mc, key); | ||
56 | /* | ||
57 | @@ -1098,11 +1098,20 @@ do_cache_lookup: | ||
58 | if (!me) | ||
59 | me = cache_lookup_distinct(mc, "*"); | ||
60 | } | ||
61 | - if (me && me->mapent && (me->source == source || *me->key == '/')) { | ||
62 | - pthread_cleanup_push(cache_lock_cleanup, mc); | ||
63 | - strcpy(mapent_buf, me->mapent); | ||
64 | - mapent = mapent_buf; | ||
65 | - pthread_cleanup_pop(0); | ||
66 | + if (me && me->mapent) { | ||
67 | + /* | ||
68 | + * Add wildcard match for later validation checks and | ||
69 | + * negative cache lookups. | ||
70 | + */ | ||
71 | + if (ap->type == LKP_INDIRECT && *me->key == '*') { | ||
72 | + ret = cache_update(mc, source, key, me->mapent, me->age); | ||
73 | + if (!(ret & (CHE_OK | CHE_UPDATED))) | ||
74 | + me = NULL; | ||
75 | + } | ||
76 | + if (me && (me->source == source || *me->key == '/')) { | ||
77 | + strcpy(mapent_buf, me->mapent); | ||
78 | + mapent = mapent_buf; | ||
79 | + } | ||
80 | } | ||
81 | cache_unlock(mc); | ||
82 | |||
83 | diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c | ||
84 | index 431e50d..83e3215 100644 | ||
85 | --- a/modules/lookup_ldap.c | ||
86 | +++ b/modules/lookup_ldap.c | ||
87 | @@ -2969,7 +2969,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
88 | return status; | ||
89 | } | ||
90 | |||
91 | - cache_readlock(mc); | ||
92 | + cache_writelock(mc); | ||
93 | me = cache_lookup(mc, key); | ||
94 | /* Stale mapent => check for entry in alternate source or wildcard */ | ||
95 | if (me && !me->mapent) { | ||
96 | @@ -2979,9 +2979,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
97 | if (!me) | ||
98 | me = cache_lookup_distinct(mc, "*"); | ||
99 | } | ||
100 | - if (me && me->mapent && (me->source == source || *me->key == '/')) { | ||
101 | - strcpy(mapent_buf, me->mapent); | ||
102 | - mapent = mapent_buf; | ||
103 | + if (me && me->mapent) { | ||
104 | + /* | ||
105 | + * Add wildcard match for later validation checks and | ||
106 | + * negative cache lookups. | ||
107 | + */ | ||
108 | + if (ap->type == LKP_INDIRECT && *me->key == '*') { | ||
109 | + ret = cache_update(mc, source, key, me->mapent, me->age); | ||
110 | + if (!(ret & (CHE_OK | CHE_UPDATED))) | ||
111 | + me = NULL; | ||
112 | + } | ||
113 | + if (me && (me->source == source || *me->key == '/')) { | ||
114 | + strcpy(mapent_buf, me->mapent); | ||
115 | + mapent = mapent_buf; | ||
116 | + } | ||
117 | } | ||
118 | cache_unlock(mc); | ||
119 | |||
120 | diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c | ||
121 | index 9fced96..8237a1e 100644 | ||
122 | --- a/modules/lookup_nisplus.c | ||
123 | +++ b/modules/lookup_nisplus.c | ||
124 | @@ -561,7 +561,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
125 | return status; | ||
126 | } | ||
127 | |||
128 | - cache_readlock(mc); | ||
129 | + cache_writelock(mc); | ||
130 | me = cache_lookup(mc, key); | ||
131 | /* Stale mapent => check for entry in alternate source or wildcard */ | ||
132 | if (me && !me->mapent) { | ||
133 | @@ -571,10 +571,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
134 | if (!me) | ||
135 | me = cache_lookup_distinct(mc, "*"); | ||
136 | } | ||
137 | - if (me && me->mapent && (me->source == source || *me->key == '/')) { | ||
138 | - mapent_len = strlen(me->mapent); | ||
139 | - mapent = malloc(mapent_len + 1); | ||
140 | - strcpy(mapent, me->mapent); | ||
141 | + if (me && me->mapent) { | ||
142 | + /* | ||
143 | + * Add wildcard match for later validation checks and | ||
144 | + * negative cache lookups. | ||
145 | + */ | ||
146 | + if (ap->type == LKP_INDIRECT && *me->key == '*') { | ||
147 | + ret = cache_update(mc, source, key, me->mapent, me->age); | ||
148 | + if (!(ret & (CHE_OK | CHE_UPDATED))) | ||
149 | + me = NULL; | ||
150 | + } | ||
151 | + if (me && (me->source == source || *me->key == '/')) { | ||
152 | + mapent_len = strlen(me->mapent); | ||
153 | + mapent = malloc(mapent_len + 1); | ||
154 | + strcpy(mapent, me->mapent); | ||
155 | + } | ||
156 | } | ||
157 | cache_unlock(mc); | ||
158 | |||
159 | diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c | ||
160 | index e0b84cc..5c2ed0a 100644 | ||
161 | --- a/modules/lookup_sss.c | ||
162 | +++ b/modules/lookup_sss.c | ||
163 | @@ -645,9 +645,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
164 | if (!me) | ||
165 | me = cache_lookup_distinct(mc, "*"); | ||
166 | } | ||
167 | - if (me && me->mapent && (me->source == source || *me->key == '/')) { | ||
168 | - strcpy(mapent_buf, me->mapent); | ||
169 | - mapent = mapent_buf; | ||
170 | + if (me && me->mapent) { | ||
171 | + /* | ||
172 | + * Add wildcard match for later validation checks and | ||
173 | + * negative cache lookups. | ||
174 | + */ | ||
175 | + if (ap->type == LKP_INDIRECT && *me->key == '*') { | ||
176 | + ret = cache_update(mc, source, key, me->mapent, me->age); | ||
177 | + if (!(ret & (CHE_OK | CHE_UPDATED))) | ||
178 | + me = NULL; | ||
179 | + } | ||
180 | + if (me && (me->source == source || *me->key == '/')) { | ||
181 | + strcpy(mapent_buf, me->mapent); | ||
182 | + mapent = mapent_buf; | ||
183 | + } | ||
184 | } | ||
185 | cache_unlock(mc); | ||
186 | |||
187 | diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c | ||
188 | index 720df2e..a716e1f 100644 | ||
189 | --- a/modules/lookup_yp.c | ||
190 | +++ b/modules/lookup_yp.c | ||
191 | @@ -662,7 +662,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
192 | return status; | ||
193 | } | ||
194 | |||
195 | - cache_readlock(mc); | ||
196 | + cache_writelock(mc); | ||
197 | me = cache_lookup(mc, key); | ||
198 | /* Stale mapent => check for entry in alternate source or wildcard */ | ||
199 | if (me && !me->mapent) { | ||
200 | @@ -672,10 +672,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * | ||
201 | if (!me) | ||
202 | me = cache_lookup_distinct(mc, "*"); | ||
203 | } | ||
204 | - if (me && me->mapent && (me->source == source || *me->key == '/')) { | ||
205 | - mapent_len = strlen(me->mapent); | ||
206 | - mapent = alloca(mapent_len + 1); | ||
207 | - strcpy(mapent, me->mapent); | ||
208 | + if (me && me->mapent) { | ||
209 | + /* | ||
210 | + * Add wildcard match for later validation checks and | ||
211 | + * negative cache lookups. | ||
212 | + */ | ||
213 | + if (ap->type == LKP_INDIRECT && *me->key == '*') { | ||
214 | + ret = cache_update(mc, source, key, me->mapent, me->age); | ||
215 | + if (!(ret & (CHE_OK | CHE_UPDATED))) | ||
216 | + me = NULL; | ||
217 | + } | ||
218 | + if (me && (me->source == source || *me->key == '/')) { | ||
219 | + mapent_len = strlen(me->mapent); | ||
220 | + mapent = alloca(mapent_len + 1); | ||
221 | + strcpy(mapent, me->mapent); | ||
222 | + } | ||
223 | } | ||
224 | cache_unlock(mc); | ||
225 | |||