Gentoo Archives: gentoo-commits

From: "Christian Zoffoli (xmerlin)" <xmerlin@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-cluster/openais/files: openais-0.80.3-Makefile.inc-VARS.patch openais-0.80.3-r1661.patch openais-0.80.3-Makefile-VARS.patch
Date: Fri, 21 Nov 2008 22:56:03
Message-Id: E1L3euj-0005zP-5b@stork.gentoo.org
1 xmerlin 08/11/21 22:55:49
2
3 Added: openais-0.80.3-Makefile.inc-VARS.patch
4 openais-0.80.3-r1661.patch
5 openais-0.80.3-Makefile-VARS.patch
6 Log:
7 openais whitetank updated to r1661.
8 (Portage version: 2.1.4.4)
9
10 Revision Changes Path
11 1.1 sys-cluster/openais/files/openais-0.80.3-Makefile.inc-VARS.patch
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-Makefile.inc-VARS.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-Makefile.inc-VARS.patch?rev=1.1&content-type=text/plain
15
16 Index: openais-0.80.3-Makefile.inc-VARS.patch
17 ===================================================================
18 --- openais-0.80.3/Makefile.inc.orig 2008-11-18 19:31:13.000000000 +0100
19 +++ openais-0.80.3/Makefile.inc 2008-11-18 19:32:11.000000000 +0100
20 @@ -29,12 +29,17 @@
21 # THE POSSIBILITY OF SUCH DAMAGE.
22 # Basic OS detection
23 #
24 +CP=cp
25 +DESTDIR=
26 +PREFIX=/usr
27 UNAME=$(shell uname)
28 +LCRSODIR=$(PREFIX)/libexec/lcrso
29
30 ifeq "$(UNAME)" "Linux"
31 OPENAIS_COMPAT=LINUX
32 endif
33 ifeq "$(UNAME)" "Darwin"
34 + CP=rsync
35 OPENAIS_COMPAT=DARWIN
36 endif
37 ifneq "" "$(findstring BSD,$(UNAME))"
38
39
40
41 1.1 sys-cluster/openais/files/openais-0.80.3-r1661.patch
42
43 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-r1661.patch?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-r1661.patch?rev=1.1&content-type=text/plain
45
46 Index: openais-0.80.3-r1661.patch
47 ===================================================================
48 diff -uNr openais-0.80.3/CHANGELOG openais-0.80.3-r1661/CHANGELOG
49 --- openais-0.80.3/CHANGELOG 2007-06-26 13:36:38.000000000 +0200
50 +++ openais-0.80.3-r1661/CHANGELOG 2008-11-17 15:54:04.030604165 +0100
51 @@ -1,555 +1,4 @@
52 ------------------------------------------------------------------------
53 -r1400 | sdake | 2007-06-26 03:13:19 -0700 (Tue, 26 Jun 2007) | 2 lines
54 -
55 -Fix compile warning/error on some platforms.
56 -
57 -------------------------------------------------------------------------
58 -r1396 | sdake | 2007-06-25 01:42:58 -0700 (Mon, 25 Jun 2007) | 2 lines
59 -
60 -Update testckpt program to properly test the checkpoint system.
61 -
62 -------------------------------------------------------------------------
63 -r1395 | sdake | 2007-06-25 01:40:45 -0700 (Mon, 25 Jun 2007) | 3 lines
64 -
65 -Fix problem where sometimes when a checkpoint section is expired the timer
66 -also fires at the same time resulting in a warning.
67 -
68 -------------------------------------------------------------------------
69 -r1394 | sdake | 2007-06-24 20:11:10 -0700 (Sun, 24 Jun 2007) | 2 lines
70 -
71 -Add cpg_context_get and cpg_context_set man pages.
72 -
73 -------------------------------------------------------------------------
74 -r1393 | sdake | 2007-06-24 20:09:31 -0700 (Sun, 24 Jun 2007) | 2 lines
75 -
76 -Add cpg_context_get and cpg_context_set api calls.
77 -
78 -------------------------------------------------------------------------
79 -r1392 | sdake | 2007-06-24 20:07:30 -0700 (Sun, 24 Jun 2007) | 2 lines
80 -
81 -install timer.h file for external service handlers.
82 -
83 -------------------------------------------------------------------------
84 -r1390 | sdake | 2007-06-24 19:52:58 -0700 (Sun, 24 Jun 2007) | 2 lines
85 -
86 -Tests cpg_local_get functionality.
87 -
88 -------------------------------------------------------------------------
89 -r1389 | sdake | 2007-06-24 19:22:54 -0700 (Sun, 24 Jun 2007) | 3 lines
90 -
91 -Track timers based upon nanoseconds since epoch and add absolute and relative
92 -timers.
93 -
94 -------------------------------------------------------------------------
95 -r1387 | sdake | 2007-06-23 23:33:09 -0700 (Sat, 23 Jun 2007) | 2 lines
96 -
97 -Update all copyright and email addresses in source tree.
98 -
99 -------------------------------------------------------------------------
100 -r1382 | sdake | 2007-06-12 10:43:15 -0700 (Tue, 12 Jun 2007) | 2 lines
101 -
102 -Add cpg_local_get to get the local node id.
103 -
104 -------------------------------------------------------------------------
105 -r1372 | sdake | 2007-05-17 13:37:43 -0700 (Thu, 17 May 2007) | 3 lines
106 -
107 -on 32 bit platforms, the message source conn info could have uninitialized
108 -values.
109 -
110 -------------------------------------------------------------------------
111 -r1369 | sdake | 2007-04-24 16:11:56 -0700 (Tue, 24 Apr 2007) | 4 lines
112 -
113 -This bug was posted via bugzilla and a patch was attached. Essentially
114 -the checkpoint retention duration was being verified on a checkpoint
115 -open which should be ignored.
116 -
117 -------------------------------------------------------------------------
118 -r1368 | sdake | 2007-04-24 16:11:08 -0700 (Tue, 24 Apr 2007) | 2 lines
119 -
120 -Fix section iteration size comparison
121 -
122 -------------------------------------------------------------------------
123 -r1364 | sdake | 2007-04-24 16:05:56 -0700 (Tue, 24 Apr 2007) | 2 lines
124 -
125 -Have totemsrp use the proper ring id file.
126 -
127 -------------------------------------------------------------------------
128 -r1363 | sdake | 2007-04-24 16:05:38 -0700 (Tue, 24 Apr 2007) | 2 lines
129 -
130 -Fix references to evs_initialize in cpg_initialize man pages
131 -
132 -------------------------------------------------------------------------
133 -r1357 | sdake | 2007-03-21 13:07:58 -0700 (Wed, 21 Mar 2007) | 2 lines
134 -
135 -Fix some type errors within the AMF service.
136 -
137 -------------------------------------------------------------------------
138 -r1356 | sdake | 2007-03-21 13:07:25 -0700 (Wed, 21 Mar 2007) | 2 lines
139 -
140 -Patch to fix some documentation errors relating to CPG service.
141 -
142 -------------------------------------------------------------------------
143 -r1344 | sdake | 2006-12-18 09:08:02 -0700 (Mon, 18 Dec 2006) | 2 lines
144 -
145 -Fix compile warnings about unused variables.
146 -
147 -------------------------------------------------------------------------
148 -r1340 | sdake | 2006-12-18 08:02:48 -0700 (Mon, 18 Dec 2006) | 2 lines
149 -
150 -Fix unaligned access in totem ip on IA64 architecture.
151 -
152 -------------------------------------------------------------------------
153 -r1339 | sdake | 2006-12-12 11:54:51 -0700 (Tue, 12 Dec 2006) | 2 lines
154 -
155 -Convert some spaces to tabs.
156 -
157 -------------------------------------------------------------------------
158 -r1338 | sdake | 2006-12-12 11:54:25 -0700 (Tue, 12 Dec 2006) | 2 lines
159 -
160 -Destroy mutex after it is done being used instead of before it is done being used.
161 -
162 -------------------------------------------------------------------------
163 -r1337 | sdake | 2006-12-12 11:45:25 -0700 (Tue, 12 Dec 2006) | 2 lines
164 -
165 -Remove return and use pthread_exit instead.
166 -
167 -------------------------------------------------------------------------
168 -r1334 | sdake | 2006-12-12 11:38:51 -0700 (Tue, 12 Dec 2006) | 2 lines
169 -
170 -Backport comparison of 0 and NULL.
171 -
172 -------------------------------------------------------------------------
173 -r1330 | sdake | 2006-12-12 11:13:54 -0700 (Tue, 12 Dec 2006) | 2 lines
174 -
175 -Fix argument off by one in instiation of AMF components.
176 -
177 -------------------------------------------------------------------------
178 -r1329 | sdake | 2006-12-12 11:11:07 -0700 (Tue, 12 Dec 2006) | 2 lines
179 -
180 -Remove unnecessary strdup.
181 -
182 -------------------------------------------------------------------------
183 -r1325 | sdake | 2006-12-12 10:56:17 -0700 (Tue, 12 Dec 2006) | 2 lines
184 -
185 -Change rundir to /var/lib/openais.
186 -
187 -------------------------------------------------------------------------
188 -r1323 | pcaulfie | 2006-12-12 10:45:50 -0700 (Tue, 12 Dec 2006) | 2 lines
189 -
190 -Fix ordering of CPG join messages.
191 -
192 -------------------------------------------------------------------------
193 -r1319 | sdake | 2006-12-05 09:34:10 -0700 (Tue, 05 Dec 2006) | 2 lines
194 -
195 -Increase size of default outbound message queue.
196 -
197 -------------------------------------------------------------------------
198 -r1316 | sdake | 2006-11-29 14:30:58 -0700 (Wed, 29 Nov 2006) | 2 lines
199 -
200 -Improvements on segfault logging.
201 -
202 -------------------------------------------------------------------------
203 -r1315 | sdake | 2006-11-29 13:56:17 -0700 (Wed, 29 Nov 2006) | 2 lines
204 -
205 -Fix compile error in libcpg
206 -
207 -------------------------------------------------------------------------
208 -r1314 | sdake | 2006-11-29 13:47:40 -0700 (Wed, 29 Nov 2006) | 2 lines
209 -
210 -Change rundir to /var/openais otherwise core files and ringid file is deleted
211 -
212 -------------------------------------------------------------------------
213 -r1313 | sdake | 2006-11-29 13:35:32 -0700 (Wed, 29 Nov 2006) | 2 lines
214 -
215 -Flow control fixes for the CPG service.
216 -
217 -------------------------------------------------------------------------
218 -r1312 | fthomas | 2006-11-23 02:10:19 -0700 (Thu, 23 Nov 2006) | 1 line
219 -
220 -correct incorrect commit that must use SA_AIS_ERR_LIBRARY instead of ERR_LIBRARY
221 -------------------------------------------------------------------------
222 -r1311 | fthomas | 2006-11-23 01:49:21 -0700 (Thu, 23 Nov 2006) | 1 line
223 -
224 -handle case where POLLHUP or POLLERR are not supported by OS
225 -------------------------------------------------------------------------
226 -r1309 | fthomas | 2006-11-16 10:36:52 -0700 (Thu, 16 Nov 2006) | 1 line
227 -
228 -set default downcheck value to 1000ms
229 -------------------------------------------------------------------------
230 -r1308 | fthomas | 2006-11-16 10:34:44 -0700 (Thu, 16 Nov 2006) | 1 line
231 -
232 -remove invalid code / warnings detected by Intel compiler
233 -------------------------------------------------------------------------
234 -r1307 | sdake | 2006-11-15 00:23:10 -0700 (Wed, 15 Nov 2006) | 2 lines
235 -
236 -Remove flow control compile warning.
237 -
238 -------------------------------------------------------------------------
239 -r1306 | sdake | 2006-11-15 00:21:02 -0700 (Wed, 15 Nov 2006) | 2 lines
240 -
241 -Make clean for makefiles improvement to actually remove all files.
242 -
243 -------------------------------------------------------------------------
244 -r1305 | sdake | 2006-11-15 00:19:37 -0700 (Wed, 15 Nov 2006) | 2 lines
245 -
246 -Set scheduler SCHED_RR to max priority available in the system.
247 -
248 -------------------------------------------------------------------------
249 -r1300 | sdake | 2006-11-13 10:38:13 -0700 (Mon, 13 Nov 2006) | 2 lines
250 -
251 -Improve behavior of flow control of CPG service during configuration changes.
252 -
253 -------------------------------------------------------------------------
254 -r1296 | sdake | 2006-11-09 05:34:08 -0700 (Thu, 09 Nov 2006) | 2 lines
255 -
256 -Remove compile warnings.
257 -
258 -------------------------------------------------------------------------
259 -r1295 | sdake | 2006-11-09 05:26:56 -0700 (Thu, 09 Nov 2006) | 5 lines
260 -
261 -the totem membership protocol was changed to match specificatoins. The sending
262 -join messages now use the local seq id of he ring instead of the maximum seqidsrreceived. This resuls in running of the mp5 test for several hours. Also
263 -the consensus timeout was increased to allow for the membership protocol to
264 -form a proper membership in network overload situations.
265 -
266 -------------------------------------------------------------------------
267 -r1294 | sdake | 2006-11-08 18:33:06 -0700 (Wed, 08 Nov 2006) | 3 lines
268 -
269 -Modify location of ringid file and create and chdir to
270 -/var/run/openais directory so cores are saved there.
271 -
272 -------------------------------------------------------------------------
273 -r1293 | sdake | 2006-11-08 14:48:20 -0700 (Wed, 08 Nov 2006) | 2 lines
274 -
275 -Flush output of debug messages on exit or segv.
276 -
277 -------------------------------------------------------------------------
278 -r1288 | sdake | 2006-11-04 15:22:02 -0700 (Sat, 04 Nov 2006) | 2 lines
279 -
280 -Ported revision 1287 - updated README.devmap
281 -
282 -------------------------------------------------------------------------
283 -r1286 | sdake | 2006-11-03 16:48:53 -0700 (Fri, 03 Nov 2006) | 3 lines
284 -
285 -Fix problem where checkpoints can't be written afer an unlink opeation occurs
286 -and a new node is started.
287 -
288 -------------------------------------------------------------------------
289 -r1284 | sdake | 2006-10-24 13:31:15 -0700 (Tue, 24 Oct 2006) | 3 lines
290 -
291 -Checkpoint section variables were not properly initialized resulting in
292 -segfaults.
293 -
294 -------------------------------------------------------------------------
295 -r1283 | sdake | 2006-10-24 08:39:45 -0700 (Tue, 24 Oct 2006) | 2 lines
296 -
297 -Fix memory leaks.
298 -
299 -------------------------------------------------------------------------
300 -r1282 | sdake | 2006-10-24 04:28:18 -0700 (Tue, 24 Oct 2006) | 2 lines
301 -
302 -New generation checkpoint synchronization state machine.
303 -
304 -------------------------------------------------------------------------
305 -r1279 | sdake | 2006-10-23 21:08:57 -0700 (Mon, 23 Oct 2006) | 2 lines
306 -
307 -Call abort in synchronization service when processing is interrupted.
308 -
309 -------------------------------------------------------------------------
310 -r1278 | sdake | 2006-10-23 20:48:41 -0700 (Mon, 23 Oct 2006) | 2 lines
311 -
312 -Patch testckpt to use proper section id size.
313 -
314 -------------------------------------------------------------------------
315 -r1277 | sdake | 2006-10-23 20:36:40 -0700 (Mon, 23 Oct 2006) | 2 lines
316 -
317 -Replace spaces with tabs on two lines.
318 -
319 -------------------------------------------------------------------------
320 -r1276 | sdake | 2006-10-23 20:29:12 -0700 (Mon, 23 Oct 2006) | 2 lines
321 -
322 -remove makefile debug added accidentally in last patch
323 -
324 -------------------------------------------------------------------------
325 -r1275 | sdake | 2006-10-23 20:28:26 -0700 (Mon, 23 Oct 2006) | 2 lines
326 -
327 -pthread_mutex_destroy cleanup patch from Fabien
328 -
329 -------------------------------------------------------------------------
330 -r1271 | sdake | 2006-10-19 13:38:22 -0700 (Thu, 19 Oct 2006) | 2 lines
331 -
332 -Fix errors in ia64 alignment.
333 -
334 -------------------------------------------------------------------------
335 -r1270 | sdake | 2006-10-19 10:43:39 -0700 (Thu, 19 Oct 2006) | 2 lines
336 -
337 -Resolve IPC segfault.
338 -
339 -------------------------------------------------------------------------
340 -r1269 | sdake | 2006-10-18 16:10:34 -0700 (Wed, 18 Oct 2006) | 2 lines
341 -
342 -Specific stack size for ia64 architectures required.
343 -
344 -------------------------------------------------------------------------
345 -r1268 | sdake | 2006-10-18 16:09:59 -0700 (Wed, 18 Oct 2006) | 3 lines
346 -
347 -Align totem deliveries on 4 byte boudnaries to avoid segfaults and warnings
348 -on sparc and ia64 architectures.
349 -
350 -------------------------------------------------------------------------
351 -r1267 | sdake | 2006-10-16 09:07:01 -0700 (Mon, 16 Oct 2006) | 2 lines
352 -
353 -Rework of the checkpoint synchronization system.
354 -
355 -------------------------------------------------------------------------
356 -r1265 | sdake | 2006-10-12 15:24:36 -0700 (Thu, 12 Oct 2006) | 2 lines
357 -
358 -Only originate one regular token.
359 -
360 -------------------------------------------------------------------------
361 -r1264 | sdake | 2006-10-12 15:23:26 -0700 (Thu, 12 Oct 2006) | 3 lines
362 -
363 -If the failed_list has zero entries, don't add it as an iovector in join
364 -messages.
365 -
366 -------------------------------------------------------------------------
367 -r1263 | sdake | 2006-10-12 15:22:53 -0700 (Thu, 12 Oct 2006) | 3 lines
368 -
369 -Use the fullset variable instead of the local variable j to make easier code
370 -reading.
371 -
372 -------------------------------------------------------------------------
373 -r1262 | sdake | 2006-10-12 15:22:09 -0700 (Thu, 12 Oct 2006) | 2 lines
374 -
375 -Set the ring sequence number according to the totem specificatoins.
376 -
377 -------------------------------------------------------------------------
378 -r1261 | sdake | 2006-10-12 15:21:42 -0700 (Thu, 12 Oct 2006) | 2 lines
379 -
380 -Cleanup the way the memb_index variable is handled in the commit token
381 -
382 -------------------------------------------------------------------------
383 -r1260 | sdake | 2006-10-12 15:21:04 -0700 (Thu, 12 Oct 2006) | 3 lines
384 -
385 -Allocate the retransmission token in instance_initialize instead of
386 -totemsrp_initialize
387 -
388 -------------------------------------------------------------------------
389 -r1258 | sdake | 2006-10-09 00:43:45 -0700 (Mon, 09 Oct 2006) | 2 lines
390 -
391 -Accept commit token in proper cases.
392 -
393 -------------------------------------------------------------------------
394 -r1257 | sdake | 2006-10-09 00:43:04 -0700 (Mon, 09 Oct 2006) | 2 lines
395 -
396 -Fix subset operation to work properly.
397 -
398 -------------------------------------------------------------------------
399 -r1256 | sdake | 2006-10-09 00:42:36 -0700 (Mon, 09 Oct 2006) | 2 lines
400 -
401 -Remove some extra debug logging output when in DEBUG mode that is not needed.
402 -
403 -------------------------------------------------------------------------
404 -r1252 | sdake | 2006-10-04 21:11:40 -0700 (Wed, 04 Oct 2006) | 2 lines
405 -
406 -Print out left members properly from totemsrp.
407 -
408 -------------------------------------------------------------------------
409 -r1248 | sdake | 2006-09-28 11:49:00 -0700 (Thu, 28 Sep 2006) | 2 lines
410 -
411 -Set the proper size of responses to cpg_mcast messages.
412 -
413 -------------------------------------------------------------------------
414 -r1246 | sdake | 2006-09-27 15:57:03 -0700 (Wed, 27 Sep 2006) | 2 lines
415 -
416 -Flow control part 2 patch.
417 -
418 -------------------------------------------------------------------------
419 -r1245 | sdake | 2006-09-25 02:41:57 -0700 (Mon, 25 Sep 2006) | 2 lines
420 -
421 -Add cpgbench tool and group wide flow control services for the cpg service.
422 -
423 -------------------------------------------------------------------------
424 -r1230 | fthomas | 2006-08-28 03:12:25 -0700 (Mon, 28 Aug 2006) | 1 line
425 -
426 -add missing include for assert
427 -------------------------------------------------------------------------
428 -r1224 | sdake | 2006-08-21 21:40:26 -0700 (Mon, 21 Aug 2006) | 2 lines
429 -
430 -Fix up printing of SaNameT and mar_name_t in case it is not null terminated.
431 -
432 -------------------------------------------------------------------------
433 -r1223 | sdake | 2006-08-21 21:39:08 -0700 (Mon, 21 Aug 2006) | 2 lines
434 -
435 -Fix checkpoints with write size of zero to return INVALID PARAM error code
436 -
437 -------------------------------------------------------------------------
438 -r1217 | sdake | 2006-08-15 21:35:15 -0700 (Tue, 15 Aug 2006) | 2 lines
439 -
440 -Remove invalid commit.
441 -
442 -------------------------------------------------------------------------
443 -r1213 | sdake | 2006-08-15 21:22:30 -0700 (Tue, 15 Aug 2006) | 2 lines
444 -
445 -Return ERR_TIMEOUT on zero timeout parameter to saEvtEventChannelOpen.
446 -
447 -------------------------------------------------------------------------
448 -r1212 | sdake | 2006-08-15 18:22:40 -0700 (Tue, 15 Aug 2006) | 2 lines
449 -
450 -Return ERR_TIMEOUT if timeout parameter is zero in saEvtChannelOpen.
451 -
452 -------------------------------------------------------------------------
453 -r1210 | sdake | 2006-08-15 17:45:14 -0700 (Tue, 15 Aug 2006) | 2 lines
454 -
455 -Add more scalability by adding a new send_join parameter to openais.
456 -
457 -------------------------------------------------------------------------
458 -r1209 | sdake | 2006-08-15 17:37:54 -0700 (Tue, 15 Aug 2006) | 2 lines
459 -
460 -Remove warning about assert being undefined by including assert.h.
461 -
462 -------------------------------------------------------------------------
463 -r1205 | sdake | 2006-08-15 17:03:45 -0700 (Tue, 15 Aug 2006) | 2 lines
464 -
465 -Fix hash collision in cpg service.
466 -
467 -------------------------------------------------------------------------
468 -r1204 | sdake | 2006-08-15 16:57:44 -0700 (Tue, 15 Aug 2006) | 2 lines
469 -
470 -Install proper shared object files for clm service.
471 -
472 -------------------------------------------------------------------------
473 -r1203 | sdake | 2006-08-15 16:55:44 -0700 (Tue, 15 Aug 2006) | 2 lines
474 -
475 -Improve recovery state data output.
476 -
477 -------------------------------------------------------------------------
478 -r1202 | sdake | 2006-08-15 16:53:01 -0700 (Tue, 15 Aug 2006) | 3 lines
479 -
480 -Improve gather notifications so user knows where gather was entered from. This
481 -is useful for debugging.
482 -
483 -------------------------------------------------------------------------
484 -r1201 | sdake | 2006-08-15 16:51:56 -0700 (Tue, 15 Aug 2006) | 2 lines
485 -
486 -This cleans up some of the error reporting of the testckpt tool.
487 -
488 -------------------------------------------------------------------------
489 -r1198 | sdake | 2006-08-08 08:54:02 -0700 (Tue, 08 Aug 2006) | 2 lines
490 -
491 -Use braces in the totemip code.
492 -
493 -------------------------------------------------------------------------
494 -r1197 | sdake | 2006-08-08 08:52:49 -0700 (Tue, 08 Aug 2006) | 2 lines
495 -
496 -Ensure compile with GIVE_INFO gives proper information.
497 -
498 -------------------------------------------------------------------------
499 -r1196 | sdake | 2006-08-08 08:52:05 -0700 (Tue, 08 Aug 2006) | 2 lines
500 -
501 -Resend the commit token if it is lost
502 -
503 -------------------------------------------------------------------------
504 -r1195 | sdake | 2006-08-08 08:51:03 -0700 (Tue, 08 Aug 2006) | 2 lines
505 -
506 -Move SYNC output data to DEBUG mode.
507 -
508 -------------------------------------------------------------------------
509 -r1194 | sdake | 2006-08-08 08:49:31 -0700 (Tue, 08 Aug 2006) | 2 lines
510 -
511 -Give better user error messages when token is lost.
512 -
513 -------------------------------------------------------------------------
514 -r1193 | sdake | 2006-08-08 08:41:44 -0700 (Tue, 08 Aug 2006) | 2 lines
515 -
516 -Fix checkpoint synchronization.
517 -
518 -------------------------------------------------------------------------
519 -r1192 | sdake | 2006-08-08 08:41:22 -0700 (Tue, 08 Aug 2006) | 2 lines
520 -
521 -Move notice debug outputs in checkpoint service to debug outputs.
522 -
523 -------------------------------------------------------------------------
524 -r1191 | sdake | 2006-08-08 08:40:05 -0700 (Tue, 08 Aug 2006) | 2 lines
525 -
526 -Use GNU formatting for printf output
527 -
528 -------------------------------------------------------------------------
529 -r1190 | sdake | 2006-08-08 08:38:08 -0700 (Tue, 08 Aug 2006) | 2 lines
530 -
531 -Clean header includes from swab code.
532 -
533 -------------------------------------------------------------------------
534 -r1189 | sdake | 2006-08-08 08:35:42 -0700 (Tue, 08 Aug 2006) | 2 lines
535 -
536 -Fix endian marshalling in YKD service.
537 -
538 -------------------------------------------------------------------------
539 -r1188 | sdake | 2006-08-08 08:35:00 -0700 (Tue, 08 Aug 2006) | 2 lines
540 -
541 -Cleanup lcr_ifact code.
542 -
543 -------------------------------------------------------------------------
544 -r1187 | sdake | 2006-08-08 08:34:36 -0700 (Tue, 08 Aug 2006) | 2 lines
545 -
546 -Fix endian marshalling for eventing service.
547 -
548 -------------------------------------------------------------------------
549 -r1186 | sdake | 2006-08-08 08:34:10 -0700 (Tue, 08 Aug 2006) | 2 lines
550 -
551 -Add endian conversion for evs service.
552 -
553 -------------------------------------------------------------------------
554 -r1185 | sdake | 2006-08-08 08:33:13 -0700 (Tue, 08 Aug 2006) | 2 lines
555 -
556 -Fix marshalling with CPG service.
557 -
558 -------------------------------------------------------------------------
559 -r1184 | sdake | 2006-08-08 08:32:33 -0700 (Tue, 08 Aug 2006) | 2 lines
560 -
561 -Fix endian marshalling with clm service.
562 -
563 -------------------------------------------------------------------------
564 -r1183 | sdake | 2006-08-08 08:32:04 -0700 (Tue, 08 Aug 2006) | 2 lines
565 -
566 -Set proper socket for IPV6 membership add
567 -
568 -------------------------------------------------------------------------
569 -r1182 | sdake | 2006-08-08 08:30:40 -0700 (Tue, 08 Aug 2006) | 2 lines
570 -
571 -Fix processor count in EVS service so EVS service operates properly.
572 -
573 -------------------------------------------------------------------------
574 -r1181 | sdake | 2006-08-08 08:27:05 -0700 (Tue, 08 Aug 2006) | 2 lines
575 -
576 -fix ckpt-rd and ckpt-wr test applications
577 -
578 -------------------------------------------------------------------------
579 -r1180 | sdake | 2006-08-08 08:23:33 -0700 (Tue, 08 Aug 2006) | 2 lines
580 -
581 -Use worker threads for debug output
582 -
583 -------------------------------------------------------------------------
584 -r1179 | sdake | 2006-08-07 15:50:58 -0700 (Mon, 07 Aug 2006) | 2 lines
585 -
586 -Unlink header prototype incorrect.
587 -
588 -------------------------------------------------------------------------
589 -r1173 | sdake | 2006-08-02 22:31:34 -0700 (Wed, 02 Aug 2006) | 2 lines
590 -
591 -Ensure sync_activate is only called once
592 -
593 -------------------------------------------------------------------------
594 -r1155 | sdake | 2006-07-24 22:18:52 -0700 (Mon, 24 Jul 2006) | 2 lines
595 -
596 -Added whitetank branch.
597 -
598 -------------------------------------------------------------------------
599 -r1153 | sdake | 2006-07-23 18:36:18 -0700 (Sun, 23 Jul 2006) | 2 lines
600 -
601 -Release of version 0.80 First Whitetank release
602 -
603 -------------------------------------------------------------------------
604 r1152 | sdake | 2006-07-23 18:34:17 -0700 (Sun, 23 Jul 2006) | 2 lines
605
606 Allow build type of COVERAGE for code coverage analysis
607 diff -uNr openais-0.80.3/Makefile openais-0.80.3-r1661/Makefile
608 --- openais-0.80.3/Makefile 2007-06-25 05:07:30.000000000 +0200
609 +++ openais-0.80.3-r1661/Makefile 2008-11-17 15:54:04.030604165 +0100
610 @@ -196,4 +196,4 @@
611 install -m 644 man/*.8 $(DESTDIR)$(MANDIR)/man8
612
613 doxygen:
614 - doxygen
615 + mkdir -p doc/api && doxygen
616 diff -uNr openais-0.80.3/README.devmap openais-0.80.3-r1661/README.devmap
617 --- openais-0.80.3/README.devmap 2006-11-04 23:22:02.000000000 +0100
618 +++ openais-0.80.3-r1661/README.devmap 2008-11-17 15:54:04.030604165 +0100
619 @@ -1221,3 +1221,91 @@
620 for other people.
621
622 Have fun!
623 +
624 +---
625 +IPC state machine
626 +
627 +lib_exit_fn may not use openais_response_send or openais_dispatch_send
628 +
629 +state INITIALIZING
630 +------------------
631 +receive response end of a library request
632 + create conn_io data structure
633 + if the connection's UID/GID is invalid
634 + conn_io_disconnect
635 + send response to conn_io with conn_io's address
636 + set conn_io refcnt to 1
637 +
638 +receive dispatch end of a library connection with response end conn_io address
639 + find matching connection
640 + if the connection's UID/GID is invalid
641 + conn_io_disconnect
642 + send reponse to conn_io
643 + create conn_info data structure
644 + if conn_io response end is valid
645 + store dispatch end of conn_io into conn_info data structure
646 + store response conn_io into conn_info data structure
647 + set conn_io refcnt to 1
648 + call lib_init_fn for service type
649 + set conn_info refcnt to 1
650 + set state to ACTIVE
651 +
652 +event response disconnects and conn_info not bound
653 + disconnect connection
654 +event receive connects and response connection not found
655 + disconnect dispatch
656 +event no dispatch connection within 5 seconds
657 + disconnect dispatch
658 +event disconnect_request
659 + set state to DISCONNECT_REQUESTED
660 + decrement response conn_io refcnt by 1
661 + decrement dispatch conn_io refcnt by 1
662 +
663 +state ACTIVE
664 +------------
665 +do {
666 + increment conn_io refcnt by 1
667 + poll
668 + if invalid poll set state internal_disconnect_request
669 + dispatch library handler functions
670 + flush any output that can be flushed
671 + decrement conn_io refcnt by 1
672 + if state set to DISCONNECT_REQUESTED
673 + execute algorithm for disconnect requested state
674 +}
675 +
676 +event internal_disconnect_request
677 + set state to DISCONNECT_REQUESTED
678 + decrement response conn_io refcnt by 1
679 + decrement dispatch conn_io refcnt by 1
680 +event openais_conn_refcnt_increment
681 + increase conn_info reference count by 1
682 +event openais_conn_refcnt_decrement
683 + decrease conn_info reference count by 1
684 +
685 +state DISCONNECT_REQUESTED
686 +--------------------------
687 +if this is the response conn_io data
688 +do {
689 + if response conn_io refcnt is 0
690 + destroy conn_io data structure
691 + decrement conn_info reference count
692 + exit thread
693 + sleep configurable short duration
694 +}
695 +
696 +if this is the dispatch conn_io data
697 +do {
698 + if dispatch conn_io refcnt is 0
699 + call lib_exit_fn
700 + if successful
701 + destroy conn_io data structure
702 + decrement conn_info reference count
703 + exit thread
704 + sleep configurable short duration
705 +}
706 +
707 +when conn_info reference count equals 0
708 + free conn_info data structure
709 +
710 +
711 diff -uNr openais-0.80.3/exec/amf.c openais-0.80.3-r1661/exec/amf.c
712 --- openais-0.80.3/exec/amf.c 2007-06-24 08:33:09.000000000 +0200
713 +++ openais-0.80.3-r1661/exec/amf.c 2008-11-17 15:54:02.390605772 +0100
714 @@ -480,7 +480,7 @@
715 res_lib.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
716 res_lib.header.size = sizeof (struct res_lib_amf_componentregister);
717 res_lib.header.error = error;
718 - openais_conn_send_response (
719 + openais_response_send (
720 comp->conn, &res_lib, sizeof (struct res_lib_amf_componentregister));
721 }
722 }
723 @@ -544,7 +544,7 @@
724 res_lib.header.id = MESSAGE_RES_AMF_RESPONSE;
725 res_lib.header.size = sizeof (struct res_lib_amf_response);
726 res_lib.header.error = retval;
727 - openais_conn_send_response (comp->conn, &res_lib, sizeof (res_lib));
728 + openais_response_send (comp->conn, &res_lib, sizeof (res_lib));
729 }
730 }
731
732 @@ -583,7 +583,7 @@
733 res_lib.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
734 res_lib.header.size = sizeof (struct res_lib_amf_componentregister);
735 res_lib.header.error = SA_AIS_ERR_INVALID_PARAM;
736 - openais_conn_send_response (
737 + openais_response_send (
738 conn, &res_lib, sizeof (struct res_lib_amf_componentregister));
739 }
740 }
741 @@ -658,12 +658,13 @@
742 res_lib.header.id = MESSAGE_RES_AMF_HEALTHCHECKSTART;
743 res_lib.header.size = sizeof (res_lib);
744 res_lib.header.error = error;
745 - openais_conn_send_response (conn, &res_lib,
746 + openais_response_send (conn, &res_lib,
747 sizeof (struct res_lib_amf_healthcheckstart));
748 }
749
750 static void message_handler_req_lib_amf_healthcheckconfirm (
751 - void *conn, void *msg)
752 + void *conn,
753 + void *msg)
754 {
755 struct req_lib_amf_healthcheckconfirm *req_lib = msg;
756 struct res_lib_amf_healthcheckconfirm res_lib;
757 @@ -683,7 +684,7 @@
758 res_lib.header.id = MESSAGE_RES_AMF_HEALTHCHECKCONFIRM;
759 res_lib.header.size = sizeof (res_lib);
760 res_lib.header.error = error;
761 - openais_conn_send_response (conn, &res_lib, sizeof (res_lib));
762 + openais_response_send (conn, &res_lib, sizeof (res_lib));
763 }
764
765 static void message_handler_req_lib_amf_healthcheckstop (
766 @@ -706,7 +707,7 @@
767 res_lib.header.id = MESSAGE_RES_AMF_HEALTHCHECKSTOP;
768 res_lib.header.size = sizeof (res_lib);
769 res_lib.header.error = error;
770 - openais_conn_send_response (conn, &res_lib, sizeof (res_lib));
771 + openais_response_send (conn, &res_lib, sizeof (res_lib));
772 }
773
774 static void message_handler_req_lib_amf_hastateget (void *conn, void *msg)
775 @@ -732,7 +733,7 @@
776 res_lib.header.size = sizeof (struct res_lib_amf_hastateget);
777 res_lib.header.error = error;
778
779 - openais_conn_send_response (conn, &res_lib,
780 + openais_response_send (conn, &res_lib,
781 sizeof (struct res_lib_amf_hastateget));
782 }
783
784 @@ -788,7 +789,7 @@
785 if (amfProtectionGroup) {
786 res_lib_amf_protectiongrouptrack.header.error = SA_AIS_OK;
787 }
788 - openais_conn_send_response (conn, &res_lib_amf_protectiongrouptrack,
789 + openais_response_send (conn, &res_lib_amf_protectiongrouptrack,
790 sizeof (struct res_lib_amf_protectiongrouptrack));
791
792 if (amfProtectionGroup &&
793 @@ -848,7 +849,7 @@
794 if (track) {
795 res_lib_amf_protectiongrouptrackstop.header.error = SA_AIS_OK;
796 }
797 - openais_conn_send_response (conn, &res_lib_amf_protectiongrouptrackstop,
798 + openais_response_send (conn, &res_lib_amf_protectiongrouptrackstop,
799 sizeof (struct res_lib_amf_protectiongrouptrackstop));
800
801 #endif
802 @@ -896,7 +897,7 @@
803 res_lib.header.size = sizeof (struct res_lib_amf_componenterrorreport);
804 res_lib.header.id = MESSAGE_RES_AMF_COMPONENTERRORREPORT;
805 res_lib.header.error = SA_AIS_ERR_NOT_EXIST;
806 - openais_conn_send_response (conn, &res_lib,
807 + openais_response_send (conn, &res_lib,
808 sizeof (struct res_lib_amf_componenterrorreport));
809 }
810 }
811 @@ -963,7 +964,7 @@
812 res_lib.header.id = MESSAGE_RES_AMF_RESPONSE;
813 res_lib.header.size = sizeof (struct res_lib_amf_response);
814 res_lib.header.error = retval;
815 - openais_conn_send_response (conn, &res_lib, sizeof (res_lib));
816 + openais_response_send (conn, &res_lib, sizeof (res_lib));
817 }
818 }
819
820 diff -uNr openais-0.80.3/exec/amfcomp.c openais-0.80.3-r1661/exec/amfcomp.c
821 --- openais-0.80.3/exec/amfcomp.c 2007-06-24 08:33:09.000000000 +0200
822 +++ openais-0.80.3-r1661/exec/amfcomp.c 2008-11-17 15:54:02.380604445 +0100
823 @@ -547,8 +547,8 @@
824 AMF_RESPONSE_COMPONENTTERMINATECALLBACK,
825 component_terminate_callback_data);
826
827 - openais_conn_send_response (
828 - openais_conn_partner_get (comp->conn),
829 + openais_dispatch_send (
830 + comp->conn,
831 &res_lib,
832 sizeof (struct res_lib_amf_componentterminatecallback));
833
834 @@ -817,8 +817,8 @@
835
836 res_lib_amf_csiremovecallback.csiFlags = 0;
837
838 - openais_conn_send_response (
839 - openais_conn_partner_get (comp->conn),
840 + openais_dispatch_send (
841 + comp->conn,
842 &res_lib_amf_csiremovecallback,
843 sizeof (struct res_lib_amf_csiremovecallback));
844 }
845 @@ -1011,8 +1011,8 @@
846
847 TRACE8 ("sending healthcheck request to component %s",
848 res_lib.compName.value);
849 - openais_conn_send_response (
850 - openais_conn_partner_get (healthcheck->comp->conn),
851 + openais_dispatch_send (
852 + healthcheck->comp->conn,
853 &res_lib, sizeof (struct res_lib_amf_healthcheckcallback));
854 }
855
856 @@ -1117,8 +1117,7 @@
857 res_lib->invocation =
858 invocation_create (AMF_RESPONSE_CSISETCALLBACK, csi_assignment);
859
860 - openais_conn_send_response (
861 - openais_conn_partner_get (comp->conn), res_lib, res_lib->header.size);
862 + openais_dispatch_send (comp->conn, res_lib, res_lib->header.size);
863
864 free(p);
865 }
866 @@ -1129,11 +1128,14 @@
867
868 if (comp->saAmfCompPresenceState == SA_AMF_PRESENCE_RESTARTING) {
869 comp_presence_state_set (comp, SA_AMF_PRESENCE_INSTANTIATED);
870 - } else if (comp->saAmfCompPresenceState == SA_AMF_PRESENCE_INSTANTIATING) {
871 + } else
872 + if (comp->saAmfCompPresenceState == SA_AMF_PRESENCE_INSTANTIATING) {
873 amf_comp_operational_state_set (comp, SA_AMF_OPERATIONAL_ENABLED);
874 comp_presence_state_set (comp, SA_AMF_PRESENCE_INSTANTIATED);
875 - }
876 - else {
877 + } else
878 + if (comp->saAmfCompPresenceState == SA_AMF_PRESENCE_UNINSTANTIATED) {
879 + return SA_AIS_ERR_INVALID_PARAM;
880 + } else {
881 assert (0);
882 }
883
884 @@ -1151,7 +1153,7 @@
885 res_lib.header.size = sizeof (struct res_lib_amf_componenterrorreport);
886 res_lib.header.id = MESSAGE_RES_AMF_COMPONENTERRORREPORT;
887 res_lib.header.error = SA_AIS_OK;
888 - openais_conn_send_response (comp->conn, &res_lib, sizeof (res_lib));
889 + openais_dispatch_send (comp->conn, &res_lib, sizeof (res_lib));
890 }
891
892 /* report to SU and let it handle the problem */
893 diff -uNr openais-0.80.3/exec/cfg.c openais-0.80.3-r1661/exec/cfg.c
894 --- openais-0.80.3/exec/cfg.c 2007-06-24 08:33:09.000000000 +0200
895 +++ openais-0.80.3-r1661/exec/cfg.c 2008-11-17 15:54:02.370604375 +0100
896 @@ -268,7 +268,7 @@
897 res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
898 res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
899 res_lib_cfg_ringreenable.header.error = SA_AIS_OK;
900 - openais_conn_send_response (
901 + openais_response_send (
902 req_exec_cfg_ringreenable->source.conn,
903 &res_lib_cfg_ringreenable,
904 sizeof (struct res_lib_cfg_ringreenable));
905 @@ -298,7 +298,7 @@
906 res_lib_cfg_ringstatusget.header.error = SA_AIS_OK;
907
908 totempg_ifaces_get (
909 - this_ip->nodeid,
910 + totempg_my_nodeid_get(),
911 interfaces,
912 &status,
913 &iface_count);
914 @@ -312,7 +312,7 @@
915 strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
916 totem_ip_string);
917 }
918 - openais_conn_send_response (
919 + openais_response_send (
920 conn,
921 &res_lib_cfg_ringstatusget,
922 sizeof (struct res_lib_cfg_ringstatusget));
923 diff -uNr openais-0.80.3/exec/ckpt.c openais-0.80.3-r1661/exec/ckpt.c
924 --- openais-0.80.3/exec/ckpt.c 2007-06-26 13:16:50.000000000 +0200
925 +++ openais-0.80.3-r1661/exec/ckpt.c 2008-11-17 15:54:02.390605772 +0100
926 @@ -1,6 +1,6 @@
927 /*
928 * Copyright (c) 2003-2006 MontaVista Software, Inc.
929 - * Copyright (c) 2006-2007 Red Hat, Inc.
930 + * Copyright (c) 2006-2008 Red Hat, Inc.
931 *
932 * All rights reserved.
933 *
934 @@ -65,6 +65,8 @@
935 #include "totempg.h"
936 #include "print.h"
937
938 +#define GLOBALID_CHECKPOINT_NAME "global_checkpoint_name_do_not_use_in_an_application"
939 +
940 #define CKPT_MAX_SECTION_DATA_SEND (1024*400)
941
942 enum ckpt_message_req_types {
943 @@ -92,6 +94,9 @@
944 };
945
946 enum sync_state {
947 + SYNC_STATE_NOT_STARTED,
948 + SYNC_STATE_STARTED,
949 + SYNC_STATE_GLOBALID,
950 SYNC_STATE_CHECKPOINT,
951 SYNC_STATE_REFCOUNT
952 };
953 @@ -156,6 +161,7 @@
954
955 struct checkpoint {
956 struct list_head list;
957 + struct list_head expiry_list;
958 mar_name_t name;
959 mar_uint32_t ckpt_id;
960 mar_ckpt_checkpoint_creation_attributes_t checkpoint_creation_attributes;
961 @@ -367,21 +373,27 @@
962
963 DECLARE_LIST_INIT(checkpoint_recovery_list_head);
964
965 +DECLARE_LIST_INIT(my_checkpoint_expiry_list_head);
966 +
967 static mar_uint32_t global_ckpt_id = 0;
968
969 -static enum sync_state my_sync_state;
970 +static enum sync_state my_sync_state = SYNC_STATE_NOT_STARTED;
971
972 static enum iteration_state my_iteration_state;
973
974 -static struct list_head *my_iteration_state_checkpoint;
975 +static struct list_head *my_iteration_state_checkpoint_list;
976 +
977 +static struct list_head *my_iteration_state_section_list;
978
979 -static struct list_head *my_iteration_state_section;
980 +static unsigned int my_old_member_list[PROCESSOR_COUNT_MAX];
981
982 -static unsigned int my_member_list[PROCESSOR_COUNT_MAX];
983 +static unsigned int my_old_member_list_entries = 0;
984
985 -static unsigned int my_member_list_entries = 0;
986 +static unsigned int my_should_sync = 0;
987
988 -static unsigned int my_lowest_nodeid = 0;
989 +static unsigned int my_token_callback_active = 0;
990 +
991 +static void * my_token_callback_handle;
992
993 struct checkpoint_cleanup {
994 struct list_head list;
995 @@ -756,51 +768,11 @@
996 mar_refcount_set_t refcount_set[PROCESSOR_COUNT_MAX] __attribute__((aligned(8)));
997 };
998
999 +static int first_configuration = 1;
1000 +
1001 /*
1002 * Implementation
1003 */
1004 -
1005 -void clean_checkpoint_list(struct list_head *head)
1006 -{
1007 - struct list_head *checkpoint_list;
1008 - struct checkpoint *checkpoint;
1009 -
1010 - if (list_empty(head)) {
1011 - log_printf (LOG_LEVEL_DEBUG, "clean_checkpoint_list: List is empty \n");
1012 - return;
1013 - }
1014 -
1015 - checkpoint_list = head->next;
1016 - while (checkpoint_list != head) {
1017 - checkpoint = list_entry (checkpoint_list,
1018 - struct checkpoint, list);
1019 - assert (checkpoint > 0);
1020 -
1021 - /*
1022 - * If checkpoint has been unlinked and this is the last reference, delete it
1023 - */
1024 - if (checkpoint->unlinked && checkpoint->reference_count == 0) {
1025 - log_printf (LOG_LEVEL_DEBUG,"clean_checkpoint_list: deallocating checkpoint %s.\n",
1026 - checkpoint->name.value);
1027 - checkpoint_list = checkpoint_list->next;
1028 - checkpoint_release (checkpoint);
1029 - continue;
1030 -
1031 - }
1032 - else if (checkpoint->reference_count == 0) {
1033 - log_printf (LOG_LEVEL_DEBUG, "clean_checkpoint_list: Starting timer to release checkpoint %s.\n",
1034 - checkpoint->name.value);
1035 - openais_timer_delete (checkpoint->retention_timer);
1036 - openais_timer_add_duration (
1037 - checkpoint->checkpoint_creation_attributes.retention_duration,
1038 - checkpoint,
1039 - timer_function_retention,
1040 - &checkpoint->retention_timer);
1041 - }
1042 - checkpoint_list = checkpoint_list->next;
1043 - }
1044 -}
1045 -
1046 static void ckpt_confchg_fn (
1047 enum totem_configuration_type configuration_type,
1048 unsigned int *member_list, int member_list_entries,
1049 @@ -809,40 +781,45 @@
1050 struct memb_ring_id *ring_id)
1051 {
1052 unsigned int i, j;
1053 + unsigned int lowest_nodeid;
1054 +
1055 + memcpy (&my_saved_ring_id, ring_id,
1056 + sizeof (struct memb_ring_id));
1057 + if (configuration_type != TOTEM_CONFIGURATION_REGULAR) {
1058 + return;
1059 + }
1060 + if (my_sync_state != SYNC_STATE_NOT_STARTED) {
1061 + return;
1062 + }
1063 +
1064 + my_sync_state = SYNC_STATE_STARTED;
1065 +
1066 + my_should_sync = 0;
1067
1068 /*
1069 - * Determine lowest nodeid in old regular configuration for the
1070 - * purpose of executing the synchronization algorithm
1071 + * Handle regular configuration
1072 */
1073 - if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
1074 - for (i = 0; i < left_list_entries; i++) {
1075 - for (j = 0; j < my_member_list_entries; j++) {
1076 - if (left_list[i] == my_member_list[j]) {
1077 - my_member_list[j] = 0;
1078 + lowest_nodeid = 0xffffffff;
1079 +
1080 + for (i = 0; i < my_old_member_list_entries; i++) {
1081 + for (j = 0; j < member_list_entries; j++) {
1082 + if (my_old_member_list[i] == member_list[j]) {
1083 + if (lowest_nodeid > member_list[j]) {
1084 + lowest_nodeid = member_list[j];
1085 }
1086 }
1087 - }
1088 - }
1089 -
1090 - my_lowest_nodeid = 0xffffffff;
1091 - for (i = 0; i < my_member_list_entries; i++) {
1092 - if ((my_member_list[i] != 0) &&
1093 - (my_member_list[i] < my_lowest_nodeid)) {
1094 -
1095 - my_lowest_nodeid = my_member_list[i];
1096 }
1097 }
1098 + memcpy (my_old_member_list, member_list,
1099 + sizeof (unsigned int) * member_list_entries);
1100 + my_old_member_list_entries = member_list_entries;
1101
1102 - /*
1103 - * Handle regular configuration
1104 - */
1105 - if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
1106 - memcpy (my_member_list, member_list,
1107 - sizeof (unsigned int) * member_list_entries);
1108 - my_member_list_entries = member_list_entries;
1109 - memcpy (&my_saved_ring_id, ring_id,
1110 - sizeof (struct memb_ring_id));
1111 + if ((first_configuration) ||
1112 + (lowest_nodeid == totempg_my_nodeid_get())) {
1113 +
1114 + my_should_sync = 1;
1115 }
1116 + first_configuration = 0;
1117 }
1118
1119 static struct checkpoint *checkpoint_find (
1120 @@ -1057,9 +1034,7 @@
1121 iovec.iov_base = (char *)&req_exec_ckpt_checkpointclose;
1122 iovec.iov_len = sizeof (req_exec_ckpt_checkpointclose);
1123
1124 - assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
1125 -
1126 - return (-1);
1127 + return (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED));
1128 }
1129
1130 static int ckpt_exec_init_fn (struct objdb_iface_ver0 *objdb)
1131 @@ -1301,6 +1276,7 @@
1132 checkpoint->unlinked = 0;
1133 list_init (&checkpoint->list);
1134 list_init (&checkpoint->sections_list_head);
1135 + list_init (&checkpoint->expiry_list);
1136 list_add (&checkpoint->list, &checkpoint_list_head);
1137 checkpoint->reference_count = 1;
1138 checkpoint->retention_timer = 0;
1139 @@ -1401,12 +1377,12 @@
1140 res_lib_ckpt_checkpointopenasync.ckpt_id = checkpoint->ckpt_id;
1141 }
1142
1143 - openais_conn_send_response (
1144 + openais_response_send (
1145 req_exec_ckpt_checkpointopen->source.conn,
1146 &res_lib_ckpt_checkpointopenasync,
1147 sizeof (struct res_lib_ckpt_checkpointopenasync));
1148 - openais_conn_send_response (
1149 - openais_conn_partner_get (req_exec_ckpt_checkpointopen->source.conn),
1150 + openais_dispatch_send (
1151 + req_exec_ckpt_checkpointopen->source.conn,
1152 &res_lib_ckpt_checkpointopenasync,
1153 sizeof (struct res_lib_ckpt_checkpointopenasync));
1154 } else {
1155 @@ -1420,7 +1396,7 @@
1156 }
1157 res_lib_ckpt_checkpointopen.header.error = error;
1158
1159 - openais_conn_send_response (
1160 + openais_response_send (
1161 req_exec_ckpt_checkpointopen->source.conn,
1162 &res_lib_ckpt_checkpointopen,
1163 sizeof (struct res_lib_ckpt_checkpointopen));
1164 @@ -1513,29 +1489,67 @@
1165
1166 }
1167
1168 -void timer_function_retention (void *data)
1169 +int callback_expiry (enum totem_callback_token_type type, void *data)
1170 {
1171 struct checkpoint *checkpoint = (struct checkpoint *)data;
1172 - struct req_exec_ckpt_checkpointretentiondurationexpire req_exec_ckpt_checkpointretentiondurationexpire;
1173 + struct req_exec_ckpt_checkpointunlink req_exec_ckpt_checkpointunlink;
1174 struct iovec iovec;
1175 + unsigned int res;
1176 + struct list_head *list;
1177
1178 - checkpoint->retention_timer = 0;
1179 - req_exec_ckpt_checkpointretentiondurationexpire.header.size =
1180 - sizeof (struct req_exec_ckpt_checkpointretentiondurationexpire);
1181 - req_exec_ckpt_checkpointretentiondurationexpire.header.id =
1182 - SERVICE_ID_MAKE (CKPT_SERVICE,
1183 - MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONEXPIRE);
1184 + list = my_checkpoint_expiry_list_head.next;
1185 + while (!list_empty(&my_checkpoint_expiry_list_head)) {
1186 + checkpoint = list_entry (list,
1187 + struct checkpoint, expiry_list);
1188
1189 - memcpy (&req_exec_ckpt_checkpointretentiondurationexpire.checkpoint_name,
1190 - &checkpoint->name,
1191 - sizeof (mar_name_t));
1192 - req_exec_ckpt_checkpointretentiondurationexpire.ckpt_id =
1193 - checkpoint->ckpt_id;
1194 + if (checkpoint->reference_count == 0) {
1195 + req_exec_ckpt_checkpointunlink.header.size =
1196 + sizeof (struct req_exec_ckpt_checkpointunlink);
1197 + req_exec_ckpt_checkpointunlink.header.id =
1198 + SERVICE_ID_MAKE (CKPT_SERVICE,
1199 + MESSAGE_REQ_EXEC_CKPT_CHECKPOINTUNLINK);
1200 +
1201 + req_exec_ckpt_checkpointunlink.source.conn = 0;
1202 + req_exec_ckpt_checkpointunlink.source.nodeid = 0;
1203 +
1204 + memcpy (&req_exec_ckpt_checkpointunlink.checkpoint_name,
1205 + &checkpoint->name,
1206 + sizeof (mar_name_t));
1207 +
1208 + iovec.iov_base = (char *)&req_exec_ckpt_checkpointunlink;
1209 + iovec.iov_len = sizeof (req_exec_ckpt_checkpointunlink);
1210 +
1211 + res = totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED);
1212 + if (res == -1) {
1213 + return (-1);
1214 + }
1215 + log_printf (LOG_LEVEL_DEBUG,
1216 + "Expiring checkpoint %s\n",
1217 + get_mar_name_t (&checkpoint->name));
1218 + }
1219
1220 - iovec.iov_base = (char *)&req_exec_ckpt_checkpointretentiondurationexpire;
1221 - iovec.iov_len = sizeof (req_exec_ckpt_checkpointretentiondurationexpire);
1222 + list_del (&checkpoint->expiry_list);
1223 + list = my_checkpoint_expiry_list_head.next;
1224 + }
1225 + my_token_callback_active = 0;
1226 + return (0);
1227 +}
1228
1229 - assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
1230 +void timer_function_retention (void *data)
1231 +{
1232 + struct checkpoint *checkpoint = (struct checkpoint *)data;
1233 + checkpoint->retention_timer = 0;
1234 + list_add (&checkpoint->expiry_list, &my_checkpoint_expiry_list_head);
1235 +
1236 + if (my_token_callback_active == 0) {
1237 + totempg_callback_token_create (
1238 + &my_token_callback_handle,
1239 + TOTEM_CALLBACK_TOKEN_SENT,
1240 + 1,
1241 + callback_expiry,
1242 + NULL);
1243 + my_token_callback_active = 1;
1244 + }
1245 }
1246
1247 static void message_handler_req_exec_ckpt_checkpointclose (
1248 @@ -1593,8 +1607,10 @@
1249 res_lib_ckpt_checkpointclose.header.size = sizeof (struct res_lib_ckpt_checkpointclose);
1250 res_lib_ckpt_checkpointclose.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE;
1251 res_lib_ckpt_checkpointclose.header.error = error;
1252 - openais_conn_send_response (req_exec_ckpt_checkpointclose->source.conn,
1253 - &res_lib_ckpt_checkpointclose, sizeof (struct res_lib_ckpt_checkpointclose));
1254 + openais_response_send (
1255 + req_exec_ckpt_checkpointclose->source.conn,
1256 + &res_lib_ckpt_checkpointclose,
1257 + sizeof (struct res_lib_ckpt_checkpointclose));
1258 }
1259
1260 /*
1261 @@ -1646,7 +1662,7 @@
1262 res_lib_ckpt_checkpointunlink.header.size = sizeof (struct res_lib_ckpt_checkpointunlink);
1263 res_lib_ckpt_checkpointunlink.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK;
1264 res_lib_ckpt_checkpointunlink.header.error = error;
1265 - openais_conn_send_response (
1266 + openais_response_send (
1267 req_exec_ckpt_checkpointunlink->source.conn,
1268 &res_lib_ckpt_checkpointunlink,
1269 sizeof (struct res_lib_ckpt_checkpointunlink));
1270 @@ -1694,7 +1710,7 @@
1271 res_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
1272 res_lib_ckpt_checkpointretentiondurationset.header.error = error;
1273
1274 - openais_conn_send_response (
1275 + openais_response_send (
1276 req_exec_ckpt_checkpointretentiondurationset->source.conn,
1277 &res_lib_ckpt_checkpointretentiondurationset,
1278 sizeof (struct res_lib_ckpt_checkpointretentiondurationset));
1279 @@ -1900,7 +1916,8 @@
1280 res_lib_ckpt_sectioncreate.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE;
1281 res_lib_ckpt_sectioncreate.header.error = error;
1282
1283 - openais_conn_send_response (req_exec_ckpt_sectioncreate->source.conn,
1284 + openais_response_send (
1285 + req_exec_ckpt_sectioncreate->source.conn,
1286 &res_lib_ckpt_sectioncreate,
1287 sizeof (struct res_lib_ckpt_sectioncreate));
1288 }
1289 @@ -1965,7 +1982,7 @@
1290 res_lib_ckpt_sectiondelete.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE;
1291 res_lib_ckpt_sectiondelete.header.error = error;
1292
1293 - openais_conn_send_response (
1294 + openais_response_send (
1295 req_exec_ckpt_sectiondelete->source.conn,
1296 &res_lib_ckpt_sectiondelete,
1297 sizeof (struct res_lib_ckpt_sectiondelete));
1298 @@ -2058,7 +2075,7 @@
1299 MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET;
1300 res_lib_ckpt_sectionexpirationtimeset.header.error = error;
1301
1302 - openais_conn_send_response (
1303 + openais_response_send (
1304 req_exec_ckpt_sectionexpirationtimeset->source.conn,
1305 &res_lib_ckpt_sectionexpirationtimeset,
1306 sizeof (struct res_lib_ckpt_sectionexpirationtimeset));
1307 @@ -2168,7 +2185,7 @@
1308 MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE;
1309 res_lib_ckpt_sectionwrite.header.error = error;
1310
1311 - openais_conn_send_response (
1312 + openais_response_send (
1313 req_exec_ckpt_sectionwrite->source.conn,
1314 &res_lib_ckpt_sectionwrite,
1315 sizeof (struct res_lib_ckpt_sectionwrite));
1316 @@ -2265,7 +2282,7 @@
1317 MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE;
1318 res_lib_ckpt_sectionoverwrite.header.error = error;
1319
1320 - openais_conn_send_response (
1321 + openais_response_send (
1322 req_exec_ckpt_sectionoverwrite->source.conn,
1323 &res_lib_ckpt_sectionoverwrite,
1324 sizeof (struct res_lib_ckpt_sectionoverwrite));
1325 @@ -2358,7 +2375,7 @@
1326 res_lib_ckpt_sectionread.data_read = section_size;
1327 }
1328
1329 - openais_conn_send_response (
1330 + openais_response_send (
1331 req_exec_ckpt_sectionread->source.conn,
1332 &res_lib_ckpt_sectionread,
1333 sizeof (struct res_lib_ckpt_sectionread));
1334 @@ -2369,7 +2386,7 @@
1335 if (error == SA_AIS_OK) {
1336 char *sd;
1337 sd = (char *)checkpoint_section->section_data;
1338 - openais_conn_send_response (
1339 + openais_response_send (
1340 req_exec_ckpt_sectionread->source.conn,
1341 &sd[req_exec_ckpt_sectionread->data_offset],
1342 section_size);
1343 @@ -2394,6 +2411,7 @@
1344 struct checkpoint_cleanup *checkpoint_cleanup;
1345 struct list_head *list;
1346 struct ckpt_pd *ckpt_pd = (struct ckpt_pd *)openais_conn_private_data_get (conn);
1347 + unsigned int res;
1348
1349 log_printf (LOG_LEVEL_DEBUG, "checkpoint exit conn %p\n", conn);
1350
1351 @@ -2407,9 +2425,16 @@
1352 struct checkpoint_cleanup, list);
1353
1354 assert (checkpoint_cleanup->checkpoint_name.length != 0);
1355 - ckpt_checkpoint_close (
1356 + res = ckpt_checkpoint_close (
1357 &checkpoint_cleanup->checkpoint_name,
1358 checkpoint_cleanup->ckpt_id);
1359 + /*
1360 + * If checkpoint_close fails because of full totem queue
1361 + * return -1 ande try again later
1362 + */
1363 + if (res == -1) {
1364 + return (-1);
1365 + }
1366
1367 list_del (&checkpoint_cleanup->list);
1368 free (checkpoint_cleanup);
1369 @@ -2578,7 +2603,7 @@
1370 res_lib_ckpt_activereplicaset.header.id = MESSAGE_RES_CKPT_ACTIVEREPLICASET;
1371 res_lib_ckpt_activereplicaset.header.error = error;
1372
1373 - openais_conn_send_response (
1374 + openais_response_send (
1375 conn,
1376 &res_lib_ckpt_activereplicaset,
1377 sizeof (struct res_lib_ckpt_activereplicaset));
1378 @@ -2641,7 +2666,7 @@
1379 res_lib_ckpt_checkpointstatusget.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET;
1380 res_lib_ckpt_checkpointstatusget.header.error = SA_AIS_ERR_NOT_EXIST;
1381 }
1382 - openais_conn_send_response (
1383 + openais_response_send (
1384 conn,
1385 &res_lib_ckpt_checkpointstatusget,
1386 sizeof (struct res_lib_ckpt_checkpointstatusget));
1387 @@ -2655,8 +2680,6 @@
1388 struct req_exec_ckpt_sectioncreate req_exec_ckpt_sectioncreate;
1389 struct iovec iovecs[2];
1390
1391 - log_printf (LOG_LEVEL_DEBUG, "Section create from conn %p\n", conn);
1392 -
1393 req_exec_ckpt_sectioncreate.header.id =
1394 SERVICE_ID_MAKE (CKPT_SERVICE,
1395 MESSAGE_REQ_EXEC_CKPT_SECTIONCREATE);
1396 @@ -2692,7 +2715,6 @@
1397 }
1398
1399 if (iovecs[1].iov_len > 0) {
1400 - log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %p\n", iovecs[1].iov_base);
1401 assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 2, TOTEMPG_AGREED) == 0);
1402 } else {
1403 assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
1404 @@ -2967,7 +2989,7 @@
1405 res_lib_ckpt_checkpointsynchronize.header.size = sizeof (struct res_lib_ckpt_checkpointsynchronize);
1406 res_lib_ckpt_checkpointsynchronize.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE;
1407
1408 - openais_conn_send_response (
1409 + openais_response_send (
1410 conn,
1411 &res_lib_ckpt_checkpointsynchronize,
1412 sizeof (struct res_lib_ckpt_checkpointsynchronize));
1413 @@ -2998,13 +3020,13 @@
1414 res_lib_ckpt_checkpointsynchronizeasync.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC;
1415 res_lib_ckpt_checkpointsynchronizeasync.invocation = req_lib_ckpt_checkpointsynchronizeasync->invocation;
1416
1417 - openais_conn_send_response (
1418 + openais_response_send (
1419 conn,
1420 &res_lib_ckpt_checkpointsynchronizeasync,
1421 sizeof (struct res_lib_ckpt_checkpointsynchronizeasync));
1422
1423 - openais_conn_send_response (
1424 - openais_conn_partner_get (conn),
1425 + openais_dispatch_send (
1426 + conn,
1427 &res_lib_ckpt_checkpointsynchronizeasync,
1428 sizeof (struct res_lib_ckpt_checkpointsynchronizeasync));
1429 }
1430 @@ -3133,7 +3155,7 @@
1431 res_lib_ckpt_sectioniterationinitialize.max_section_id_size =
1432 checkpoint->checkpoint_creation_attributes.max_section_id_size;
1433
1434 - openais_conn_send_response (
1435 + openais_response_send (
1436 conn,
1437 &res_lib_ckpt_sectioniterationinitialize,
1438 sizeof (struct res_lib_ckpt_sectioniterationinitialize));
1439 @@ -3174,7 +3196,7 @@
1440 res_lib_ckpt_sectioniterationfinalize.header.id = MESSAGE_RES_CKPT_SECTIONITERATIONFINALIZE;
1441 res_lib_ckpt_sectioniterationfinalize.header.error = error;
1442
1443 - openais_conn_send_response (
1444 + openais_response_send (
1445 conn,
1446 &res_lib_ckpt_sectioniterationfinalize,
1447 sizeof (struct res_lib_ckpt_sectioniterationfinalize));
1448 @@ -3262,13 +3284,13 @@
1449 res_lib_ckpt_sectioniterationnext.header.id = MESSAGE_RES_CKPT_SECTIONITERATIONNEXT;
1450 res_lib_ckpt_sectioniterationnext.header.error = error;
1451
1452 - openais_conn_send_response (
1453 + openais_response_send (
1454 conn,
1455 &res_lib_ckpt_sectioniterationnext,
1456 sizeof (struct res_lib_ckpt_sectioniterationnext));
1457
1458 if (error == SA_AIS_OK) {
1459 - openais_conn_send_response (
1460 + openais_response_send (
1461 conn,
1462 checkpoint_section->section_descriptor.section_id.id,
1463 checkpoint_section->section_descriptor.section_id.id_len);
1464 @@ -3366,19 +3388,29 @@
1465 list_init (ckpt_list_head);
1466 }
1467
1468 -static inline void sync_checkpoints_enter (void)
1469 +static inline void sync_gloalid_enter (void)
1470 {
1471 struct checkpoint *checkpoint;
1472
1473 ENTER();
1474
1475 - my_sync_state = SYNC_STATE_CHECKPOINT;
1476 - my_iteration_state = ITERATION_STATE_CHECKPOINT;
1477 - my_iteration_state_checkpoint = checkpoint_list_head.next;
1478 + my_sync_state = SYNC_STATE_GLOBALID;
1479 +
1480 + my_iteration_state_checkpoint_list = checkpoint_list_head.next;
1481
1482 checkpoint = list_entry (checkpoint_list_head.next, struct checkpoint,
1483 list);
1484 - my_iteration_state_section = checkpoint->sections_list_head.next;
1485 + my_iteration_state_section_list = checkpoint->sections_list_head.next;
1486 +
1487 + LEAVE();
1488 +}
1489 +
1490 +static inline void sync_checkpoints_enter (void)
1491 +{
1492 + ENTER();
1493 +
1494 + my_sync_state = SYNC_STATE_CHECKPOINT;
1495 + my_iteration_state = ITERATION_STATE_CHECKPOINT;
1496
1497 LEAVE();
1498 }
1499 @@ -3386,13 +3418,15 @@
1500 static inline void sync_refcounts_enter (void)
1501 {
1502 my_sync_state = SYNC_STATE_REFCOUNT;
1503 +
1504 + my_iteration_state_checkpoint_list = checkpoint_list_head.next;
1505 }
1506
1507 static void ckpt_sync_init (void)
1508 {
1509 ENTER();
1510
1511 - sync_checkpoints_enter();
1512 + sync_gloalid_enter();
1513
1514 LEAVE();
1515 }
1516 @@ -3432,6 +3466,19 @@
1517 return (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED));
1518 }
1519
1520 +static int sync_checkpoint_globalid_transmit (void)
1521 +{
1522 + struct checkpoint checkpoint;
1523 +
1524 + strcpy ((char *)checkpoint.name.value, GLOBALID_CHECKPOINT_NAME);
1525 +
1526 + checkpoint.name.length = strlen (GLOBALID_CHECKPOINT_NAME);
1527 + checkpoint.ckpt_id = global_ckpt_id;
1528 +
1529 + return (sync_checkpoint_transmit(&checkpoint));
1530 +}
1531 +
1532 +
1533 static int sync_checkpoint_section_transmit (
1534 struct checkpoint *checkpoint,
1535 struct checkpoint_section *checkpoint_section)
1536 @@ -3521,25 +3568,62 @@
1537 struct list_head *section_list;
1538 unsigned int res = 0;
1539
1540 - for (checkpoint_list = checkpoint_list_head.next;
1541 + /*
1542 + * iterate through all checkpoints or sections
1543 + * from the last successfully transmitted checkpoint or sectoin
1544 + */
1545 + for (checkpoint_list = my_iteration_state_checkpoint_list;
1546 checkpoint_list != &checkpoint_list_head;
1547 checkpoint_list = checkpoint_list->next) {
1548
1549 checkpoint = list_entry (checkpoint_list, struct checkpoint, list);
1550
1551 - res = sync_checkpoint_transmit (checkpoint);
1552 - if (res != 0) {
1553 - break;
1554 + /*
1555 + * Synchronize a checkpoint if there is room in the totem
1556 + * buffers and we didn't previously synchronize a checkpoint
1557 + */
1558 + if (my_iteration_state == ITERATION_STATE_CHECKPOINT) {
1559 + res = sync_checkpoint_transmit (checkpoint);
1560 + if (res != 0) {
1561 + /*
1562 + * Couldn't sync this checkpoint keep processing
1563 + */
1564 + return (-1);
1565 + }
1566 + my_iteration_state_section_list = checkpoint->sections_list_head.next;
1567 + my_iteration_state = ITERATION_STATE_SECTION;
1568 }
1569 - for (section_list = checkpoint->sections_list_head.next;
1570 +
1571 + /*
1572 + * Synchronize a checkpoint section if there is room in the
1573 + * totem buffers
1574 + */
1575 + for (section_list = my_iteration_state_section_list;
1576 section_list != &checkpoint->sections_list_head;
1577 section_list = section_list->next) {
1578
1579 checkpoint_section = list_entry (section_list, struct checkpoint_section, list);
1580 res = sync_checkpoint_section_transmit (checkpoint, checkpoint_section);
1581 + if (res != 0) {
1582 + /*
1583 + * Couldn't sync this section keep processing
1584 + */
1585 + return (-1);
1586 + }
1587 + my_iteration_state_section_list = section_list->next;
1588 }
1589 +
1590 + /*
1591 + * Continue to iterating checkpoints
1592 + */
1593 + my_iteration_state = ITERATION_STATE_CHECKPOINT;
1594 + my_iteration_state_checkpoint_list = checkpoint_list->next;
1595 }
1596 - return (res);
1597 +
1598 + /*
1599 + * all checkpoints and sections iterated
1600 + */
1601 + return (0);
1602 }
1603
1604 unsigned int sync_refcounts_iterate (void)
1605 @@ -3548,7 +3632,7 @@
1606 struct list_head *list;
1607 unsigned int res = 0;
1608
1609 - for (list = checkpoint_list_head.next;
1610 + for (list = my_iteration_state_checkpoint_list;
1611 list != &checkpoint_list_head;
1612 list = list->next) {
1613
1614 @@ -3558,48 +3642,68 @@
1615 if (res != 0) {
1616 break;
1617 }
1618 + my_iteration_state_checkpoint_list = list->next;
1619 }
1620 return (res);
1621 }
1622
1623 static int ckpt_sync_process (void)
1624 {
1625 - unsigned int done_queueing = 1;
1626 - unsigned int continue_processing = 0;
1627 + unsigned int done_queueing;
1628 + unsigned int continue_processing;
1629 unsigned int res;
1630
1631 ENTER();
1632
1633 + continue_processing = 0;
1634 +
1635 switch (my_sync_state) {
1636 + case SYNC_STATE_GLOBALID:
1637 + done_queueing = 1;
1638 + continue_processing = 1;
1639 + if (my_should_sync) {
1640 + res = sync_checkpoint_globalid_transmit ();
1641 + if (res != 0) {
1642 + done_queueing = 0;
1643 + }
1644 + }
1645 + if (done_queueing) {
1646 + sync_checkpoints_enter ();
1647 + }
1648 + break;
1649 +
1650 case SYNC_STATE_CHECKPOINT:
1651 - if (my_lowest_nodeid == this_ip->nodeid) {
1652 + done_queueing = 1;
1653 + continue_processing = 1;
1654 +
1655 + if (my_should_sync) {
1656 TRACE1 ("should transmit checkpoints because lowest member in old configuration.\n");
1657 res = sync_checkpoints_iterate ();
1658
1659 - if (res == 0) {
1660 - done_queueing = 1;
1661 + /*
1662 + * Not done iterating checkpoints
1663 + */
1664 + if (res != 0) {
1665 + done_queueing = 0;
1666 }
1667 }
1668 if (done_queueing) {
1669 sync_refcounts_enter ();
1670 }
1671 -
1672 - /*
1673 - * TODO recover current iteration state
1674 - */
1675 - continue_processing = 1;
1676 break;
1677
1678 case SYNC_STATE_REFCOUNT:
1679 - done_queueing = 1;
1680 - if (my_lowest_nodeid == this_ip->nodeid) {
1681 + if (my_should_sync) {
1682 TRACE1 ("transmit refcounts because this processor is the lowest member in old configuration.\n");
1683 res = sync_refcounts_iterate ();
1684 - }
1685 - if (done_queueing) {
1686 - continue_processing = 0;
1687 + if (res != 0) {
1688 + continue_processing = 1;
1689 + }
1690 }
1691 break;
1692 +
1693 + default:
1694 + assert (0);
1695 }
1696
1697 LEAVE();
1698 @@ -3620,7 +3724,7 @@
1699
1700 list_init (&sync_checkpoint_list_head);
1701
1702 - my_sync_state = SYNC_STATE_CHECKPOINT;
1703 + my_sync_state = SYNC_STATE_NOT_STARTED;
1704
1705 LEAVE();
1706 }
1707 @@ -3648,6 +3752,22 @@
1708 return;
1709 }
1710
1711 + /*
1712 + * Discard checkpoints that are used to synchronize the global_ckpt_id
1713 + * also setting the global ckpt_id as well.
1714 + */
1715 + if (memcmp (&req_exec_ckpt_sync_checkpoint->checkpoint_name.value,
1716 + GLOBALID_CHECKPOINT_NAME,
1717 + req_exec_ckpt_sync_checkpoint->checkpoint_name.length) == 0) {
1718 +
1719 + if (req_exec_ckpt_sync_checkpoint->ckpt_id >= global_ckpt_id) {
1720 + global_ckpt_id = req_exec_ckpt_sync_checkpoint->ckpt_id + 1;
1721 + }
1722 +
1723 + LEAVE();
1724 + return;
1725 + }
1726 +
1727 checkpoint = checkpoint_find_specific (
1728 &sync_checkpoint_list_head,
1729 &req_exec_ckpt_sync_checkpoint->checkpoint_name,
1730 diff -uNr openais-0.80.3/exec/clm.c openais-0.80.3-r1661/exec/clm.c
1731 --- openais-0.80.3/exec/clm.c 2007-06-24 08:33:09.000000000 +0200
1732 +++ openais-0.80.3-r1661/exec/clm.c 2008-11-17 15:54:02.380604445 +0100
1733 @@ -262,24 +262,29 @@
1734 mar_clm_cluster_node_t cluster_node __attribute__((aligned(8)));
1735 };
1736
1737 -static int clm_exec_init_fn (struct objdb_iface_ver0 *objdb)
1738 +static void my_cluster_node_load (void)
1739 {
1740 - log_init ("CLM");
1741 + struct totem_ip_address interfaces[INTERFACE_MAX];
1742 + unsigned int iface_count;
1743 + char **status;
1744 + const char *iface_string;
1745 +
1746 + totempg_ifaces_get (
1747 + totempg_my_nodeid_get (),
1748 + interfaces,
1749 + &status,
1750 + &iface_count);
1751
1752 - memset (cluster_node_entries, 0,
1753 - sizeof (mar_clm_cluster_node_t) * PROCESSOR_COUNT_MAX);
1754 + iface_string = totemip_print (&interfaces[0]);
1755
1756 - /*
1757 - * Build local cluster node data structure
1758 - */
1759 sprintf ((char *)my_cluster_node.node_address.value, "%s",
1760 - totemip_print (this_ip));
1761 + iface_string);
1762 my_cluster_node.node_address.length =
1763 strlen ((char *)my_cluster_node.node_address.value);
1764 - if (this_ip->family == AF_INET) {
1765 + if (totempg_my_family_get () == AF_INET) {
1766 my_cluster_node.node_address.family = SA_CLM_AF_INET;
1767 } else
1768 - if (this_ip->family == AF_INET6) {
1769 + if (totempg_my_family_get () == AF_INET6) {
1770 my_cluster_node.node_address.family = SA_CLM_AF_INET6;
1771 } else {
1772 assert (0);
1773 @@ -289,8 +294,20 @@
1774 (char *)my_cluster_node.node_address.value);
1775 my_cluster_node.node_name.length =
1776 my_cluster_node.node_address.length;
1777 - my_cluster_node.node_id = this_ip->nodeid;
1778 + my_cluster_node.node_id = totempg_my_nodeid_get ();
1779 my_cluster_node.member = 1;
1780 +
1781 + memcpy (&cluster_node_entries[0], &my_cluster_node,
1782 + sizeof (mar_clm_cluster_node_t));
1783 +}
1784 +
1785 +static int clm_exec_init_fn (struct objdb_iface_ver0 *objdb)
1786 +{
1787 + log_init ("CLM");
1788 +
1789 + memset (cluster_node_entries, 0,
1790 + sizeof (mar_clm_cluster_node_t) * PROCESSOR_COUNT_MAX);
1791 +
1792 {
1793 #if defined(OPENAIS_LINUX)
1794 struct sysinfo s_info;
1795 @@ -313,7 +330,6 @@
1796 #endif
1797 }
1798
1799 - memcpy (&cluster_node_entries[0], &my_cluster_node, sizeof (mar_clm_cluster_node_t));
1800 cluster_node_count = 1;
1801
1802 main_clm_get_by_nodeid = clm_get_by_nodeid;
1803 @@ -391,7 +407,7 @@
1804 /*
1805 * Send notifications to all CLM listeners
1806 */
1807 - openais_conn_send_response (
1808 + openais_dispatch_send (
1809 clm_pd->conn,
1810 &res_lib_clm_clustertrack,
1811 sizeof (struct res_lib_clm_clustertrack));
1812 @@ -519,20 +535,7 @@
1813 * Load the my_cluster_node data structure in case we are
1814 * transitioning to network interface up or down
1815 */
1816 - sprintf ((char *)my_cluster_node.node_address.value, "%s", totemip_print (this_ip));
1817 - my_cluster_node.node_address.length = strlen ((char *)my_cluster_node.node_address.value);
1818 - if (this_ip->family == AF_INET) {
1819 - my_cluster_node.node_address.family = SA_CLM_AF_INET;
1820 - } else
1821 - if (this_ip->family == AF_INET6) {
1822 - my_cluster_node.node_address.family = SA_CLM_AF_INET6;
1823 - } else {
1824 - assert (0);
1825 - }
1826 - strcpy ((char *)my_cluster_node.node_name.value,
1827 - (char *)my_cluster_node.node_address.value);
1828 - my_cluster_node.node_name.length = my_cluster_node.node_address.length;
1829 - my_cluster_node.node_id = this_ip->nodeid;
1830 + my_cluster_node_load ();
1831 }
1832
1833 /*
1834 @@ -664,14 +667,16 @@
1835 list_add (&clm_pd->list, &library_notification_send_listhead);
1836 }
1837
1838 - openais_conn_send_response (conn, &res_lib_clm_clustertrack,
1839 + openais_response_send (
1840 + conn,
1841 + &res_lib_clm_clustertrack,
1842 sizeof (struct res_lib_clm_clustertrack));
1843
1844 if (req_lib_clm_clustertrack->return_in_callback) {
1845 res_lib_clm_clustertrack.header.id = MESSAGE_RES_CLM_TRACKCALLBACK;
1846
1847 - openais_conn_send_response (
1848 - openais_conn_partner_get (conn),
1849 + openais_dispatch_send (
1850 + conn,
1851 &res_lib_clm_clustertrack,
1852 sizeof (struct res_lib_clm_clustertrack));
1853 }
1854 @@ -696,7 +701,9 @@
1855 list_del (&clm_pd->list);
1856 list_init (&clm_pd->list);
1857
1858 - openais_conn_send_response (conn, &res_lib_clm_trackstop,
1859 + openais_response_send (
1860 + conn,
1861 + &res_lib_clm_trackstop,
1862 sizeof (struct res_lib_clm_trackstop));
1863 }
1864
1865 @@ -732,7 +739,11 @@
1866 if (valid) {
1867 memcpy (&res_clm_nodeget.cluster_node, cluster_node, sizeof (mar_clm_cluster_node_t));
1868 }
1869 - openais_conn_send_response (conn, &res_clm_nodeget, sizeof (struct res_clm_nodeget));
1870 +
1871 + openais_response_send (
1872 + conn,
1873 + &res_clm_nodeget,
1874 + sizeof (struct res_clm_nodeget));
1875 }
1876
1877 static void message_handler_req_lib_clm_nodegetasync (void *conn, void *msg)
1878 @@ -767,7 +778,9 @@
1879 res_clm_nodegetasync.header.id = MESSAGE_RES_CLM_NODEGETASYNC;
1880 res_clm_nodegetasync.header.error = SA_AIS_OK;
1881
1882 - openais_conn_send_response (conn, &res_clm_nodegetasync,
1883 + openais_response_send (
1884 + conn,
1885 + &res_clm_nodegetasync,
1886 sizeof (struct res_clm_nodegetasync));
1887
1888 /*
1889 @@ -781,7 +794,8 @@
1890 memcpy (&res_clm_nodegetcallback.cluster_node, cluster_node,
1891 sizeof (mar_clm_cluster_node_t));
1892 }
1893 - openais_conn_send_response (openais_conn_partner_get (conn),
1894 + openais_dispatch_send (
1895 + conn,
1896 &res_clm_nodegetcallback,
1897 sizeof (struct res_clm_nodegetcallback));
1898 }
1899 diff -uNr openais-0.80.3/exec/cpg.c openais-0.80.3-r1661/exec/cpg.c
1900 --- openais-0.80.3/exec/cpg.c 2007-06-24 08:33:09.000000000 +0200
1901 +++ openais-0.80.3-r1661/exec/cpg.c 2008-11-17 15:54:02.380604445 +0100
1902 @@ -1,5 +1,5 @@
1903 /*
1904 - * Copyright (c) 2006-2007 Red Hat, Inc.
1905 + * Copyright (c) 2006 Red Hat, Inc.
1906 * Copyright (c) 2006 Sun Microsystems, Inc.
1907 *
1908 * All rights reserved.
1909 @@ -32,6 +32,9 @@
1910 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
1911 * THE POSSIBILITY OF SUCH DAMAGE.
1912 */
1913 +#ifndef OPENAIS_BSD
1914 +#include <alloca.h>
1915 +#endif
1916 #include <sys/types.h>
1917 #include <sys/socket.h>
1918 #include <sys/un.h>
1919 @@ -60,8 +63,11 @@
1920 #include "totempg.h"
1921 #include "totemip.h"
1922 #include "main.h"
1923 +#include "flow.h"
1924 +#include "tlist.h"
1925 #include "ipc.h"
1926 #include "mempool.h"
1927 +#include "objdb.h"
1928 #include "service.h"
1929 #include "jhash.h"
1930 #include "swab.h"
1931 @@ -255,7 +261,7 @@
1932 };
1933
1934 struct openais_service_handler cpg_service_handler = {
1935 - .name = (unsigned char*)"openais cluster closed process group service v1.01",
1936 + .name = (unsigned char *)"openais cluster closed process group service v1.01",
1937 .id = CPG_SERVICE,
1938 .private_data_size = sizeof (struct process_info),
1939 .flow_control = OPENAIS_FLOW_CONTROL_REQUIRED,
1940 @@ -434,14 +440,14 @@
1941 }
1942
1943 if (conn) {
1944 - openais_conn_send_response(conn, buf, size);
1945 + openais_dispatch_send(conn, buf, size);
1946 }
1947 else {
1948 /* Send it to all listeners */
1949 for (iter = gi->members.next, tmp=iter->next; iter != &gi->members; iter = tmp, tmp=iter->next) {
1950 struct process_info *pi = list_entry(iter, struct process_info, list);
1951 if (pi->trackerconn && (pi->flags & PI_FLAG_MEMBER)) {
1952 - if (openais_conn_send_response(pi->trackerconn, buf, size) == -1) {
1953 + if (openais_dispatch_send(pi->trackerconn, buf, size) == -1) {
1954 // Error ??
1955 }
1956 }
1957 @@ -477,14 +483,17 @@
1958 struct group_info *gi = pi->group;
1959 mar_cpg_address_t notify_info;
1960
1961 - log_printf(LOG_LEVEL_DEBUG, "exit_fn for conn=%p\n", conn);
1962 -
1963 if (gi) {
1964 notify_info.pid = pi->pid;
1965 - notify_info.nodeid = this_ip->nodeid;
1966 + notify_info.nodeid = totempg_my_nodeid_get();
1967 notify_info.reason = CONFCHG_CPG_REASON_PROCDOWN;
1968 cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN);
1969 list_del(&pi->list);
1970 + openais_ipc_flow_control_destroy (
1971 + conn,
1972 + CPG_SERVICE,
1973 + (unsigned char *)gi->group_name.value,
1974 + (unsigned int)gi->group_name.length);
1975 }
1976 return (0);
1977 }
1978 @@ -531,7 +540,7 @@
1979 req_exec_cpg_procjoin.header.size = sizeof(req_exec_cpg_procjoin);
1980 req_exec_cpg_procjoin.header.id = SERVICE_ID_MAKE(CPG_SERVICE, fn);
1981
1982 - req_exec_cpg_iovec.iov_base = &req_exec_cpg_procjoin;
1983 + req_exec_cpg_iovec.iov_base = (char *)&req_exec_cpg_procjoin;
1984 req_exec_cpg_iovec.iov_len = sizeof(req_exec_cpg_procjoin);
1985
1986 result = totempg_groups_mcast_joined (openais_group_handle, &req_exec_cpg_iovec, 1, TOTEMPG_AGREED);
1987 @@ -544,15 +553,17 @@
1988 struct list_head *remlist)
1989 {
1990 int i;
1991 - struct list_head *iter, *iter2, *tmp;
1992 + struct list_head *iter, *iter2;
1993 struct process_info *pi;
1994 struct group_info *gi;
1995
1996 for (i=0; i < GROUP_HASH_SIZE; i++) {
1997 - for (iter = group_lists[i].next; iter != &group_lists[i]; iter = iter->next) {
1998 + for (iter = group_lists[i].next; iter != &group_lists[i];) {
1999 gi = list_entry(iter, struct group_info, list);
2000 - for (iter2 = gi->members.next, tmp = iter2->next; iter2 != &gi->members; iter2 = tmp, tmp = iter2->next) {
2001 + iter = iter->next;
2002 + for (iter2 = gi->members.next; iter2 != &gi->members;) {
2003 pi = list_entry(iter2, struct process_info, list);
2004 + iter2 = iter2->next;
2005
2006 if (pi->nodeid == nodeid) {
2007
2008 @@ -627,8 +638,8 @@
2009 lowest_nodeid = member_list[i];
2010 }
2011
2012 - log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, this_ip->nodeid);
2013 - if (lowest_nodeid == this_ip->nodeid) {
2014 + log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, totempg_my_nodeid_get());
2015 + if (lowest_nodeid == totempg_my_nodeid_get()) {
2016
2017 req_exec_cpg_downlist.header.id = SERVICE_ID_MAKE(CPG_SERVICE, MESSAGE_REQ_EXEC_CPG_DOWNLIST);
2018 req_exec_cpg_downlist.header.size = sizeof(struct req_exec_cpg_downlist);
2019 @@ -643,7 +654,7 @@
2020
2021 /* Don't send this message until we get the final configuration message */
2022 if (configuration_type == TOTEM_CONFIGURATION_REGULAR && req_exec_cpg_downlist.left_nodes) {
2023 - req_exec_cpg_iovec.iov_base = &req_exec_cpg_downlist;
2024 + req_exec_cpg_iovec.iov_base = (char *)&req_exec_cpg_downlist;
2025 req_exec_cpg_iovec.iov_len = req_exec_cpg_downlist.header.size;
2026
2027 totempg_groups_mcast_joined (openais_group_handle, &req_exec_cpg_iovec, 1, TOTEMPG_AGREED);
2028 @@ -688,10 +699,16 @@
2029 static void exec_cpg_downlist_endian_convert (void *msg)
2030 {
2031 struct req_exec_cpg_downlist *req_exec_cpg_downlist = (struct req_exec_cpg_downlist *)msg;
2032 + unsigned int i;
2033
2034 req_exec_cpg_downlist->left_nodes = swab32(req_exec_cpg_downlist->left_nodes);
2035 +
2036 + for (i = 0; i < req_exec_cpg_downlist->left_nodes; i++) {
2037 + req_exec_cpg_downlist->nodeids[i] = swab32(req_exec_cpg_downlist->nodeids[i]);
2038 + }
2039 }
2040
2041 +
2042 static void exec_cpg_mcast_endian_convert (void *msg)
2043 {
2044 struct req_exec_cpg_mcast *req_exec_cpg_mcast = (struct req_exec_cpg_mcast *)msg;
2045 @@ -723,7 +740,7 @@
2046 if (pi->pid == pid && pi->nodeid == nodeid) {
2047
2048 /* It could be a local join message */
2049 - if ((nodeid == this_ip->nodeid) &&
2050 + if ((nodeid == totempg_my_nodeid_get()) &&
2051 (!pi->flags & PI_FLAG_MEMBER)) {
2052 goto local_join;
2053 } else {
2054 @@ -810,7 +827,7 @@
2055 struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = (struct req_exec_cpg_procjoin *)message;
2056 struct group_info *gi;
2057 struct process_info *pi;
2058 - struct list_head *iter;
2059 + volatile struct list_head *iter;
2060 mar_cpg_address_t notify_info;
2061
2062 log_printf(LOG_LEVEL_DEBUG, "got procleave message from cluster node %d\n", nodeid);
2063 @@ -827,19 +844,28 @@
2064 1, &notify_info,
2065 MESSAGE_RES_CPG_CONFCHG_CALLBACK);
2066
2067 - /* Find the node/PID to remove */
2068 - for (iter = gi->members.next; iter != &gi->members; iter = iter->next) {
2069 + /*
2070 + * Find the node/PID to remove
2071 + */
2072 + for (iter = gi->members.next; iter != &gi->members;) {
2073 pi = list_entry(iter, struct process_info, list);
2074 +
2075 + iter = iter->next;
2076 +
2077 if (pi->pid == req_exec_cpg_procjoin->pid &&
2078 pi->nodeid == nodeid) {
2079
2080 - list_del(&pi->list);
2081 - if (!pi->conn)
2082 - free(pi);
2083 -
2084 if (list_empty(&gi->members)) {
2085 remove_group(gi);
2086 }
2087 +
2088 + list_del(&pi->list);
2089 + if (pi->conn) {
2090 + openais_conn_info_refcnt_dec(pi->conn);
2091 + } else {
2092 + free(pi);
2093 + }
2094 +
2095 break;
2096 }
2097 }
2098 @@ -858,7 +884,7 @@
2099 nodeid);
2100
2101 /* Ignore our own messages */
2102 - if (nodeid == this_ip->nodeid) {
2103 + if (nodeid == totempg_my_nodeid_get()) {
2104 return;
2105 }
2106
2107 @@ -898,6 +924,7 @@
2108 openais_ipc_flow_control_local_decrement (req_exec_cpg_mcast->source.conn);
2109 process_info = (struct process_info *)openais_conn_private_data_get (req_exec_cpg_mcast->source.conn);
2110 res_lib_cpg_mcast->flow_control_state = process_info->flow_control_state;
2111 + openais_conn_info_refcnt_dec (req_exec_cpg_mcast->source.conn);
2112 }
2113 memcpy(&res_lib_cpg_mcast->group_name, &gi->group_name,
2114 sizeof(mar_cpg_name_t));
2115 @@ -907,8 +934,8 @@
2116 /* Send to all interested members */
2117 for (iter = gi->members.next; iter != &gi->members; iter = iter->next) {
2118 struct process_info *pi = list_entry(iter, struct process_info, list);
2119 - if (pi->trackerconn) {
2120 - openais_conn_send_response(
2121 + if (pi->trackerconn && (pi->flags & PI_FLAG_MEMBER)) {
2122 + openais_dispatch_send (
2123 pi->trackerconn,
2124 buf,
2125 res_lib_cpg_mcast->header.size);
2126 @@ -937,7 +964,7 @@
2127 gi = list_entry(iter, struct group_info, list);
2128 for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
2129 struct process_info *pi = list_entry(iter2, struct process_info, list);
2130 - if (pi->pid && pi->nodeid == this_ip->nodeid) {
2131 + if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
2132 count++;
2133 }
2134 }
2135 @@ -964,7 +991,7 @@
2136 for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
2137
2138 struct process_info *pi = list_entry(iter2, struct process_info, list);
2139 - if (pi->pid && pi->nodeid == this_ip->nodeid) {
2140 + if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
2141 memcpy(&jle->group_name, &gi->group_name, sizeof(mar_cpg_name_t));
2142 jle->pid = pi->pid;
2143 jle++;
2144 @@ -987,6 +1014,7 @@
2145 struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
2146 pi->conn = conn;
2147
2148 + openais_conn_info_refcnt_inc (conn);
2149 log_printf(LOG_LEVEL_DEBUG, "lib_init_fn: conn=%p, pi=%p\n", conn, pi);
2150 return (0);
2151 }
2152 @@ -1023,7 +1051,7 @@
2153 pi);
2154
2155 /* Add a node entry for us */
2156 - pi->nodeid = this_ip->nodeid;
2157 + pi->nodeid = totempg_my_nodeid_get();
2158 pi->pid = req_lib_cpg_join->pid;
2159 pi->group = gi;
2160 list_add(&pi->list, &gi->members);
2161 @@ -1035,7 +1063,7 @@
2162 res_lib_cpg_join.header.size = sizeof(res_lib_cpg_join);
2163 res_lib_cpg_join.header.id = MESSAGE_RES_CPG_JOIN;
2164 res_lib_cpg_join.header.error = error;
2165 - openais_conn_send_response(conn, &res_lib_cpg_join, sizeof(res_lib_cpg_join));
2166 + openais_response_send(conn, &res_lib_cpg_join, sizeof(res_lib_cpg_join));
2167 }
2168
2169 /* Leave message from the library */
2170 @@ -1046,8 +1074,6 @@
2171 struct group_info *gi;
2172 SaAisErrorT error = SA_AIS_OK;
2173
2174 - log_printf(LOG_LEVEL_DEBUG, "got leave request on %p\n", conn);
2175 -
2176 if (!pi || !pi->pid || !pi->group) {
2177 error = SA_AIS_ERR_INVALID_PARAM;
2178 goto leave_ret;
2179 @@ -1070,7 +1096,7 @@
2180 res_lib_cpg_leave.header.size = sizeof(res_lib_cpg_leave);
2181 res_lib_cpg_leave.header.id = MESSAGE_RES_CPG_LEAVE;
2182 res_lib_cpg_leave.header.error = error;
2183 - openais_conn_send_response(conn, &res_lib_cpg_leave, sizeof(res_lib_cpg_leave));
2184 + openais_response_send(conn, &res_lib_cpg_leave, sizeof(res_lib_cpg_leave));
2185 }
2186
2187 /* Mcast message from the library */
2188 @@ -1093,7 +1119,7 @@
2189 res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
2190 res_lib_cpg_mcast.header.error = SA_AIS_ERR_ACCESS; /* TODO Better error code ?? */
2191 res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED;
2192 - openais_conn_send_response(conn, &res_lib_cpg_mcast,
2193 + openais_response_send(conn, &res_lib_cpg_mcast,
2194 sizeof(res_lib_cpg_mcast));
2195 return;
2196 }
2197 @@ -1101,15 +1127,16 @@
2198 req_exec_cpg_mcast.header.size = sizeof(req_exec_cpg_mcast) + msglen;
2199 req_exec_cpg_mcast.header.id = SERVICE_ID_MAKE(CPG_SERVICE,
2200 MESSAGE_REQ_EXEC_CPG_MCAST);
2201 + openais_conn_info_refcnt_inc (conn);
2202 req_exec_cpg_mcast.pid = pi->pid;
2203 req_exec_cpg_mcast.msglen = msglen;
2204 message_source_set (&req_exec_cpg_mcast.source, conn);
2205 memcpy(&req_exec_cpg_mcast.group_name, &gi->group_name,
2206 sizeof(mar_cpg_name_t));
2207
2208 - req_exec_cpg_iovec[0].iov_base = &req_exec_cpg_mcast;
2209 + req_exec_cpg_iovec[0].iov_base = (char *)&req_exec_cpg_mcast;
2210 req_exec_cpg_iovec[0].iov_len = sizeof(req_exec_cpg_mcast);
2211 - req_exec_cpg_iovec[1].iov_base = &req_lib_cpg_mcast->message;
2212 + req_exec_cpg_iovec[1].iov_base = (char *)&req_lib_cpg_mcast->message;
2213 req_exec_cpg_iovec[1].iov_len = msglen;
2214
2215 // TODO: guarantee type...
2216 @@ -1120,7 +1147,7 @@
2217 res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
2218 res_lib_cpg_mcast.header.error = SA_AIS_OK;
2219 res_lib_cpg_mcast.flow_control_state = pi->flow_control_state;
2220 - openais_conn_send_response(conn, &res_lib_cpg_mcast,
2221 + openais_response_send(conn, &res_lib_cpg_mcast,
2222 sizeof(res_lib_cpg_mcast));
2223 }
2224
2225 @@ -1134,7 +1161,7 @@
2226 res.size = sizeof(res);
2227 res.id = MESSAGE_RES_CPG_MEMBERSHIP;
2228 res.error = SA_AIS_ERR_ACCESS; /* TODO Better error code */
2229 - openais_conn_send_response(conn, &res, sizeof(res));
2230 + openais_response_send(conn, &res, sizeof(res));
2231 return;
2232 }
2233
2234 @@ -1148,7 +1175,6 @@
2235 struct res_lib_cpg_trackstart res_lib_cpg_trackstart;
2236 struct group_info *gi;
2237 struct process_info *otherpi;
2238 - void *otherconn;
2239 SaAisErrorT error = SA_AIS_OK;
2240
2241 log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn);
2242 @@ -1160,7 +1186,6 @@
2243 }
2244
2245 /* Find the partner connection and add us to it's process_info struct */
2246 - otherconn = openais_conn_partner_get (conn);
2247 otherpi = (struct process_info *)openais_conn_private_data_get (conn);
2248 otherpi->trackerconn = conn;
2249
2250 @@ -1168,7 +1193,7 @@
2251 res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart);
2252 res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART;
2253 res_lib_cpg_trackstart.header.error = SA_AIS_OK;
2254 - openais_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
2255 + openais_response_send(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
2256 }
2257
2258 static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
2259 @@ -1176,7 +1201,6 @@
2260 struct req_lib_cpg_trackstop *req_lib_cpg_trackstop = (struct req_lib_cpg_trackstop *)message;
2261 struct res_lib_cpg_trackstop res_lib_cpg_trackstop;
2262 struct process_info *otherpi;
2263 - void *otherconn;
2264 struct group_info *gi;
2265 SaAisErrorT error = SA_AIS_OK;
2266
2267 @@ -1189,7 +1213,6 @@
2268 }
2269
2270 /* Find the partner connection and add us to it's process_info struct */
2271 - otherconn = openais_conn_partner_get (conn);
2272 otherpi = (struct process_info *)openais_conn_private_data_get (conn);
2273 otherpi->trackerconn = NULL;
2274
2275 @@ -1197,7 +1220,7 @@
2276 res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop);
2277 res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP;
2278 res_lib_cpg_trackstop.header.error = SA_AIS_OK;
2279 - openais_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
2280 + openais_response_send(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
2281 }
2282
2283 static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
2284 @@ -1207,8 +1230,8 @@
2285 res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get);
2286 res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET;
2287 res_lib_cpg_local_get.header.error = SA_AIS_OK;
2288 - res_lib_cpg_local_get.local_nodeid = this_ip->nodeid;
2289 + res_lib_cpg_local_get.local_nodeid = totempg_my_nodeid_get ();
2290
2291 - openais_conn_send_response(conn, &res_lib_cpg_local_get,
2292 + openais_response_send(conn, &res_lib_cpg_local_get,
2293 sizeof(res_lib_cpg_local_get));
2294 }
2295 diff -uNr openais-0.80.3/exec/evs.c openais-0.80.3-r1661/exec/evs.c
2296 --- openais-0.80.3/exec/evs.c 2007-06-24 08:33:09.000000000 +0200
2297 +++ openais-0.80.3-r1661/exec/evs.c 2008-11-17 15:54:02.380604445 +0100
2298 @@ -244,7 +244,8 @@
2299 */
2300 for (list = confchg_notify.next; list != &confchg_notify; list = list->next) {
2301 evs_pd = list_entry (list, struct evs_pd, list);
2302 - openais_conn_send_response (evs_pd->conn,
2303 + openais_dispatch_send (
2304 + evs_pd->conn,
2305 &res_evs_confchg_callback,
2306 sizeof (res_evs_confchg_callback));
2307 }
2308 @@ -262,7 +263,9 @@
2309 list_init (&evs_pd->list);
2310 list_add (&evs_pd->list, &confchg_notify);
2311
2312 - openais_conn_send_response (conn, &res_evs_confchg_callback,
2313 + openais_dispatch_send (
2314 + conn,
2315 + &res_evs_confchg_callback,
2316 sizeof (res_evs_confchg_callback));
2317
2318 return (0);
2319 @@ -308,7 +311,9 @@
2320 res_lib_evs_join.header.id = MESSAGE_RES_EVS_JOIN;
2321 res_lib_evs_join.header.error = error;
2322
2323 - openais_conn_send_response (conn, &res_lib_evs_join,
2324 + openais_response_send (
2325 + conn,
2326 + &res_lib_evs_join,
2327 sizeof (struct res_lib_evs_join));
2328 }
2329
2330 @@ -354,7 +359,9 @@
2331 res_lib_evs_leave.header.id = MESSAGE_RES_EVS_LEAVE;
2332 res_lib_evs_leave.header.error = error;
2333
2334 - openais_conn_send_response (conn, &res_lib_evs_leave,
2335 + openais_response_send (
2336 + conn,
2337 + &res_lib_evs_leave,
2338 sizeof (struct res_lib_evs_leave));
2339 }
2340
2341 @@ -397,7 +404,9 @@
2342 res_lib_evs_mcast_joined.header.id = MESSAGE_RES_EVS_MCAST_JOINED;
2343 res_lib_evs_mcast_joined.header.error = error;
2344
2345 - openais_conn_send_response (conn, &res_lib_evs_mcast_joined,
2346 + openais_response_send (
2347 + conn,
2348 + &res_lib_evs_mcast_joined,
2349 sizeof (struct res_lib_evs_mcast_joined));
2350 }
2351
2352 @@ -443,7 +452,9 @@
2353 res_lib_evs_mcast_groups.header.id = MESSAGE_RES_EVS_MCAST_GROUPS;
2354 res_lib_evs_mcast_groups.header.error = error;
2355
2356 - openais_conn_send_response (conn, &res_lib_evs_mcast_groups,
2357 + openais_response_send (
2358 + conn,
2359 + &res_lib_evs_mcast_groups,
2360 sizeof (struct res_lib_evs_mcast_groups));
2361 }
2362
2363 @@ -454,7 +465,7 @@
2364 res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get);
2365 res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET;
2366 res_lib_evs_membership_get.header.error = EVS_OK;
2367 - res_lib_evs_membership_get.local_nodeid = this_ip->nodeid;
2368 + res_lib_evs_membership_get.local_nodeid = totempg_my_nodeid_get ();
2369 memcpy (&res_lib_evs_membership_get.member_list,
2370 &res_evs_confchg_callback.member_list,
2371 sizeof (res_lib_evs_membership_get.member_list));
2372 @@ -462,7 +473,9 @@
2373 res_lib_evs_membership_get.member_list_entries =
2374 res_evs_confchg_callback.member_list_entries;
2375
2376 - openais_conn_send_response (conn, &res_lib_evs_membership_get,
2377 + openais_response_send (
2378 + conn,
2379 + &res_lib_evs_membership_get,
2380 sizeof (struct res_lib_evs_membership_get));
2381 }
2382
2383 @@ -487,8 +500,10 @@
2384 int i, j;
2385 struct evs_pd *evs_pd;
2386
2387 - res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) +
2388 - req_exec_evs_mcast->msg_len;
2389 + res_evs_deliver_callback.header.size =
2390 + sizeof (struct res_evs_deliver_callback) +
2391 + req_exec_evs_mcast->msg_len;
2392 +
2393 res_evs_deliver_callback.header.id = MESSAGE_RES_EVS_DELIVER_CALLBACK;
2394 res_evs_deliver_callback.header.error = SA_AIS_OK;
2395 res_evs_deliver_callback.msglen = req_exec_evs_mcast->msg_len;
2396 @@ -517,9 +532,13 @@
2397
2398 if (found) {
2399 res_evs_deliver_callback.local_nodeid = nodeid;
2400 - openais_conn_send_response (evs_pd->conn, &res_evs_deliver_callback,
2401 + openais_dispatch_send (
2402 + evs_pd->conn,
2403 + &res_evs_deliver_callback,
2404 sizeof (struct res_evs_deliver_callback));
2405 - openais_conn_send_response (evs_pd->conn, msg_addr,
2406 + openais_dispatch_send (
2407 + evs_pd->conn,
2408 + msg_addr,
2409 req_exec_evs_mcast->msg_len);
2410 }
2411 }
2412 diff -uNr openais-0.80.3/exec/evt.c openais-0.80.3-r1661/exec/evt.c
2413 --- openais-0.80.3/exec/evt.c 2007-06-25 04:22:54.000000000 +0200
2414 +++ openais-0.80.3-r1661/exec/evt.c 2008-11-17 15:54:02.390605772 +0100
2415 @@ -1853,8 +1853,10 @@
2416 res.evd_head.size = sizeof(res);
2417 res.evd_head.id = MESSAGE_RES_EVT_AVAILABLE;
2418 res.evd_head.error = SA_AIS_OK;
2419 - openais_conn_send_response(openais_conn_partner_get(conn),
2420 - &res, sizeof(res));
2421 + openais_dispatch_send (
2422 + conn,
2423 + &res,
2424 + sizeof(res));
2425 }
2426
2427 }
2428 @@ -1987,6 +1989,7 @@
2429 if (!ep) {
2430 log_printf(LOG_LEVEL_WARNING,
2431 "5Memory allocation error, can't deliver event\n");
2432 + free (ed);
2433 return;
2434 }
2435 ep->cel_chan_handle = eco->eco_lib_handle;
2436 @@ -2264,7 +2267,7 @@
2437 res.ico_head.size = sizeof(res);
2438 res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
2439 res.ico_head.error = error;
2440 - openais_conn_send_response(conn, &res, sizeof(res));
2441 + openais_response_send(conn, &res, sizeof(res));
2442 }
2443
2444 /*
2445 @@ -2321,7 +2324,7 @@
2446 res.ico_head.size = sizeof(res);
2447 res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
2448 res.ico_head.error = error;
2449 - openais_conn_send_response(conn, &res, sizeof(res));
2450 + openais_dispatch_send(conn, &res, sizeof(res));
2451 }
2452
2453
2454 @@ -2414,7 +2417,7 @@
2455 res.icc_head.size = sizeof(res);
2456 res.icc_head.id = MESSAGE_RES_EVT_CLOSE_CHANNEL;
2457 res.icc_head.error = ((ret == 0) ? SA_AIS_OK : SA_AIS_ERR_BAD_HANDLE);
2458 - openais_conn_send_response(conn, &res, sizeof(res));
2459 + openais_response_send(conn, &res, sizeof(res));
2460 }
2461
2462 /*
2463 @@ -2486,7 +2489,7 @@
2464 res.iuc_head.size = sizeof(res);
2465 res.iuc_head.id = MESSAGE_RES_EVT_UNLINK_CHANNEL;
2466 res.iuc_head.error = error;
2467 - openais_conn_send_response(conn, &res, sizeof(res));
2468 + openais_response_send(conn, &res, sizeof(res));
2469 }
2470
2471 /*
2472 @@ -2590,7 +2593,7 @@
2473 res.ics_head.size = sizeof(res);
2474 res.ics_head.id = MESSAGE_RES_EVT_SUBSCRIBE;
2475 res.ics_head.error = error;
2476 - openais_conn_send_response(conn, &res, sizeof(res));
2477 + openais_response_send(conn, &res, sizeof(res));
2478
2479 /*
2480 * See if an existing event with a retention time
2481 @@ -2623,7 +2626,7 @@
2482 res.ics_head.size = sizeof(res);
2483 res.ics_head.id = MESSAGE_RES_EVT_SUBSCRIBE;
2484 res.ics_head.error = error;
2485 - openais_conn_send_response(conn, &res, sizeof(res));
2486 + openais_response_send(conn, &res, sizeof(res));
2487 }
2488
2489 /*
2490 @@ -2690,7 +2693,7 @@
2491 res.icu_head.size = sizeof(res);
2492 res.icu_head.id = MESSAGE_RES_EVT_UNSUBSCRIBE;
2493 res.icu_head.error = error;
2494 - openais_conn_send_response(conn, &res, sizeof(res));
2495 + openais_response_send(conn, &res, sizeof(res));
2496 }
2497
2498 /*
2499 @@ -2762,7 +2765,7 @@
2500 res.iep_head.id = MESSAGE_RES_EVT_PUBLISH;
2501 res.iep_head.error = error;
2502 res.iep_event_id = event_id;
2503 - openais_conn_send_response(conn, &res, sizeof(res));
2504 + openais_response_send(conn, &res, sizeof(res));
2505 }
2506
2507 /*
2508 @@ -2826,7 +2829,7 @@
2509 res.iec_head.size = sizeof(res);
2510 res.iec_head.id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME;
2511 res.iec_head.error = error;
2512 - openais_conn_send_response(conn, &res, sizeof(res));
2513 + openais_response_send(conn, &res, sizeof(res));
2514
2515 }
2516
2517 @@ -2865,7 +2868,7 @@
2518 edp->ed_event.led_head.id = MESSAGE_RES_EVT_EVENT_DATA;
2519 edp->ed_event.led_head.error = SA_AIS_OK;
2520 free(cel);
2521 - openais_conn_send_response(conn, &edp->ed_event,
2522 + openais_response_send(conn, &edp->ed_event,
2523 edp->ed_event.led_head.size);
2524 free_event_data(edp);
2525 goto data_get_done;
2526 @@ -2875,7 +2878,7 @@
2527 res.led_head.size = sizeof(res.led_head);
2528 res.led_head.id = MESSAGE_RES_EVT_EVENT_DATA;
2529 res.led_head.error = SA_AIS_ERR_NOT_EXIST;
2530 - openais_conn_send_response(conn, &res, res.led_head.size);
2531 + openais_response_send(conn, &res, res.led_head.size);
2532
2533 /*
2534 * See if there are any events that the app doesn't know about
2535 @@ -3037,7 +3040,7 @@
2536 struct unlink_chan_pending *ucp;
2537 struct retention_time_clear_pending *rtc;
2538 struct libevt_pd *esip =
2539 - openais_conn_private_data_get(openais_conn_partner_get(conn));
2540 + openais_conn_private_data_get(conn);
2541
2542 log_printf(LOG_LEVEL_DEBUG, "saEvtFinalize (Event exit request)\n");
2543 log_printf(LOG_LEVEL_DEBUG, "saEvtFinalize %d evts on list\n",
2544 @@ -3430,7 +3433,7 @@
2545 res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
2546 res.ico_head.error = SA_AIS_ERR_TIMEOUT;
2547 ocp->ocp_invocation = OPEN_TIMED_OUT;
2548 - openais_conn_send_response(ocp->ocp_conn, &res, sizeof(res));
2549 + openais_response_send(ocp->ocp_conn, &res, sizeof(res));
2550 }
2551
2552 /*
2553 @@ -3520,15 +3523,14 @@
2554 resa.ica_channel_handle = handle;
2555 resa.ica_c_handle = ocp->ocp_c_handle;
2556 resa.ica_invocation = ocp->ocp_invocation;
2557 - openais_conn_send_response(openais_conn_partner_get(ocp->ocp_conn),
2558 - &resa, sizeof(resa));
2559 + openais_dispatch_send(ocp->ocp_conn, &resa, sizeof(resa));
2560 } else {
2561 struct res_evt_channel_open res;
2562 res.ico_head.size = sizeof(res);
2563 res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
2564 res.ico_head.error = (ret == 0 ? SA_AIS_OK : SA_AIS_ERR_BAD_HANDLE);
2565 res.ico_channel_handle = handle;
2566 - openais_conn_send_response(ocp->ocp_conn, &res, sizeof(res));
2567 + openais_response_send(ocp->ocp_conn, &res, sizeof(res));
2568 }
2569
2570 if (timer_del_status == 0) {
2571 @@ -3553,7 +3555,7 @@
2572 res.iuc_head.size = sizeof(res);
2573 res.iuc_head.id = MESSAGE_RES_EVT_UNLINK_CHANNEL;
2574 res.iuc_head.error = SA_AIS_OK;
2575 - openais_conn_send_response(ucp->ucp_conn, &res, sizeof(res));
2576 + openais_response_send(ucp->ucp_conn, &res, sizeof(res));
2577
2578 free(ucp);
2579 }
2580 @@ -3573,7 +3575,7 @@
2581 res.iec_head.size = sizeof(res);
2582 res.iec_head.id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME;
2583 res.iec_head.error = ret;
2584 - openais_conn_send_response(rtc->rtc_conn, &res, sizeof(res));
2585 + openais_response_send(rtc->rtc_conn, &res, sizeof(res));
2586
2587 list_del(&rtc->rtc_entry);
2588 free(rtc);
2589 diff -uNr openais-0.80.3/exec/ipc.c openais-0.80.3-r1661/exec/ipc.c
2590 --- openais-0.80.3/exec/ipc.c 2007-06-25 04:22:54.000000000 +0200
2591 +++ openais-0.80.3-r1661/exec/ipc.c 2008-11-17 15:54:02.380604445 +0100
2592 @@ -1,5 +1,4 @@
2593 /*
2594 - * Copyright (c) 2002-2006 MontaVista Software, Inc.
2595 * Copyright (c) 2006-2007 Red Hat, Inc.
2596 *
2597 * All rights reserved.
2598 @@ -32,6 +31,9 @@
2599 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2600 * THE POSSIBILITY OF SUCH DAMAGE.
2601 */
2602 +#ifndef _GNU_SOURCE
2603 +#define _GNU_SOURCE 1
2604 +#endif
2605 #include <pthread.h>
2606 #include <assert.h>
2607 #include <pwd.h>
2608 @@ -54,7 +56,11 @@
2609 #include <signal.h>
2610 #include <sched.h>
2611 #include <time.h>
2612 +#if defined(HAVE_GETPEERUCRED)
2613 +#include <ucred.h>
2614 +#endif
2615
2616 +#include "swab.h"
2617 #include "../include/saAis.h"
2618 #include "../include/list.h"
2619 #include "../include/queue.h"
2620 @@ -66,6 +72,8 @@
2621 #include "mainconfig.h"
2622 #include "totemconfig.h"
2623 #include "main.h"
2624 +#include "flow.h"
2625 +#include "tlist.h"
2626 #include "ipc.h"
2627 #include "flow.h"
2628 #include "service.h"
2629 @@ -79,6 +87,10 @@
2630
2631 #include "util.h"
2632
2633 +#ifdef OPENAIS_SOLARIS
2634 +#define MSG_NOSIGNAL 0
2635 +#endif
2636 +
2637 #define SERVER_BACKLOG 5
2638
2639 /*
2640 @@ -94,11 +106,11 @@
2641
2642 static unsigned int g_gid_valid = 0;
2643
2644 -static struct totem_ip_address *my_ip;
2645 -
2646 static totempg_groups_handle ipc_handle;
2647
2648 -DECLARE_LIST_INIT (conn_info_list_head);
2649 +static pthread_mutex_t conn_io_list_mutex = PTHREAD_MUTEX_INITIALIZER;
2650 +
2651 +DECLARE_LIST_INIT (conn_io_list_head);
2652
2653 static void (*ipc_serialize_lock_fn) (void);
2654
2655 @@ -109,148 +121,282 @@
2656 size_t mlen;
2657 };
2658
2659 -enum conn_state {
2660 - CONN_STATE_ACTIVE,
2661 - CONN_STATE_SECURITY,
2662 - CONN_STATE_REQUESTED,
2663 - CONN_STATE_CLOSED,
2664 - CONN_STATE_DISCONNECTED
2665 +enum conn_io_state {
2666 + CONN_IO_STATE_INITIALIZING,
2667 + CONN_IO_STATE_AUTHENTICATED,
2668 + CONN_IO_STATE_INIT_FAILED
2669 };
2670
2671 -struct conn_info {
2672 - int fd; /* File descriptor */
2673 - unsigned int events; /* events polled for by file descriptor */
2674 - enum conn_state state; /* State of this connection */
2675 - pthread_t thread; /* thread identifier */
2676 +enum conn_info_state {
2677 + CONN_INFO_STATE_INITIALIZING,
2678 + CONN_INFO_STATE_ACTIVE,
2679 + CONN_INFO_STATE_DISCONNECT_REQUESTED,
2680 + CONN_INFO_STATE_DISCONNECTED
2681 +};
2682 +
2683 +struct conn_info;
2684 +
2685 +struct conn_io {
2686 + int fd; /* File descriptor */
2687 + unsigned int events; /* events polled for by file descriptor */
2688 + pthread_t thread; /* thread identifier */
2689 pthread_attr_t thread_attr; /* thread attribute */
2690 - char *inb; /* Input buffer for non-blocking reads */
2691 - int inb_nextheader; /* Next message header starts here */
2692 - int inb_start; /* Start location of input buffer */
2693 - int inb_inuse; /* Bytes currently stored in input buffer */
2694 - struct queue outq; /* Circular queue for outgoing requests */
2695 - int byte_start; /* Byte to start sending from in head of queue */
2696 - enum service_types service;/* Type of service so dispatch knows how to route message */
2697 - int authenticated; /* Is this connection authenticated? */
2698 - void *private_data; /* library connection private data */
2699 - struct conn_info *conn_info_partner; /* partner connection dispatch<->response */
2700 + char *inb; /* Input buffer for non-blocking reads */
2701 + int inb_nextheader; /* Next message header starts here */
2702 + int inb_start; /* Start location of input buffer */
2703 + int inb_inuse; /* Bytes currently stored in input buffer */
2704 + struct queue outq; /* Circular queue for outgoing requests */
2705 + int byte_start; /* Byte to start sending from in head of queue */
2706 + unsigned int fcc; /* flow control local count */
2707 + enum conn_io_state state; /* state of this conn_io connection */
2708 + struct conn_info *conn_info; /* connection information combining multiple conn_io structs */
2709 + unsigned int refcnt; /* reference count for conn_io data structure */
2710 + pthread_mutex_t mutex;
2711 + unsigned int service;
2712 + struct list_head list;
2713 +};
2714 +
2715 +
2716 +struct conn_info {
2717 + enum conn_info_state state; /* State of this connection */
2718 + enum service_types service; /* Type of service so dispatch knows how to route message */
2719 + void *private_data; /* library connection private data */
2720 unsigned int flow_control_handle; /* flow control identifier */
2721 unsigned int flow_control_enabled; /* flow control enabled bit */
2722 - unsigned int flow_control_local_count; /* flow control local count */
2723 enum openais_flow_control flow_control; /* Does this service use IPC flow control */
2724 pthread_mutex_t flow_control_mutex;
2725 + unsigned int flow_control_local_count; /* flow control local count */
2726 int (*lib_exit_fn) (void *conn);
2727 - struct timerlist timerlist;
2728 pthread_mutex_t mutex;
2729 - pthread_mutex_t *shared_mutex;
2730 - struct list_head list;
2731 + struct conn_io *conn_io_response;
2732 + struct conn_io *conn_io_dispatch;
2733 + unsigned int refcnt;
2734 };
2735
2736 -static void *prioritized_poll_thread (void *conn);
2737 -static int conn_info_outq_flush (struct conn_info *conn_info);
2738 -static void libais_deliver (struct conn_info *conn_info);
2739 -static void ipc_flow_control (struct conn_info *conn_info);
2740 +static void *prioritized_poll_thread (void *conn_io_in);
2741 +static int conn_io_outq_flush (struct conn_io *conn_io);
2742 +static void conn_io_deliver (struct conn_io *conn_io);
2743 +//static void ipc_flow_control (struct conn_info *conn_info);
2744 +static inline void conn_info_destroy (struct conn_info *conn_info);
2745 +static void conn_io_destroy (struct conn_io *conn_io);
2746 +static int conn_io_send (struct conn_io *conn_io, void *msg, int mlen);
2747 +static inline struct conn_info *conn_info_create (void);
2748 +static int conn_io_found (struct conn_io *conn_io_to_match);
2749 +
2750 +static int response_init_send (struct conn_io *conn_io, void *message);
2751 +static int dispatch_init_send (struct conn_io *conn_io, void *message);
2752
2753 /*
2754 * IPC Initializers
2755 */
2756
2757 -static int response_init_send_response (
2758 - struct conn_info *conn_info,
2759 - void *message);
2760 -static int dispatch_init_send_response (
2761 - struct conn_info *conn_info,
2762 - void *message);
2763 -
2764 -static int (*ais_init_service[]) (struct conn_info *conn_info, void *message) = {
2765 - response_init_send_response,
2766 - dispatch_init_send_response
2767 +static int conn_io_refcnt_value (struct conn_io *conn_io)
2768 +{
2769 + unsigned int refcnt;
2770 +
2771 + pthread_mutex_lock (&conn_io->mutex);
2772 + refcnt = conn_io->refcnt;
2773 + pthread_mutex_unlock (&conn_io->mutex);
2774 +
2775 + return (refcnt);
2776 +}
2777 +
2778 +static void conn_io_refcnt_inc (struct conn_io *conn_io)
2779 +{
2780 + pthread_mutex_lock (&conn_io->mutex);
2781 + conn_io->refcnt += 1;
2782 + pthread_mutex_unlock (&conn_io->mutex);
2783 +}
2784 +
2785 +static int conn_io_refcnt_dec (struct conn_io *conn_io)
2786 +{
2787 + unsigned int refcnt;
2788 +
2789 + pthread_mutex_lock (&conn_io->mutex);
2790 + conn_io->refcnt -= 1;
2791 + refcnt = conn_io->refcnt;
2792 + pthread_mutex_unlock (&conn_io->mutex);
2793 +
2794 + return (refcnt);
2795 +}
2796 +
2797 +static void conn_info_refcnt_inc (struct conn_info *conn_info)
2798 +{
2799 + /*
2800 + * Connection not fully initialized yet
2801 + */
2802 + if (conn_info == NULL) {
2803 + return;
2804 + }
2805 + pthread_mutex_lock (&conn_info->mutex);
2806 + conn_info->refcnt += 1;
2807 + pthread_mutex_unlock (&conn_info->mutex);
2808 +}
2809 +
2810 +static void conn_info_refcnt_dec (struct conn_info *conn_info)
2811 +{
2812 + int refcnt;
2813 +
2814 + /*
2815 + * Connection not fully initialized yet
2816 + */
2817 + if (conn_info == NULL) {
2818 + return;
2819 + }
2820 + pthread_mutex_lock (&conn_info->mutex);
2821 + conn_info->refcnt -= 1;
2822 + refcnt = conn_info->refcnt;
2823 + assert (refcnt >= 0);
2824 + pthread_mutex_unlock (&conn_info->mutex);
2825 +
2826 + if (refcnt == 0) {
2827 + conn_info_destroy (conn_info);
2828 + }
2829 +}
2830 +
2831 +void openais_conn_info_refcnt_dec (void *conn)
2832 +{
2833 + struct conn_info *conn_info = (struct conn_info *)conn;
2834 +
2835 + conn_info_refcnt_dec (conn_info);
2836 +}
2837 +
2838 +void openais_conn_info_refcnt_inc (void *conn)
2839 +{
2840 + struct conn_info *conn_info = (struct conn_info *)conn;
2841 +
2842 + conn_info_refcnt_inc (conn_info);
2843 +}
2844 +
2845 +static int (*ais_init_service[]) (struct conn_io *conn_io, void *message) = {
2846 + response_init_send,
2847 + dispatch_init_send
2848 };
2849
2850 -static void libais_disconnect_security (struct conn_info *conn_info)
2851 +static void disconnect_request (struct conn_info *conn_info)
2852 {
2853 - conn_info->state = CONN_STATE_SECURITY;
2854 - close (conn_info->fd);
2855 +unsigned int res;
2856 + /*
2857 + * connection not fully active yet
2858 + */
2859 + if (conn_info == NULL) {
2860 + return;
2861 + }
2862 + /*
2863 + * We only want to decrement the reference count on these two
2864 + * conn_io contexts one time
2865 + */
2866 + if (conn_info->state != CONN_INFO_STATE_ACTIVE) {
2867 + return;
2868 + }
2869 + res = conn_io_refcnt_dec (conn_info->conn_io_response);
2870 + res = conn_io_refcnt_dec (conn_info->conn_io_dispatch);
2871 + conn_info->state = CONN_INFO_STATE_DISCONNECT_REQUESTED;
2872 }
2873
2874 -static int response_init_send_response (
2875 - struct conn_info *conn_info,
2876 +static int response_init_send (
2877 + struct conn_io *conn_io,
2878 void *message)
2879 {
2880 SaAisErrorT error = SA_AIS_ERR_ACCESS;
2881 - uintptr_t cinfo = (uintptr_t)conn_info;
2882 + uintptr_t cinfo = (uintptr_t)conn_io;
2883 mar_req_lib_response_init_t *req_lib_response_init = (mar_req_lib_response_init_t *)message;
2884 mar_res_lib_response_init_t res_lib_response_init;
2885
2886 - if (conn_info->authenticated) {
2887 - conn_info->service = req_lib_response_init->resdis_header.service;
2888 + if (conn_io->state == CONN_IO_STATE_AUTHENTICATED) {
2889 error = SA_AIS_OK;
2890 + conn_io->service = req_lib_response_init->resdis_header.service;
2891 }
2892 res_lib_response_init.header.size = sizeof (mar_res_lib_response_init_t);
2893 res_lib_response_init.header.id = MESSAGE_RES_INIT;
2894 res_lib_response_init.header.error = error;
2895 res_lib_response_init.conn_info = (mar_uint64_t)cinfo;
2896
2897 - openais_conn_send_response (
2898 - conn_info,
2899 + conn_io_send (
2900 + conn_io,
2901 &res_lib_response_init,
2902 sizeof (res_lib_response_init));
2903
2904 if (error == SA_AIS_ERR_ACCESS) {
2905 - libais_disconnect_security (conn_info);
2906 + conn_io_destroy (conn_io);
2907 return (-1);
2908 }
2909 +
2910 return (0);
2911 }
2912
2913 -static int dispatch_init_send_response (
2914 - struct conn_info *conn_info,
2915 +/*
2916 + * This is called iwth ipc_serialize_lock_fn() called
2917 + * Therefore there are no races with the destruction of the conn_io
2918 + * data structure
2919 + */
2920 +static int dispatch_init_send (
2921 + struct conn_io *conn_io,
2922 void *message)
2923 {
2924 SaAisErrorT error = SA_AIS_ERR_ACCESS;
2925 uintptr_t cinfo;
2926 mar_req_lib_dispatch_init_t *req_lib_dispatch_init = (mar_req_lib_dispatch_init_t *)message;
2927 mar_res_lib_dispatch_init_t res_lib_dispatch_init;
2928 - struct conn_info *msg_conn_info;
2929 + struct conn_io *msg_conn_io;
2930 + struct conn_info *conn_info;
2931 + unsigned int service;
2932 +
2933 + service = req_lib_dispatch_init->resdis_header.service;
2934 + cinfo = (uintptr_t)req_lib_dispatch_init->conn_info;
2935 + msg_conn_io = (struct conn_io *)cinfo;
2936
2937 - if (conn_info->authenticated) {
2938 - conn_info->service = req_lib_dispatch_init->resdis_header.service;
2939 - if (!ais_service[req_lib_dispatch_init->resdis_header.service])
2940 + /*
2941 + * The response IPC connection has disconnected already for
2942 + * some reason and is no longer referenceable in the system
2943 + */
2944 + if (conn_io->state == CONN_IO_STATE_AUTHENTICATED) {
2945 + /*
2946 + * If the response conn_io isn't found, it disconnected.
2947 + * Hence, a full connection cannot be made and this connection
2948 + * should be aborted by the poll thread
2949 + */
2950 + if (conn_io_found (msg_conn_io) == 0) {
2951 + error = SA_AIS_ERR_TRY_AGAIN;
2952 + conn_io->state = CONN_IO_STATE_INIT_FAILED;
2953 + } else
2954 + /*
2955 + * If no service is found for the requested library service,
2956 + * the proper service handler isn't loaded and this connection
2957 + * should be aborted by the poll thread
2958 + */
2959 + if (ais_service[service] == NULL) {
2960 error = SA_AIS_ERR_NOT_SUPPORTED;
2961 - else
2962 + conn_io->state = CONN_IO_STATE_INIT_FAILED;
2963 + } else {
2964 error = SA_AIS_OK;
2965 + }
2966
2967 - cinfo = (uintptr_t)req_lib_dispatch_init->conn_info;
2968 - conn_info->conn_info_partner = (struct conn_info *)cinfo;
2969 -
2970 - /* temporary fix for memory leak
2971 + /*
2972 + * The response and dispatch conn_io structures are available.
2973 + * Attempt to allocate the appropriate memory for the private
2974 + * data area
2975 */
2976 - pthread_mutex_destroy (conn_info->conn_info_partner->shared_mutex);
2977 - free (conn_info->conn_info_partner->shared_mutex);
2978 -
2979 - conn_info->conn_info_partner->shared_mutex = conn_info->shared_mutex;
2980 -
2981 - list_add (&conn_info_list_head, &conn_info->list);
2982 - list_add (&conn_info_list_head, &conn_info->conn_info_partner->list);
2983 -
2984 - msg_conn_info = (struct conn_info *)cinfo;
2985 - msg_conn_info->conn_info_partner = conn_info;
2986 -
2987 if (error == SA_AIS_OK) {
2988 int private_data_size;
2989
2990 - private_data_size = ais_service[req_lib_dispatch_init->resdis_header.service]->private_data_size;
2991 + conn_info = conn_info_create ();
2992 + private_data_size = ais_service[service]->private_data_size;
2993 if (private_data_size) {
2994 conn_info->private_data = malloc (private_data_size);
2995
2996 - conn_info->conn_info_partner->private_data = conn_info->private_data;
2997 + /*
2998 + * No private data could be allocated so
2999 + * request the poll thread to abort
3000 + */
3001 if (conn_info->private_data == NULL) {
3002 + conn_io->state = CONN_IO_STATE_INIT_FAILED;
3003 error = SA_AIS_ERR_NO_MEMORY;
3004 } else {
3005 memset (conn_info->private_data, 0, private_data_size);
3006 }
3007 } else {
3008 conn_info->private_data = NULL;
3009 - conn_info->conn_info_partner->private_data = NULL;
3010 }
3011 }
3012 }
3013 @@ -259,287 +405,203 @@
3014 res_lib_dispatch_init.header.id = MESSAGE_RES_INIT;
3015 res_lib_dispatch_init.header.error = error;
3016
3017 - openais_conn_send_response (
3018 - conn_info,
3019 - &res_lib_dispatch_init,
3020 - sizeof (res_lib_dispatch_init));
3021 -
3022 - if (error == SA_AIS_ERR_ACCESS) {
3023 - libais_disconnect_security (conn_info);
3024 - return (-1);
3025 - }
3026 if (error != SA_AIS_OK) {
3027 + conn_io_send (
3028 + conn_io,
3029 + &res_lib_dispatch_init,
3030 + sizeof (res_lib_dispatch_init));
3031 +
3032 return (-1);
3033 }
3034
3035 - conn_info->state = CONN_STATE_ACTIVE;
3036 - conn_info->conn_info_partner->state = CONN_STATE_ACTIVE;
3037 - conn_info->lib_exit_fn = ais_service[conn_info->service]->lib_exit_fn;
3038 + /*
3039 + * connect both dispatch and response conn_ios into the conn_info
3040 + * data structure
3041 + */
3042 + conn_info->state = CONN_INFO_STATE_ACTIVE;
3043 + conn_info->lib_exit_fn = ais_service[service]->lib_exit_fn;
3044 + conn_info->conn_io_response = msg_conn_io;
3045 + conn_info->conn_io_response->conn_info = conn_info;
3046 + conn_info->conn_io_dispatch = conn_io;
3047 + conn_info->service = service;
3048 + conn_io->service = service;
3049 + conn_io->conn_info = conn_info;
3050 ais_service[conn_info->service]->lib_init_fn (conn_info);
3051
3052 conn_info->flow_control = ais_service[conn_info->service]->flow_control;
3053 - conn_info->conn_info_partner->flow_control = ais_service[conn_info->service]->flow_control;
3054 if (ais_service[conn_info->service]->flow_control == OPENAIS_FLOW_CONTROL_REQUIRED) {
3055 openais_flow_control_ipc_init (
3056 &conn_info->flow_control_handle,
3057 conn_info->service);
3058
3059 }
3060 +
3061 + /*
3062 + * Tell the library the IPC connections are configured
3063 + */
3064 + conn_io_send (
3065 + conn_io,
3066 + &res_lib_dispatch_init,
3067 + sizeof (res_lib_dispatch_init));
3068 return (0);
3069 }
3070
3071 /*
3072 * Create a connection data structure
3073 */
3074 -static inline unsigned int conn_info_create (int fd) {
3075 +static inline struct conn_info *conn_info_create (void)
3076 +{
3077 struct conn_info *conn_info;
3078 - int res;
3079
3080 conn_info = malloc (sizeof (struct conn_info));
3081 if (conn_info == 0) {
3082 - return (ENOMEM);
3083 + return (NULL);
3084 }
3085
3086 memset (conn_info, 0, sizeof (struct conn_info));
3087
3088 - res = queue_init (&conn_info->outq, SIZEQUEUE,
3089 + conn_info->refcnt = 2;
3090 + pthread_mutex_init (&conn_info->mutex, NULL);
3091 + conn_info->state = CONN_INFO_STATE_INITIALIZING;
3092 +
3093 + return (conn_info);
3094 +}
3095 +
3096 +static inline void conn_info_destroy (struct conn_info *conn_info)
3097 +{
3098 + if (conn_info->private_data) {
3099 + free (conn_info->private_data);
3100 + }
3101 + pthread_mutex_destroy (&conn_info->mutex);
3102 + free (conn_info);
3103 +}
3104 +
3105 +static int conn_io_create (int fd)
3106 +{
3107 + int res;
3108 + struct conn_io *conn_io;
3109 +
3110 + conn_io = malloc (sizeof (struct conn_io));
3111 + if (conn_io == NULL) {
3112 + return (-1);
3113 + }
3114 + memset (conn_io, 0, sizeof (struct conn_io));
3115 +
3116 + res = queue_init (&conn_io->outq, SIZEQUEUE,
3117 sizeof (struct outq_item));
3118 if (res != 0) {
3119 - free (conn_info);
3120 - return (ENOMEM);
3121 + return (-1);
3122 }
3123 - conn_info->inb = malloc (sizeof (char) * SIZEINB);
3124 - if (conn_info->inb == NULL) {
3125 - queue_free (&conn_info->outq);
3126 - free (conn_info);
3127 - return (ENOMEM);
3128 - }
3129 - conn_info->shared_mutex = malloc (sizeof (pthread_mutex_t));
3130 - if (conn_info->shared_mutex == NULL) {
3131 - free (conn_info->inb);
3132 - queue_free (&conn_info->outq);
3133 - free (conn_info);
3134 - return (ENOMEM);
3135 +
3136 + conn_io->inb = malloc (sizeof (char) * SIZEINB);
3137 + if (conn_io->inb == NULL) {
3138 + queue_free (&conn_io->outq);
3139 + return (-1);
3140 }
3141
3142 - pthread_mutex_init (&conn_info->mutex, NULL);
3143 - pthread_mutex_init (&conn_info->flow_control_mutex, NULL);
3144 - pthread_mutex_init (conn_info->shared_mutex, NULL);
3145 + conn_io->fd = fd;
3146 + conn_io->events = POLLIN|POLLNVAL;
3147 + conn_io->refcnt = 1;
3148 + conn_io->service = SOCKET_SERVICE_INIT;
3149 + conn_io->state = CONN_IO_STATE_INITIALIZING;
3150
3151 - list_init (&conn_info->list);
3152 - conn_info->state = CONN_STATE_ACTIVE;
3153 - conn_info->fd = fd;
3154 - conn_info->events = POLLIN|POLLNVAL;
3155 - conn_info->service = SOCKET_SERVICE_INIT;
3156 + pthread_attr_init (&conn_io->thread_attr);
3157
3158 - pthread_attr_init (&conn_info->thread_attr);
3159 -/*
3160 - * IA64 needs more stack space then other arches
3161 - */
3162 + pthread_mutex_init (&conn_io->mutex, NULL);
3163 +
3164 + /*
3165 + * IA64 needs more stack space then other arches
3166 + */
3167 #if defined(__ia64__)
3168 - pthread_attr_setstacksize (&conn_info->thread_attr, 400000);
3169 + pthread_attr_setstacksize (&conn_io->thread_attr, 400000);
3170 #else
3171 - pthread_attr_setstacksize (&conn_info->thread_attr, 200000);
3172 + pthread_attr_setstacksize (&conn_io->thread_attr, 200000);
3173 #endif
3174
3175 - pthread_attr_setdetachstate (&conn_info->thread_attr, PTHREAD_CREATE_DETACHED);
3176 - res = pthread_create (&conn_info->thread, &conn_info->thread_attr,
3177 - prioritized_poll_thread, conn_info);
3178 + pthread_attr_setdetachstate (&conn_io->thread_attr, PTHREAD_CREATE_DETACHED);
3179 +
3180 + res = pthread_create (&conn_io->thread, &conn_io->thread_attr,
3181 + prioritized_poll_thread, conn_io);
3182 +
3183 + list_init (&conn_io->list);
3184 +
3185 + pthread_mutex_lock (&conn_io_list_mutex);
3186 + list_add (&conn_io->list, &conn_io_list_head);
3187 + pthread_mutex_unlock (&conn_io_list_mutex);
3188 return (res);
3189 }
3190
3191 -static void conn_info_destroy (struct conn_info *conn_info)
3192 +static void conn_io_destroy (struct conn_io *conn_io)
3193 {
3194 struct outq_item *outq_item;
3195
3196 /*
3197 * Free the outq queued items
3198 */
3199 - while (!queue_is_empty (&conn_info->outq)) {
3200 - outq_item = queue_item_get (&conn_info->outq);
3201 + while (!queue_is_empty (&conn_io->outq)) {
3202 + outq_item = queue_item_get (&conn_io->outq);
3203 free (outq_item->msg);
3204 - queue_item_remove (&conn_info->outq);
3205 + queue_item_remove (&conn_io->outq);
3206 }
3207
3208 - queue_free (&conn_info->outq);
3209 - free (conn_info->inb);
3210 - if (conn_info->conn_info_partner) {
3211 - conn_info->conn_info_partner->conn_info_partner = NULL;
3212 - }
3213 + queue_free (&conn_io->outq);
3214 + free (conn_io->inb);
3215 + close (conn_io->fd);
3216 + pthread_mutex_lock (&conn_io_list_mutex);
3217 + list_del (&conn_io->list);
3218 + pthread_mutex_unlock (&conn_io_list_mutex);
3219
3220 - pthread_attr_destroy (&conn_info->thread_attr);
3221 - pthread_mutex_destroy (&conn_info->mutex);
3222 -
3223 - list_del (&conn_info->list);
3224 - free (conn_info);
3225 -}
3226 -
3227 -static int libais_connection_active (struct conn_info *conn_info)
3228 -{
3229 - return (conn_info->state == CONN_STATE_ACTIVE);
3230 + pthread_attr_destroy (&conn_io->thread_attr);
3231 + pthread_mutex_destroy (&conn_io->mutex);
3232 + free (conn_io);
3233 }
3234
3235 -static void libais_disconnect_request (struct conn_info *conn_info)
3236 +static int conn_io_found (struct conn_io *conn_io_to_match)
3237 {
3238 - if (conn_info->state == CONN_STATE_ACTIVE) {
3239 - conn_info->state = CONN_STATE_REQUESTED;
3240 - conn_info->conn_info_partner->state = CONN_STATE_REQUESTED;
3241 - }
3242 -}
3243 + struct list_head *list;
3244 + struct conn_io *conn_io;
3245
3246 -static int libais_disconnect (struct conn_info *conn_info)
3247 -{
3248 - int res = 0;
3249 -
3250 - assert (conn_info->state != CONN_STATE_ACTIVE);
3251 -
3252 - if (conn_info->state == CONN_STATE_DISCONNECTED) {
3253 - assert (0);
3254 - }
3255 -
3256 - /*
3257 - * Close active connections
3258 - */
3259 - if (conn_info->state == CONN_STATE_ACTIVE || conn_info->state == CONN_STATE_REQUESTED) {
3260 - close (conn_info->fd);
3261 - conn_info->state = CONN_STATE_CLOSED;
3262 - close (conn_info->conn_info_partner->fd);
3263 - conn_info->conn_info_partner->state = CONN_STATE_CLOSED;
3264 - }
3265 -
3266 - /*
3267 - * Note we will only call the close operation once on the first time
3268 - * one of the connections is closed
3269 - */
3270 - if (conn_info->state == CONN_STATE_CLOSED) {
3271 - if (conn_info->lib_exit_fn) {
3272 - res = conn_info->lib_exit_fn (conn_info);
3273 - }
3274 - if (res == -1) {
3275 - return (-1);
3276 - }
3277 - if (conn_info->conn_info_partner->lib_exit_fn) {
3278 - res = conn_info->conn_info_partner->lib_exit_fn (conn_info);
3279 - }
3280 - if (res == -1) {
3281 - return (-1);
3282 + for (list = conn_io_list_head.next; list != &conn_io_list_head;
3283 + list = list->next) {
3284 +
3285 + conn_io = list_entry (list, struct conn_io, list);
3286 + if (conn_io == conn_io_to_match) {
3287 + return (1);
3288 }
3289 }
3290 - conn_info->state = CONN_STATE_DISCONNECTED;
3291 - conn_info->conn_info_partner->state = CONN_STATE_DISCONNECTED;
3292 - if (conn_info->flow_control_enabled == 1) {
3293 - openais_flow_control_disable (conn_info->flow_control_handle);
3294 - }
3295 - return (0);
3296 -}
3297
3298 -static inline void conn_info_mutex_lock (
3299 - struct conn_info *conn_info,
3300 - unsigned int service)
3301 -{
3302 - if (service == SOCKET_SERVICE_INIT) {
3303 - pthread_mutex_lock (&conn_info->mutex);
3304 - } else {
3305 - pthread_mutex_lock (conn_info->shared_mutex);
3306 - }
3307 -}
3308 -static inline void conn_info_mutex_unlock (
3309 - struct conn_info *conn_info,
3310 - unsigned int service)
3311 -{
3312 - if (service == SOCKET_SERVICE_INIT) {
3313 - pthread_mutex_unlock (&conn_info->mutex);
3314 - } else {
3315 - pthread_mutex_unlock (conn_info->shared_mutex);
3316 - }
3317 + return (0);
3318 }
3319
3320 /*
3321 * This thread runs in a specific thread priority mode to handle
3322 - * I/O requests from the library
3323 + * I/O requests from or to the library
3324 */
3325 -static void *prioritized_poll_thread (void *conn)
3326 +static void *prioritized_poll_thread (void *conn_io_in)
3327 {
3328 - struct conn_info *conn_info = (struct conn_info *)conn;
3329 + struct conn_io *conn_io = (struct conn_io *)conn_io_in;
3330 + struct conn_info *conn_info = NULL;
3331 struct pollfd ufd;
3332 int fds;
3333 struct sched_param sched_param;
3334 int res;
3335 - pthread_mutex_t *rel_mutex;
3336 - unsigned int service;
3337 - struct conn_info *cinfo_partner;
3338 - void *private_data;
3339
3340 -#if defined(OPENAIS_BSD) || defined(OPENAIS_LINUX)
3341 - res = sched_get_priority_max (SCHED_RR);
3342 - if (res != -1) {
3343 - sched_param.sched_priority = res;
3344 - res = pthread_setschedparam (conn_info->thread, SCHED_RR, &sched_param);
3345 - if (res == -1) {
3346 - log_printf (LOG_LEVEL_WARNING, "Could not set SCHED_RR at priority %d: %s\n",
3347 - sched_param.sched_priority, strerror (errno));
3348 - }
3349 - } else
3350 - log_printf (LOG_LEVEL_WARNING, "Could not get maximum scheduler priority: %s\n", strerror (errno));
3351 -#else
3352 - log_printf(LOG_LEVEL_WARNING, "Scheduler priority left to default value (no OS support)\n");
3353 -#endif
3354 + sched_param.sched_priority = 99;
3355 + res = pthread_setschedparam (conn_io->thread, SCHED_RR, &sched_param);
3356
3357 - ufd.fd = conn_info->fd;
3358 + ufd.fd = conn_io->fd;
3359 for (;;) {
3360 retry_poll:
3361 - service = conn_info->service;
3362 - ufd.events = conn_info->events;
3363 + conn_info = conn_io->conn_info;
3364 + conn_io_refcnt_inc (conn_io);
3365 + conn_info_refcnt_inc (conn_info);
3366 +
3367 + ufd.events = conn_io->events;
3368 ufd.revents = 0;
3369 fds = poll (&ufd, 1, -1);
3370 -
3371 - conn_info_mutex_lock (conn_info, service);
3372 -
3373 - switch (conn_info->state) {
3374 - case CONN_STATE_SECURITY:
3375 - conn_info_mutex_unlock (conn_info, service);
3376 - pthread_mutex_destroy (conn_info->shared_mutex);
3377 - free (conn_info->shared_mutex);
3378 - conn_info_destroy (conn);
3379 - pthread_exit (0);
3380 - break;
3381 -
3382 - case CONN_STATE_REQUESTED:
3383 - case CONN_STATE_CLOSED:
3384 - res = libais_disconnect (conn);
3385 - if (res != 0) {
3386 - conn_info_mutex_unlock (conn_info, service);
3387 - goto retry_poll;
3388 - }
3389 - break;
3390 -
3391 - case CONN_STATE_DISCONNECTED:
3392 - rel_mutex = conn_info->shared_mutex;
3393 - private_data = conn_info->private_data;
3394 - cinfo_partner = conn_info->conn_info_partner;
3395 - conn_info_destroy (conn);
3396 - if (service == SOCKET_SERVICE_INIT) {
3397 - pthread_mutex_unlock (&conn_info->mutex);
3398 - } else {
3399 - pthread_mutex_unlock (rel_mutex);
3400 - }
3401 - if (cinfo_partner == NULL) {
3402 - pthread_mutex_destroy (rel_mutex);
3403 - free (rel_mutex);
3404 - free (private_data);
3405 - }
3406 - pthread_exit (0);
3407 - /*
3408 - * !! NOTE !! this is the exit point for this thread
3409 - */
3410 - break;
3411 -
3412 - default:
3413 - break;
3414 - }
3415 -
3416 if (fds == -1) {
3417 - conn_info_mutex_unlock (conn_info, service);
3418 + conn_io_refcnt_dec (conn_io);
3419 + conn_info_refcnt_dec (conn_info);
3420 goto retry_poll;
3421 }
3422
3423 @@ -547,49 +609,151 @@
3424
3425 if (fds == 1 && ufd.revents) {
3426 if (ufd.revents & (POLLERR|POLLHUP)) {
3427 + disconnect_request (conn_info);
3428 + conn_info_refcnt_dec (conn_info);
3429 + conn_io_refcnt_dec (conn_io);
3430 + /*
3431 + * If conn_info not set, wait for it to be set
3432 + * else break out of for loop
3433 + */
3434 + if (conn_info == NULL) {
3435 + ipc_serialize_unlock_fn ();
3436 + continue;
3437 + } else {
3438 + ipc_serialize_unlock_fn ();
3439 + break;
3440 + }
3441 + }
3442
3443 - libais_disconnect_request (conn_info);
3444 -
3445 - conn_info_mutex_unlock (conn_info, service);
3446 + if (conn_info && conn_info->state == CONN_INFO_STATE_DISCONNECT_REQUESTED) {
3447 + conn_info_refcnt_dec (conn_info);
3448 + conn_io_refcnt_dec (conn_io);
3449 ipc_serialize_unlock_fn ();
3450 - continue;
3451 + break;
3452 }
3453
3454 if (ufd.revents & POLLOUT) {
3455 - conn_info_outq_flush (conn_info);
3456 + conn_io_outq_flush (conn_io);
3457 }
3458
3459 if ((ufd.revents & POLLIN) == POLLIN) {
3460 - libais_deliver (conn_info);
3461 + conn_io_deliver (conn_io);
3462 }
3463
3464 - ipc_flow_control (conn_info);
3465 + /*
3466 + * IPC initializiation failed because response fd
3467 + * disconnected before it was linked to dispatch fd
3468 + */
3469 + if (conn_io->state == CONN_IO_STATE_INIT_FAILED) {
3470 + conn_io_destroy (conn_io);
3471 + conn_info_refcnt_dec (conn_info);
3472 + ipc_serialize_unlock_fn ();
3473 + pthread_exit (0);
3474 + }
3475 + /*
3476 + * IPC initializiation failed because response fd
3477 + * disconnected before it was linked to dispatch fd
3478 + */
3479 + if (conn_io->state == CONN_IO_STATE_INIT_FAILED) {
3480 + break;
3481 + }
3482 +
3483 +// ipc_flow_control (conn_info);
3484
3485 }
3486
3487 ipc_serialize_unlock_fn ();
3488 - conn_info_mutex_unlock (conn_info, service);
3489 +
3490 + conn_io_refcnt_dec (conn_io);
3491 + conn_info_refcnt_dec (conn_info);
3492 + }
3493 +
3494 + ipc_serialize_lock_fn ();
3495 +
3496 + /*
3497 + * IPC initializiation failed because response fd
3498 + * disconnected before it was linked to dispatch fd
3499 + */
3500 + if (conn_io->conn_info == NULL || conn_io->state == CONN_IO_STATE_INIT_FAILED) {
3501 + conn_io_destroy (conn_io);
3502 + conn_info_refcnt_dec (conn_info);
3503 + ipc_serialize_unlock_fn ();
3504 + pthread_exit (0);
3505 }
3506
3507 + conn_info = conn_io->conn_info;
3508 +
3509 + /*
3510 + * This is the response conn_io
3511 + */
3512 + if (conn_info->conn_io_response == conn_io) {
3513 + for (;;) {
3514 + if (conn_io_refcnt_value (conn_io) == 0) {
3515 + conn_io->conn_info = NULL;
3516 + conn_io_destroy (conn_io);
3517 + conn_info_refcnt_dec (conn_info);
3518 + ipc_serialize_unlock_fn ();
3519 + pthread_exit (0);
3520 + }
3521 + usleep (1000);
3522 + printf ("sleep 1\n");
3523 + }
3524 + } /* response conn_io */
3525 +
3526 + /*
3527 + * This is the dispatch conn_io
3528 + */
3529 + if (conn_io->conn_info->conn_io_dispatch == conn_io) {
3530 + ipc_serialize_unlock_fn ();
3531 + for (;;) {
3532 + ipc_serialize_lock_fn ();
3533 + if (conn_io_refcnt_value (conn_io) == 0) {
3534 + res = 0; // TODO
3535 + /*
3536 + * Execute the library exit function
3537 + */
3538 + if (conn_io->conn_info->lib_exit_fn) {
3539 + res = conn_io->conn_info->lib_exit_fn (conn_info);
3540 + }
3541 + if (res == 0) {
3542 + if (conn_io->conn_info->flow_control_enabled == 1) {
3543 +// openais_flow_control_disable (
3544 +// conn_info->flow_control_handle);
3545 + }
3546 + conn_io->conn_info = NULL;
3547 + conn_io_destroy (conn_io);
3548 + conn_info_refcnt_dec (conn_info);
3549 + ipc_serialize_unlock_fn ();
3550 + pthread_exit (0);
3551 + }
3552 + } /* refcnt == 0 */
3553 + ipc_serialize_unlock_fn ();
3554 + usleep (1000);
3555 + } /* for (;;) */
3556 + } /* dispatch conn_io */
3557 +
3558 /*
3559 * This code never reached
3560 */
3561 return (0);
3562 }
3563
3564 -#if defined(OPENAIS_LINUX)
3565 +#if defined(OPENAIS_LINUX) || defined(OPENAIS_SOLARIS)
3566 /* SUN_LEN is broken for abstract namespace
3567 */
3568 #define AIS_SUN_LEN(a) sizeof(*(a))
3569 -
3570 -char *socketname = "libais.socket";
3571 #else
3572 #define AIS_SUN_LEN(a) SUN_LEN(a)
3573 +#endif
3574
3575 +#if defined(OPENAIS_LINUX)
3576 +char *socketname = "libais.socket";
3577 +#else
3578 char *socketname = "/var/run/libais.socket";
3579 #endif
3580
3581
3582 +#ifdef COMPILOE_OUT
3583 static void ipc_flow_control (struct conn_info *conn_info)
3584 {
3585 unsigned int entries_used;
3586 @@ -647,8 +811,9 @@
3587 }
3588 }
3589 }
3590 +#endif
3591
3592 -static int conn_info_outq_flush (struct conn_info *conn_info) {
3593 +static int conn_io_outq_flush (struct conn_io *conn_io) {
3594 struct queue *outq;
3595 int res = 0;
3596 struct outq_item *queue_item;
3597 @@ -656,46 +821,51 @@
3598 struct iovec iov_send;
3599 char *msg_addr;
3600
3601 - if (!libais_connection_active (conn_info)) {
3602 - return (-1);
3603 - }
3604 - outq = &conn_info->outq;
3605 + outq = &conn_io->outq;
3606
3607 msg_send.msg_iov = &iov_send;
3608 msg_send.msg_name = 0;
3609 msg_send.msg_namelen = 0;
3610 msg_send.msg_iovlen = 1;
3611 +#ifndef OPENAIS_SOLARIS
3612 msg_send.msg_control = 0;
3613 msg_send.msg_controllen = 0;
3614 msg_send.msg_flags = 0;
3615 +#else
3616 + msg_send.msg_accrights = 0;
3617 + msg_send.msg_accrightslen = 0;
3618 +#endif
3619
3620 + pthread_mutex_lock (&conn_io->mutex);
3621 while (!queue_is_empty (outq)) {
3622 queue_item = queue_item_get (outq);
3623 msg_addr = (char *)queue_item->msg;
3624 - msg_addr = &msg_addr[conn_info->byte_start];
3625 + msg_addr = &msg_addr[conn_io->byte_start];
3626
3627 iov_send.iov_base = msg_addr;
3628 - iov_send.iov_len = queue_item->mlen - conn_info->byte_start;
3629 + iov_send.iov_len = queue_item->mlen - conn_io->byte_start;
3630
3631 retry_sendmsg:
3632 - res = sendmsg (conn_info->fd, &msg_send, MSG_NOSIGNAL);
3633 + res = sendmsg (conn_io->fd, &msg_send, MSG_NOSIGNAL);
3634 if (res == -1 && errno == EINTR) {
3635 goto retry_sendmsg;
3636 }
3637 if (res == -1 && errno == EAGAIN) {
3638 + pthread_mutex_unlock (&conn_io->mutex);
3639 return (0);
3640 }
3641 if (res == -1 && errno == EPIPE) {
3642 - libais_disconnect_request (conn_info);
3643 + disconnect_request (conn_io->conn_info);
3644 + pthread_mutex_unlock (&conn_io->mutex);
3645 return (0);
3646 }
3647 if (res == -1) {
3648 - printf ("ERRNO is %d\n", errno);
3649 assert (0); /* some other unhandled error here */
3650 }
3651 - if (res + conn_info->byte_start != queue_item->mlen) {
3652 - conn_info->byte_start += res;
3653 + if (res + conn_io->byte_start != queue_item->mlen) {
3654 + conn_io->byte_start += res;
3655
3656 + pthread_mutex_unlock (&conn_io->mutex);
3657 return (0);
3658 }
3659
3660 @@ -703,14 +873,15 @@
3661 * Message sent, try sending another message
3662 */
3663 queue_item_remove (outq);
3664 - conn_info->byte_start = 0;
3665 + conn_io->byte_start = 0;
3666 free (queue_item->msg);
3667 } /* while queue not empty */
3668
3669 if (queue_is_empty (outq)) {
3670 - conn_info->events = POLLIN|POLLNVAL;
3671 + conn_io->events = POLLIN|POLLNVAL;
3672 }
3673
3674 + pthread_mutex_unlock (&conn_io->mutex);
3675 return (0);
3676 }
3677
3678 @@ -721,7 +892,7 @@
3679 char buf[4096];
3680 };
3681
3682 -static void libais_deliver (struct conn_info *conn_info)
3683 +static void conn_io_deliver (struct conn_io *conn_io)
3684 {
3685 int res;
3686 mar_req_header_t *header;
3687 @@ -733,9 +904,6 @@
3688 char cmsg_cred[CMSG_SPACE (sizeof (struct ucred))];
3689 struct ucred *cred;
3690 int on = 0;
3691 -#else
3692 - uid_t euid;
3693 - gid_t egid;
3694 #endif
3695 int send_ok = 0;
3696 int send_ok_joined = 0;
3697 @@ -746,9 +914,10 @@
3698 msg_recv.msg_iovlen = 1;
3699 msg_recv.msg_name = 0;
3700 msg_recv.msg_namelen = 0;
3701 +#ifndef OPENAIS_SOLARIS
3702 msg_recv.msg_flags = 0;
3703
3704 - if (conn_info->authenticated) {
3705 + if (conn_io->state == CONN_IO_STATE_AUTHENTICATED) {
3706 msg_recv.msg_control = 0;
3707 msg_recv.msg_controllen = 0;
3708 } else {
3709 @@ -756,25 +925,61 @@
3710 msg_recv.msg_control = (void *)cmsg_cred;
3711 msg_recv.msg_controllen = sizeof (cmsg_cred);
3712 #else
3713 - euid = -1; egid = -1;
3714 - if (getpeereid(conn_info->fd, &euid, &egid) != -1 &&
3715 - (euid == 0 || egid == g_gid_valid)) {
3716 - conn_info->authenticated = 1;
3717 - }
3718 - if (conn_info->authenticated == 0) {
3719 - log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", egid, g_gid_valid);
3720 + {
3721 + uid_t euid;
3722 + gid_t egid;
3723 +
3724 + euid = -1; egid = -1;
3725 + if (getpeereid(conn_io->fd, &euid, &egid) != -1 &&
3726 + (euid == 0 || egid == g_gid_valid)) {
3727 + conn_io->state = CONN_IO_STATE_AUTHENTICATED;
3728 + }
3729 + if (conn_io->state == CONN_IO_STATE_INITIALIZING) {
3730 + log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", egid, g_gid_valid);
3731 + }
3732 }
3733 #endif
3734 }
3735
3736 - iov_recv.iov_base = &conn_info->inb[conn_info->inb_start];
3737 - iov_recv.iov_len = (SIZEINB) - conn_info->inb_start;
3738 - if (conn_info->inb_inuse == SIZEINB) {
3739 +#else /* OPENAIS_SOLARIS */
3740 + msg_recv.msg_accrights = 0;
3741 + msg_recv.msg_accrightslen = 0;
3742 +
3743 +
3744 + if (! conn_info->authenticated) {
3745 +#ifdef HAVE_GETPEERUCRED
3746 + ucred_t *uc;
3747 + uid_t euid = -1;
3748 + gid_t egid = -1;
3749 +
3750 + if (getpeerucred (conn_info->fd, &uc) == 0) {
3751 + euid = ucred_geteuid (uc);
3752 + egid = ucred_getegid (uc);
3753 + if ((euid == 0) || (egid == g_gid_valid)) {
3754 + conn_info->authenticated = 1;
3755 + }
3756 + ucred_free(uc);
3757 + }
3758 + if (conn_info->authenticated == 0) {
3759 + log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", (int)egid, g_gid_valid);
3760 + }
3761 + #else
3762 + log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated "
3763 + "because platform does not support "
3764 + "authentication with sockets, continuing "
3765 + "with a fake authentication\n");
3766 + conn_info->authenticated = 1;
3767 + #endif
3768 + }
3769 + #endif
3770 + iov_recv.iov_base = &conn_io->inb[conn_io->inb_start];
3771 + iov_recv.iov_len = (SIZEINB) - conn_io->inb_start;
3772 + if (conn_io->inb_inuse == SIZEINB) {
3773 return;
3774 }
3775
3776 retry_recv:
3777 - res = recvmsg (conn_info->fd, &msg_recv, MSG_NOSIGNAL);
3778 + res = recvmsg (conn_io->fd, &msg_recv, MSG_NOSIGNAL);
3779 if (res == -1 && errno == EINTR) {
3780 goto retry_recv;
3781 } else
3782 @@ -786,7 +991,7 @@
3783 /* On many OS poll never return POLLHUP or POLLERR.
3784 * EOF is detected when recvmsg return 0.
3785 */
3786 - libais_disconnect_request (conn_info);
3787 + disconnect_request (conn_io);
3788 #endif
3789 return;
3790 }
3791 @@ -795,17 +1000,17 @@
3792 * Authenticate if this connection has not been authenticated
3793 */
3794 #ifdef OPENAIS_LINUX
3795 - if (conn_info->authenticated == 0) {
3796 + if (conn_io->state == CONN_IO_STATE_INITIALIZING) {
3797 cmsg = CMSG_FIRSTHDR (&msg_recv);
3798 assert (cmsg);
3799 cred = (struct ucred *)CMSG_DATA (cmsg);
3800 if (cred) {
3801 if (cred->uid == 0 || cred->gid == g_gid_valid) {
3802 - setsockopt(conn_info->fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
3803 - conn_info->authenticated = 1;
3804 + setsockopt(conn_io->fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
3805 + conn_io->state = CONN_IO_STATE_AUTHENTICATED;
3806 }
3807 }
3808 - if (conn_info->authenticated == 0) {
3809 + if (conn_io->state == CONN_IO_STATE_INITIALIZING) {
3810 log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", cred->gid, g_gid_valid);
3811 }
3812 }
3813 @@ -814,23 +1019,23 @@
3814 * Dispatch all messages received in recvmsg that can be dispatched
3815 * sizeof (mar_req_header_t) needed at minimum to do any processing
3816 */
3817 - conn_info->inb_inuse += res;
3818 - conn_info->inb_start += res;
3819 + conn_io->inb_inuse += res;
3820 + conn_io->inb_start += res;
3821
3822 - while (conn_info->inb_inuse >= sizeof (mar_req_header_t) && res != -1) {
3823 - header = (mar_req_header_t *)&conn_info->inb[conn_info->inb_start - conn_info->inb_inuse];
3824 + while (conn_io->inb_inuse >= sizeof (mar_req_header_t) && res != -1) {
3825 + header = (mar_req_header_t *)&conn_io->inb[conn_io->inb_start - conn_io->inb_inuse];
3826
3827 - if (header->size > conn_info->inb_inuse) {
3828 + if (header->size > conn_io->inb_inuse) {
3829 break;
3830 }
3831 - service = conn_info->service;
3832 + service = conn_io->service;
3833
3834 /*
3835 * If this service is in init phase, initialize service
3836 * else handle message using service service
3837 */
3838 - if (service == SOCKET_SERVICE_INIT) {
3839 - res = ais_init_service[header->id] (conn_info, header);
3840 + if (conn_io->service == SOCKET_SERVICE_INIT) {
3841 + res = ais_init_service[header->id] (conn_io, header);
3842 } else {
3843 /*
3844 * Not an init service, but a standard service
3845 @@ -847,7 +1052,7 @@
3846 * to queue a message, otherwise tell the library we are busy and to
3847 * try again later
3848 */
3849 - send_ok_joined_iovec.iov_base = header;
3850 + send_ok_joined_iovec.iov_base = (char *)header;
3851 send_ok_joined_iovec.iov_len = header->size;
3852 send_ok_joined = totempg_groups_send_ok_joined (openais_group_handle,
3853 &send_ok_joined_iovec, 1);
3854 @@ -860,7 +1065,7 @@
3855 (sync_in_process() == 0)));
3856
3857 if (send_ok) {
3858 - ais_service[service]->lib_service[header->id].lib_handler_fn(conn_info, header);
3859 + ais_service[service]->lib_service[header->id].lib_handler_fn(conn_io->conn_info, header);
3860 } else {
3861
3862 /*
3863 @@ -871,33 +1076,33 @@
3864 res_overlay.header.id =
3865 ais_service[service]->lib_service[header->id].response_id;
3866 res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN;
3867 - openais_conn_send_response (
3868 - conn_info,
3869 + conn_io_send (
3870 + conn_io,
3871 &res_overlay,
3872 res_overlay.header.size);
3873 }
3874 }
3875 - conn_info->inb_inuse -= header->size;
3876 + conn_io->inb_inuse -= header->size;
3877 } /* while */
3878
3879 - if (conn_info->inb_inuse == 0) {
3880 - conn_info->inb_start = 0;
3881 + if (conn_io->inb_inuse == 0) {
3882 + conn_io->inb_start = 0;
3883 } else
3884 -// BUG if (connections[conn_info->fd].inb_start + connections[conn_info->fd].inb_inuse >= SIZEINB) {
3885 - if (conn_info->inb_start >= SIZEINB) {
3886 +// BUG if (connections[conn_io->fd].inb_start + connections[conn_io->fd].inb_inuse >= SIZEINB) {
3887 + if (conn_io->inb_start >= SIZEINB) {
3888 /*
3889 * If in buffer is full, move it back to start
3890 */
3891 - memmove (conn_info->inb,
3892 - &conn_info->inb[conn_info->inb_start - conn_info->inb_inuse],
3893 - sizeof (char) * conn_info->inb_inuse);
3894 - conn_info->inb_start = conn_info->inb_inuse;
3895 + memmove (conn_io->inb,
3896 + &conn_io->inb[conn_io->inb_start - conn_io->inb_inuse],
3897 + sizeof (char) * conn_io->inb_inuse);
3898 + conn_io->inb_start = conn_io->inb_inuse;
3899 }
3900
3901 return;
3902 }
3903
3904 -static int poll_handler_libais_accept (
3905 +static int poll_handler_accept (
3906 poll_handle handle,
3907 int fd,
3908 int revent,
3909 @@ -945,7 +1150,7 @@
3910
3911 log_printf (LOG_LEVEL_DEBUG, "connection received from libais client %d.\n", new_fd);
3912
3913 - res = conn_info_create (new_fd);
3914 + res = conn_io_create (new_fd);
3915 if (res != 0) {
3916 close (new_fd);
3917 }
3918 @@ -961,7 +1166,7 @@
3919 int ret = 0;
3920
3921 assert (source != NULL);
3922 - if (source->nodeid == my_ip->nodeid) {
3923 + if (source->nodeid == totempg_my_nodeid_get ()) {
3924 ret = 1;
3925 }
3926 return ret;
3927 @@ -973,7 +1178,7 @@
3928 {
3929 assert ((source != NULL) && (conn != NULL));
3930 memset (source, 0, sizeof (mar_message_source_t));
3931 - source->nodeid = my_ip->nodeid;
3932 + source->nodeid = totempg_my_nodeid_get ();
3933 source->conn = conn;
3934 }
3935
3936 @@ -989,15 +1194,12 @@
3937 void openais_ipc_init (
3938 void (*serialize_lock_fn) (void),
3939 void (*serialize_unlock_fn) (void),
3940 - unsigned int gid_valid,
3941 - struct totem_ip_address *my_ip_in)
3942 + unsigned int gid_valid)
3943 {
3944 int libais_server_fd;
3945 struct sockaddr_un un_addr;
3946 int res;
3947
3948 - log_init ("IPC");
3949 -
3950 ipc_serialize_lock_fn = serialize_lock_fn;
3951
3952 ipc_serialize_unlock_fn = serialize_unlock_fn;
3953 @@ -1011,7 +1213,7 @@
3954 openais_exit_error (AIS_DONE_LIBAIS_SOCKET);
3955 };
3956
3957 - totemip_nosigpipe(libais_server_fd);
3958 + totemip_nosigpipe (libais_server_fd);
3959 res = fcntl (libais_server_fd, F_SETFL, O_NONBLOCK);
3960 if (res == -1) {
3961 log_printf (LOG_LEVEL_ERROR, "Could not set non-blocking operation on server socket: %s\n", strerror (errno));
3962 @@ -1043,12 +1245,10 @@
3963 * Setup libais connection dispatch routine
3964 */
3965 poll_dispatch_add (aisexec_poll_handle, libais_server_fd,
3966 - POLLIN, 0, poll_handler_libais_accept);
3967 + POLLIN, 0, poll_handler_accept);
3968
3969 g_gid_valid = gid_valid;
3970
3971 - my_ip = my_ip_in;
3972 -
3973 /*
3974 * Reset internal state of flow control when
3975 * configuration change occurs
3976 @@ -1067,33 +1267,14 @@
3977 {
3978 struct conn_info *conn_info = (struct conn_info *)conn;
3979
3980 - if (conn != NULL) {
3981 - return ((void *)conn_info->private_data);
3982 - } else {
3983 - return NULL;
3984 - }
3985 + return (conn_info->private_data);
3986 }
3987
3988 -/*
3989 - * Get the conn info partner connection
3990 - */
3991 -void *openais_conn_partner_get (void *conn)
3992 -{
3993 - struct conn_info *conn_info = (struct conn_info *)conn;
3994 -
3995 - if (conn != NULL) {
3996 - return ((void *)conn_info->conn_info_partner);
3997 - } else {
3998 - return NULL;
3999 - }
4000 -}
4001 -
4002 -int openais_conn_send_response (
4003 - void *conn,
4004 +static int conn_io_send (
4005 + struct conn_io *conn_io,
4006 void *msg,
4007 int mlen)
4008 {
4009 - struct queue *outq;
4010 char *cmsg;
4011 int res = 0;
4012 int queue_empty;
4013 @@ -1102,47 +1283,47 @@
4014 struct msghdr msg_send;
4015 struct iovec iov_send;
4016 char *msg_addr;
4017 - struct conn_info *conn_info = (struct conn_info *)conn;
4018
4019 - if (conn_info == NULL) {
4020 - return -1;
4021 - }
4022 -
4023 - if (!libais_connection_active (conn_info)) {
4024 - return (-1);
4025 + if (conn_io == NULL) {
4026 + assert (0);
4027 }
4028
4029 - ipc_flow_control (conn_info);
4030 -
4031 - outq = &conn_info->outq;
4032 +// ipc_flow_control (conn_info);
4033
4034 msg_send.msg_iov = &iov_send;
4035 msg_send.msg_name = 0;
4036 msg_send.msg_namelen = 0;
4037 msg_send.msg_iovlen = 1;
4038 +#ifndef OPENAIS_SOLARIS
4039 msg_send.msg_control = 0;
4040 msg_send.msg_controllen = 0;
4041 msg_send.msg_flags = 0;
4042 +#else
4043 + msg_send.msg_accrights = 0;
4044 + msg_send.msg_accrightslen = 0;
4045 +#endif
4046
4047 - if (queue_is_full (outq)) {
4048 + pthread_mutex_lock (&conn_io->mutex);
4049 + if (queue_is_full (&conn_io->outq)) {
4050 /*
4051 * Start a disconnect if we have not already started one
4052 * and report that the outgoing queue is full
4053 */
4054 log_printf (LOG_LEVEL_ERROR, "Library queue is full, disconnecting library connection.\n");
4055 - libais_disconnect_request (conn_info);
4056 + disconnect_request (conn_io->conn_info);
4057 + pthread_mutex_unlock (&conn_io->mutex);
4058 return (-1);
4059 }
4060 - while (!queue_is_empty (outq)) {
4061 - queue_item = queue_item_get (outq);
4062 + while (!queue_is_empty (&conn_io->outq)) {
4063 + queue_item = queue_item_get (&conn_io->outq);
4064 msg_addr = (char *)queue_item->msg;
4065 - msg_addr = &msg_addr[conn_info->byte_start];
4066 + msg_addr = &msg_addr[conn_io->byte_start];
4067
4068 iov_send.iov_base = msg_addr;
4069 - iov_send.iov_len = queue_item->mlen - conn_info->byte_start;
4070 + iov_send.iov_len = queue_item->mlen - conn_io->byte_start;
4071
4072 retry_sendmsg:
4073 - res = sendmsg (conn_info->fd, &msg_send, MSG_NOSIGNAL);
4074 + res = sendmsg (conn_io->fd, &msg_send, MSG_NOSIGNAL);
4075 if (res == -1 && errno == EINTR) {
4076 goto retry_sendmsg;
4077 }
4078 @@ -1150,29 +1331,30 @@
4079 break; /* outgoing kernel queue full */
4080 }
4081 if (res == -1 && errno == EPIPE) {
4082 - libais_disconnect_request (conn_info);
4083 + disconnect_request (conn_io->conn_info);
4084 + pthread_mutex_unlock (&conn_io->mutex);
4085 return (0);
4086 }
4087 if (res == -1) {
4088 - assert (0);
4089 +// assert (0);
4090 break; /* some other error, stop trying to send message */
4091 }
4092 - if (res + conn_info->byte_start != queue_item->mlen) {
4093 - conn_info->byte_start += res;
4094 + if (res + conn_io->byte_start != queue_item->mlen) {
4095 + conn_io->byte_start += res;
4096 break;
4097 }
4098
4099 /*
4100 * Message sent, try sending another message
4101 */
4102 - queue_item_remove (outq);
4103 - conn_info->byte_start = 0;
4104 + queue_item_remove (&conn_io->outq);
4105 + conn_io->byte_start = 0;
4106 free (queue_item->msg);
4107 } /* while queue not empty */
4108
4109 res = -1;
4110
4111 - queue_empty = queue_is_empty (outq);
4112 + queue_empty = queue_is_empty (&conn_io->outq);
4113 /*
4114 * Send request message
4115 */
4116 @@ -1181,21 +1363,19 @@
4117 iov_send.iov_base = msg;
4118 iov_send.iov_len = mlen;
4119 retry_sendmsg_two:
4120 - res = sendmsg (conn_info->fd, &msg_send, MSG_NOSIGNAL);
4121 + res = sendmsg (conn_io->fd, &msg_send, MSG_NOSIGNAL);
4122 if (res == -1 && errno == EINTR) {
4123 goto retry_sendmsg_two;
4124 }
4125 if (res == -1 && errno == EAGAIN) {
4126 - conn_info->byte_start = 0;
4127 - conn_info->events = POLLIN|POLLNVAL;
4128 + conn_io->byte_start = 0;
4129 }
4130 if (res != -1) {
4131 if (res != mlen) {
4132 - conn_info->byte_start += res;
4133 + conn_io->byte_start += res;
4134 res = -1;
4135 } else {
4136 - conn_info->byte_start = 0;
4137 - conn_info->events = POLLIN|POLLNVAL;
4138 + conn_io->byte_start = 0;
4139 }
4140 }
4141 }
4142 @@ -1207,21 +1387,26 @@
4143 cmsg = malloc (mlen);
4144 if (cmsg == 0) {
4145 log_printf (LOG_LEVEL_ERROR, "Library queue couldn't allocate a message, disconnecting library connection.\n");
4146 - libais_disconnect_request (conn_info);
4147 + disconnect_request (conn_io->conn_info);
4148 + pthread_mutex_unlock (&conn_io->mutex);
4149 return (-1);
4150 }
4151 queue_item_out.msg = cmsg;
4152 queue_item_out.mlen = mlen;
4153 memcpy (cmsg, msg, mlen);
4154 - queue_item_add (outq, &queue_item_out);
4155 + queue_item_add (&conn_io->outq, &queue_item_out);
4156
4157 /*
4158 - * Send a pthread_kill to interrupt the poll syscall
4159 - * and start a new poll operation in the thread
4160 + * Send a pthread_kill to interrupt the blocked poll syscall
4161 + * and start a new poll operation in the thread if
4162 + * POLLOUT is not already set
4163 */
4164 - conn_info->events = POLLIN|POLLOUT|POLLNVAL;
4165 - pthread_kill (conn_info->thread, SIGUSR1);
4166 + if (conn_io->events != (POLLIN|POLLOUT|POLLNVAL)) {
4167 + conn_io->events = POLLIN|POLLOUT|POLLNVAL;
4168 + pthread_kill (conn_io->thread, SIGUSR1);
4169 + }
4170 }
4171 + pthread_mutex_unlock (&conn_io->mutex);
4172 return (0);
4173 }
4174
4175 @@ -1242,7 +1427,6 @@
4176 id_len,
4177 flow_control_state_set_fn,
4178 context);
4179 - conn_info->conn_info_partner->flow_control_handle = conn_info->flow_control_handle;
4180 }
4181
4182 void openais_ipc_flow_control_destroy (
4183 @@ -1283,3 +1467,18 @@
4184
4185 pthread_mutex_unlock (&conn_info->flow_control_mutex);
4186 }
4187 +
4188 +
4189 +int openais_response_send (void *conn, void *msg, int mlen)
4190 +{
4191 + struct conn_info *conn_info = (struct conn_info *)conn;
4192 +
4193 + return (conn_io_send (conn_info->conn_io_response, msg, mlen));
4194 +}
4195 +
4196 +int openais_dispatch_send (void *conn, void *msg, int mlen)
4197 +{
4198 + struct conn_info *conn_info = (struct conn_info *)conn;
4199 +
4200 + return (conn_io_send (conn_info->conn_io_dispatch, msg, mlen));
4201 +}
4202 diff -uNr openais-0.80.3/exec/ipc.h openais-0.80.3-r1661/exec/ipc.h
4203 --- openais-0.80.3/exec/ipc.h 2007-06-24 08:33:09.000000000 +0200
4204 +++ openais-0.80.3-r1661/exec/ipc.h 2008-11-17 15:54:02.380604445 +0100
4205 @@ -42,17 +42,20 @@
4206
4207 extern int message_source_is_local (mar_message_source_t *source);
4208
4209 -extern void *openais_conn_partner_get (void *conn);
4210 -
4211 extern void *openais_conn_private_data_get (void *conn);
4212
4213 -extern int openais_conn_send_response (void *conn, void *msg, int mlen);
4214 +extern int openais_response_send (void *conn, void *msg, int mlen);
4215 +
4216 +extern int openais_dispatch_send (void *conn, void *msg, int mlen);
4217 +
4218 +extern void openais_conn_info_refcnt_dec (void *conn);
4219 +
4220 +extern void openais_conn_info_refcnt_inc (void *conn);
4221
4222 extern void openais_ipc_init (
4223 void (*serialize_lock_fn) (void),
4224 void (*serialize_unlock_fn) (void),
4225 - unsigned int gid_valid,
4226 - struct totem_ip_address *non_loopback_ip);
4227 + unsigned int gid_valid);
4228
4229 extern int openais_ipc_timer_add (
4230 void *conn,
4231 diff -uNr openais-0.80.3/exec/keygen.c openais-0.80.3-r1661/exec/keygen.c
4232 --- openais-0.80.3/exec/keygen.c 2007-06-24 08:33:09.000000000 +0200
4233 +++ openais-0.80.3-r1661/exec/keygen.c 2008-11-17 15:54:02.380604445 +0100
4234 @@ -73,7 +73,7 @@
4235 /*
4236 * Open key
4237 */
4238 - authkey_fd = open ("/etc/ais/authkey", O_CREAT|O_WRONLY);
4239 + authkey_fd = open ("/etc/ais/authkey", O_CREAT|O_WRONLY, 600);
4240 if (authkey_fd == -1) {
4241 perror ("Could not create /etc/ais/authkey");
4242 exit (1);
4243 @@ -81,7 +81,7 @@
4244 /*
4245 * Set security of authorization key to uid = 0 uid = 0 mode = 0400
4246 */
4247 - fchown (authkey_fd, 0, 0);
4248 + res = fchown (authkey_fd, 0, 0);
4249 fchmod (authkey_fd, 0400);
4250
4251 printf ("Writing openais key to /etc/ais/authkey.\n");
4252 diff -uNr openais-0.80.3/exec/lck.c openais-0.80.3-r1661/exec/lck.c
4253 --- openais-0.80.3/exec/lck.c 2007-06-24 08:33:09.000000000 +0200
4254 +++ openais-0.80.3-r1661/exec/lck.c 2008-11-17 15:54:02.390605772 +0100
4255 @@ -719,12 +719,12 @@
4256 &req_exec_lck_resourceopen->source,
4257 sizeof (mar_message_source_t));
4258
4259 - openais_conn_send_response (
4260 + openais_response_send (
4261 req_exec_lck_resourceopen->source.conn,
4262 &res_lib_lck_resourceopenasync,
4263 sizeof (struct res_lib_lck_resourceopenasync));
4264 - openais_conn_send_response (
4265 - openais_conn_partner_get (req_exec_lck_resourceopen->source.conn),
4266 + openais_dispatch_send (
4267 + req_exec_lck_resourceopen->source.conn,
4268 &res_lib_lck_resourceopenasync,
4269 sizeof (struct res_lib_lck_resourceopenasync));
4270 } else {
4271 @@ -738,7 +738,7 @@
4272 &req_exec_lck_resourceopen->source,
4273 sizeof (mar_message_source_t));
4274
4275 - openais_conn_send_response (req_exec_lck_resourceopen->source.conn,
4276 + openais_response_send (req_exec_lck_resourceopen->source.conn,
4277 &res_lib_lck_resourceopen,
4278 sizeof (struct res_lib_lck_resourceopen));
4279 }
4280 @@ -774,7 +774,7 @@
4281 res_lib_lck_resourceclose.header.size = sizeof (struct res_lib_lck_resourceclose);
4282 res_lib_lck_resourceclose.header.id = MESSAGE_RES_LCK_RESOURCECLOSE;
4283 res_lib_lck_resourceclose.header.error = error;
4284 - openais_conn_send_response (
4285 + openais_response_send (
4286 req_exec_lck_resourceclose->source.conn,
4287 &res_lib_lck_resourceclose, sizeof (struct res_lib_lck_resourceclose));
4288 }
4289 @@ -801,8 +801,8 @@
4290 res_lib_lck_lockwaitercallback.mode_held = SA_LCK_PR_LOCK_MODE;
4291 }
4292
4293 - openais_conn_send_response (
4294 - openais_conn_partner_get (resource_lock->callback_source.conn),
4295 + openais_dispatch_send (
4296 + resource_lock->callback_source.conn,
4297 &res_lib_lck_lockwaitercallback,
4298 sizeof (struct res_lib_lck_lockwaitercallback));
4299 }
4300 @@ -837,8 +837,8 @@
4301 res_lib_lck_resourcelockasync.lockStatus = resource_lock->lock_status;
4302 res_lib_lck_resourcelockasync.invocation = resource_lock->invocation;
4303 res_lib_lck_resourcelockasync.lockId = resource_lock->lock_id;
4304 - openais_conn_send_response (
4305 - openais_conn_partner_get (source->conn),
4306 + openais_dispatch_send (
4307 + source->conn,
4308 &res_lib_lck_resourcelockasync,
4309 sizeof (struct res_lib_lck_resourcelockasync));
4310 }
4311 @@ -861,7 +861,7 @@
4312 res_lib_lck_resourcelock.header.error = error;
4313 res_lib_lck_resourcelock.resource_lock = (void *)resource_lock;
4314 res_lib_lck_resourcelock.lockStatus = resource_lock->lock_status;
4315 - openais_conn_send_response (source->conn,
4316 + openais_response_send (source->conn,
4317 &res_lib_lck_resourcelock,
4318 sizeof (struct res_lib_lck_resourcelock));
4319 }
4320 @@ -1133,14 +1133,11 @@
4321 * Deliver async response to library
4322 */
4323 req_exec_lck_resourcelock->source.conn =
4324 - openais_conn_partner_get (req_exec_lck_resourcelock->source.conn);
4325 + req_exec_lck_resourcelock->source.conn;
4326 resource_lock_async_deliver (
4327 &req_exec_lck_resourcelock->source,
4328 resource_lock,
4329 SA_AIS_OK);
4330 -// TODO why is this twice ?
4331 - req_exec_lck_resourcelock->source.conn =
4332 - openais_conn_partner_get (req_exec_lck_resourcelock->source.conn);
4333 }
4334
4335 error_exit:
4336 @@ -1184,11 +1181,11 @@
4337 res_lib_lck_resourceunlockasync.invocation =
4338 req_exec_lck_resourceunlock->invocation;
4339
4340 - openais_conn_send_response (
4341 + openais_dispatch_send (
4342 req_exec_lck_resourceunlock->source.conn,
4343 &res_lib_lck_resourceunlockasync,
4344 sizeof (struct res_lib_lck_resourceunlockasync));
4345 - openais_conn_send_response (
4346 + openais_response_send (
4347 resource_lock->callback_source.conn,
4348 &res_lib_lck_resourceunlockasync,
4349 sizeof (struct res_lib_lck_resourceunlockasync));
4350 @@ -1196,8 +1193,10 @@
4351 res_lib_lck_resourceunlock.header.size = sizeof (struct res_lib_lck_resourceunlock);
4352 res_lib_lck_resourceunlock.header.id = MESSAGE_RES_LCK_RESOURCEUNLOCK;
4353 res_lib_lck_resourceunlock.header.error = error;
4354 - openais_conn_send_response (req_exec_lck_resourceunlock->source.conn,
4355 - &res_lib_lck_resourceunlock, sizeof (struct res_lib_lck_resourceunlock));
4356 + openais_response_send (
4357 + req_exec_lck_resourceunlock->source.conn,
4358 + &res_lib_lck_resourceunlock,
4359 + sizeof (struct res_lib_lck_resourceunlock));
4360 }
4361 }
4362 }
4363 @@ -1253,8 +1252,10 @@
4364 res_lib_lck_lockpurge.header.size = sizeof (struct res_lib_lck_lockpurge);
4365 res_lib_lck_lockpurge.header.id = MESSAGE_RES_LCK_LOCKPURGE;
4366 res_lib_lck_lockpurge.header.error = error;
4367 - openais_conn_send_response (req_exec_lck_lockpurge->source.conn,
4368 - &res_lib_lck_lockpurge, sizeof (struct res_lib_lck_lockpurge));
4369 + openais_response_send (
4370 + req_exec_lck_lockpurge->source.conn,
4371 + &res_lib_lck_lockpurge,
4372 + sizeof (struct res_lib_lck_lockpurge));
4373 }
4374 }
4375
4376 @@ -1366,7 +1367,8 @@
4377 res_lib_lck_resourceclose.header.id = MESSAGE_RES_LCK_RESOURCECLOSE;
4378 res_lib_lck_resourceclose.header.error = SA_AIS_ERR_NOT_EXIST;
4379
4380 - openais_conn_send_response (conn,
4381 + openais_response_send (
4382 + conn,
4383 &res_lib_lck_resourceclose,
4384 sizeof (struct res_lib_lck_resourceclose));
4385 }
4386 diff -uNr openais-0.80.3/exec/main.c openais-0.80.3-r1661/exec/main.c
4387 --- openais-0.80.3/exec/main.c 2007-06-24 08:33:09.000000000 +0200
4388 +++ openais-0.80.3-r1661/exec/main.c 2008-11-17 15:54:02.400604305 +0100
4389 @@ -120,8 +120,6 @@
4390 }
4391
4392
4393 -struct totem_ip_address *this_ip;
4394 -struct totem_ip_address this_non_loopback_ip;
4395 #define LOCALHOST_IP inet_addr("127.0.0.1")
4396
4397 totempg_groups_handle openais_group_handle;
4398 @@ -175,15 +173,29 @@
4399 static int openais_sync_callbacks_retrieve (int sync_id,
4400 struct sync_callbacks *callbacks)
4401 {
4402 - if (ais_service[sync_id] == NULL) {
4403 + unsigned int ais_service_index;
4404 + unsigned int ais_services_found = 0;
4405 +
4406 + for (ais_service_index = 0;
4407 + ais_service_index < SERVICE_HANDLER_MAXIMUM_COUNT;
4408 + ais_service_index++) {
4409 +
4410 + if (ais_service[ais_service_index] != NULL) {
4411 + if (ais_services_found == sync_id) {
4412 + break;
4413 + }
4414 + ais_services_found += 1;
4415 + }
4416 + }
4417 + if (ais_service_index == SERVICE_HANDLER_MAXIMUM_COUNT) {
4418 memset (callbacks, 0, sizeof (struct sync_callbacks));
4419 return (-1);
4420 }
4421 - callbacks->name = ais_service[sync_id]->name;
4422 - callbacks->sync_init = ais_service[sync_id]->sync_init;
4423 - callbacks->sync_process = ais_service[sync_id]->sync_process;
4424 - callbacks->sync_activate = ais_service[sync_id]->sync_activate;
4425 - callbacks->sync_abort = ais_service[sync_id]->sync_abort;
4426 + callbacks->name = ais_service[ais_service_index]->name;
4427 + callbacks->sync_init = ais_service[ais_service_index]->sync_init;
4428 + callbacks->sync_process = ais_service[ais_service_index]->sync_process;
4429 + callbacks->sync_activate = ais_service[ais_service_index]->sync_activate;
4430 + callbacks->sync_abort = ais_service[ais_service_index]->sync_abort;
4431 return (0);
4432 }
4433
4434 @@ -200,10 +212,6 @@
4435
4436 memcpy (&aisexec_ring_id, ring_id, sizeof (struct memb_ring_id));
4437
4438 - if (!totemip_localhost_check(this_ip)) {
4439 - totemip_copy(&this_non_loopback_ip, this_ip);
4440 - }
4441 -
4442 /*
4443 * Call configuration change for all services
4444 */
4445 @@ -262,7 +270,6 @@
4446
4447 static void aisexec_tty_detach (void)
4448 {
4449 -#ifndef DEBUG
4450 /*
4451 * Disconnect from TTY if this is not a debug run
4452 */
4453 @@ -279,7 +286,6 @@
4454 exit (0);
4455 break;
4456 }
4457 -#endif
4458 }
4459
4460 static void aisexec_setscheduler (void)
4461 @@ -392,17 +398,31 @@
4462 int res;
4463 int totem_log_service;
4464 log_init ("MAIN");
4465 + unsigned int background;
4466 + int ch;
4467
4468 - aisexec_tty_detach ();
4469 + background = 1;
4470 +
4471 + while ((ch = getopt (argc, argv, "fp")) != EOF) {
4472 + switch (ch) {
4473 + case 'f':
4474 + background = 0;
4475 + break;
4476 + default:
4477 + fprintf (stderr, "Usage:\n");
4478 + fprintf (stderr, " -f : Start application in forground.\n");
4479 + return EXIT_FAILURE;
4480 + }
4481 + }
4482 +
4483 + if (background) {
4484 + aisexec_tty_detach ();
4485 + }
4486
4487 log_printf (LOG_LEVEL_NOTICE, "AIS Executive Service RELEASE '%s'\n", RELEASE_VERSION);
4488 log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n");
4489 log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006 Red Hat, Inc.\n");
4490
4491 - memset(&this_non_loopback_ip, 0, sizeof(struct totem_ip_address));
4492 -
4493 - totemip_localhost(AF_INET, &this_non_loopback_ip);
4494 -
4495 signal (SIGINT, sigintr_handler);
4496 signal (SIGUSR2, sigusr2_handler);
4497 signal (SIGSEGV, sigsegv_handler);
4498 @@ -548,8 +568,6 @@
4499 /*
4500 * This must occur after totempg is initialized because "this_ip" must be set
4501 */
4502 - this_ip = &totem_config.interfaces[0].boundto;
4503 -
4504 res = openais_service_init_all (service_count, objdb);
4505 if (res == -1) {
4506 log_printf (LOG_LEVEL_ERROR, "Could not init services\n");
4507 @@ -577,8 +595,7 @@
4508 openais_ipc_init (
4509 serialize_mutex_lock,
4510 serialize_mutex_unlock,
4511 - gid_valid,
4512 - &this_non_loopback_ip);
4513 + gid_valid);
4514
4515 /*
4516 * Start main processing loop
4517 diff -uNr openais-0.80.3/exec/main.h openais-0.80.3-r1661/exec/main.h
4518 --- openais-0.80.3/exec/main.h 2007-06-24 08:33:09.000000000 +0200
4519 +++ openais-0.80.3-r1661/exec/main.h 2008-11-17 15:54:02.400604305 +0100
4520 @@ -53,8 +53,6 @@
4521
4522 #define SIZEINB MESSAGE_SIZE_MAX
4523
4524 -extern struct totem_ip_address *this_ip;
4525 -
4526 extern struct totempg_group openais_group;
4527
4528 extern totempg_groups_handle openais_group_handle;
4529 diff -uNr openais-0.80.3/exec/msg.c openais-0.80.3-r1661/exec/msg.c
4530 --- openais-0.80.3/exec/msg.c 2007-06-24 08:33:09.000000000 +0200
4531 +++ openais-0.80.3-r1661/exec/msg.c 2008-11-17 15:54:02.400604305 +0100
4532 @@ -675,9 +675,6 @@
4533 /*
4534 * Initialize the saved ring ID.
4535 */
4536 -// saved_ring_id.seq = 0;
4537 -// saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
4538 -
4539 return (0);
4540 }
4541
4542 @@ -810,12 +807,12 @@
4543 &req_exec_msg_queueopen->source,
4544 sizeof (mar_message_source_t));
4545
4546 - openais_conn_send_response (
4547 + openais_response_send (
4548 req_exec_msg_queueopen->source.conn,
4549 &res_lib_msg_queueopenasync,
4550 sizeof (struct res_lib_msg_queueopenasync));
4551 - openais_conn_send_response (
4552 - openais_conn_partner_get (req_exec_msg_queueopen->source.conn),
4553 + openais_dispatch_send (
4554 + req_exec_msg_queueopen->source.conn,
4555 &res_lib_msg_queueopenasync,
4556 sizeof (struct res_lib_msg_queueopenasync));
4557 } else {
4558 @@ -829,7 +826,7 @@
4559 &req_exec_msg_queueopen->source,
4560 sizeof (mar_message_source_t));
4561
4562 - openais_conn_send_response (
4563 + openais_dispatch_send (
4564 req_exec_msg_queueopen->source.conn,
4565 &res_lib_msg_queueopen,
4566 sizeof (struct res_lib_msg_queueopen));
4567 @@ -868,8 +865,10 @@
4568 res_lib_msg_queueclose.header.size = sizeof (struct res_lib_msg_queueclose);
4569 res_lib_msg_queueclose.header.id = MESSAGE_RES_MSG_QUEUECLOSE;
4570 res_lib_msg_queueclose.header.error = error;
4571 - openais_conn_send_response (req_exec_msg_queueclose->source.conn,
4572 - &res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose));
4573 + openais_dispatch_send (
4574 + req_exec_msg_queueclose->source.conn,
4575 + &res_lib_msg_queueclose,
4576 + sizeof (struct res_lib_msg_queueclose));
4577 }
4578 }
4579
4580 @@ -930,7 +929,7 @@
4581 res_lib_msg_queuegroupcreate.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
4582 res_lib_msg_queuegroupcreate.header.error = error;
4583
4584 - openais_conn_send_response (
4585 + openais_dispatch_send (
4586 req_exec_msg_queuegroupcreate->source.conn,
4587 &res_lib_msg_queuegroupcreate,
4588 sizeof (struct res_lib_msg_queuegroupcreate));
4589 @@ -977,7 +976,7 @@
4590 res_lib_msg_queuegroupinsert.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
4591 res_lib_msg_queuegroupinsert.header.error = error;
4592
4593 - openais_conn_send_response (
4594 + openais_dispatch_send (
4595 req_exec_msg_queuegroupinsert->source.conn,
4596 &res_lib_msg_queuegroupinsert,
4597 sizeof (struct res_lib_msg_queuegroupinsert));
4598 @@ -1021,7 +1020,7 @@
4599 res_lib_msg_queuegroupremove.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
4600 res_lib_msg_queuegroupremove.header.error = error;
4601
4602 - openais_conn_send_response (
4603 + openais_dispatch_send (
4604 req_exec_msg_queuegroupremove->source.conn,
4605 &res_lib_msg_queuegroupremove,
4606 sizeof (struct res_lib_msg_queuegroupremove));
4607 @@ -1052,7 +1051,7 @@
4608 res_lib_msg_queuegroupdelete.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
4609 res_lib_msg_queuegroupdelete.header.error = error;
4610
4611 - openais_conn_send_response (
4612 + openais_dispatch_send (
4613 req_exec_msg_queuegroupdelete->source.conn,
4614 &res_lib_msg_queuegroupdelete,
4615 sizeof (struct res_lib_msg_queuegroupdelete));
4616 diff -uNr openais-0.80.3/exec/service.c openais-0.80.3-r1661/exec/service.c
4617 --- openais-0.80.3/exec/service.c 2007-06-24 08:33:09.000000000 +0200
4618 +++ openais-0.80.3-r1661/exec/service.c 2008-11-17 15:54:02.380604445 +0100
4619 @@ -87,7 +87,7 @@
4620 }
4621 };
4622
4623 -struct openais_service_handler *ais_service[128];
4624 +struct openais_service_handler *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT];
4625
4626 /*
4627 * Adds a service handler to the object database
4628 diff -uNr openais-0.80.3/exec/service.h openais-0.80.3-r1661/exec/service.h
4629 --- openais-0.80.3/exec/service.h 2007-06-24 08:33:09.000000000 +0200
4630 +++ openais-0.80.3-r1661/exec/service.h 2008-11-17 15:54:02.380604445 +0100
4631 @@ -44,6 +44,7 @@
4632 #endif
4633
4634 #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
4635 +#define SERVICE_HANDLER_MAXIMUM_COUNT 64
4636
4637 enum openais_flow_control {
4638 OPENAIS_FLOW_CONTROL_REQUIRED = 1,
4639 diff -uNr openais-0.80.3/exec/sync.c openais-0.80.3-r1661/exec/sync.c
4640 --- openais-0.80.3/exec/sync.c 2007-06-24 08:33:09.000000000 +0200
4641 +++ openais-0.80.3-r1661/exec/sync.c 2008-11-17 15:54:02.390605772 +0100
4642 @@ -198,9 +198,10 @@
4643 {
4644 int res;
4645
4646 -// TODO rewrite this to get rid of the for (;;)
4647 for (;;) {
4648 - res = sync_callbacks_retrieve (sync_recovery_index, &sync_callbacks);
4649 + res = sync_callbacks_retrieve (sync_recovery_index,
4650 + &sync_callbacks);
4651 +
4652 /*
4653 * No more service handlers have sync callbacks at this time
4654 ` */
4655 @@ -418,7 +419,6 @@
4656 log_printf (LOG_LEVEL_DEBUG,
4657 "Committing synchronization for (%s)\n",
4658 sync_callbacks.name);
4659 -
4660 }
4661
4662 /*
4663 @@ -452,8 +452,12 @@
4664 {
4665 sync_ring_id = ring_id;
4666
4667 + if (configuration_type != TOTEM_CONFIGURATION_REGULAR) {
4668 + return;
4669 + }
4670 if (sync_processing && sync_callbacks.sync_abort != NULL) {
4671 sync_callbacks.sync_abort ();
4672 + sync_callbacks.sync_activate = NULL;
4673 }
4674 /*
4675 * If no virtual synchrony filter configured, then start
4676 diff -uNr openais-0.80.3/exec/timer.c openais-0.80.3-r1661/exec/timer.c
4677 --- openais-0.80.3/exec/timer.c 2007-06-25 04:22:54.000000000 +0200
4678 +++ openais-0.80.3-r1661/exec/timer.c 2008-11-17 15:54:02.400604305 +0100
4679 @@ -126,13 +126,13 @@
4680 if (fds == -1) {
4681 goto retry_poll;
4682 }
4683 - pthread_mutex_lock (&timer_mutex);
4684 timer_serialize_lock_fn ();
4685 + pthread_mutex_lock (&timer_mutex);
4686
4687 timerlist_expire (&timers_timerlist);
4688
4689 - timer_serialize_unlock_fn ();
4690 pthread_mutex_unlock (&timer_mutex);
4691 + timer_serialize_unlock_fn ();
4692 }
4693
4694 pthread_exit (0);
4695 @@ -177,7 +177,7 @@
4696 int res;
4697 int unlock;
4698
4699 - if (pthread_equal (pthread_self(), expiry_thread) == 0) {
4700 + if (pthread_equal (pthread_self(), expiry_thread) != 0) {
4701 unlock = 0;
4702 } else {
4703 unlock = 1;
4704 @@ -209,7 +209,7 @@
4705 int res;
4706 int unlock;
4707
4708 - if (pthread_equal (pthread_self(), expiry_thread) == 0) {
4709 + if (pthread_equal (pthread_self(), expiry_thread) != 0) {
4710 unlock = 0;
4711 } else {
4712 unlock = 1;
4713 @@ -241,7 +241,7 @@
4714 return;
4715 }
4716
4717 - if (pthread_equal (pthread_self(), expiry_thread) == 0) {
4718 + if (pthread_equal (pthread_self(), expiry_thread) != 0) {
4719 unlock = 0;
4720 } else {
4721 unlock = 1;
4722 diff -uNr openais-0.80.3/exec/totem.h openais-0.80.3-r1661/exec/totem.h
4723 --- openais-0.80.3/exec/totem.h 2007-06-24 08:33:09.000000000 +0200
4724 +++ openais-0.80.3-r1661/exec/totem.h 2008-11-17 15:54:02.400604305 +0100
4725 @@ -89,6 +89,7 @@
4726 struct totem_interface *interfaces;
4727 int interface_count;
4728 unsigned int node_id;
4729 + unsigned int clear_node_high_bit;
4730
4731 /*
4732 * key information
4733 diff -uNr openais-0.80.3/exec/totemconfig.c openais-0.80.3-r1661/exec/totemconfig.c
4734 --- openais-0.80.3/exec/totemconfig.c 2007-06-24 08:33:09.000000000 +0200
4735 +++ openais-0.80.3-r1661/exec/totemconfig.c 2008-11-17 15:54:02.400604305 +0100
4736 @@ -174,6 +174,13 @@
4737 */
4738 objdb_get_int (objdb, object_totem_handle, "nodeid", &totem_config->node_id);
4739
4740 + totem_config->clear_node_high_bit = 0;
4741 + if (!objdb_get_string (objdb,object_totem_handle, "clear_node_high_bit", &str)) {
4742 + if (strcmp (str, "yes") == 0) {
4743 + totem_config->clear_node_high_bit = 1;
4744 + }
4745 + }
4746 +
4747 objdb_get_int (objdb,object_totem_handle, "threads", &totem_config->threads);
4748
4749
4750 diff -uNr openais-0.80.3/exec/totemmrp.c openais-0.80.3-r1661/exec/totemmrp.c
4751 --- openais-0.80.3/exec/totemmrp.c 2007-06-24 08:33:09.000000000 +0200
4752 +++ openais-0.80.3-r1661/exec/totemmrp.c 2008-11-17 15:54:02.390605772 +0100
4753 @@ -191,6 +191,16 @@
4754 return (res);
4755 }
4756
4757 +int totemmrp_my_nodeid_get (void)
4758 +{
4759 + return (totemsrp_my_nodeid_get (totemsrp_handle_in));
4760 +}
4761 +
4762 +int totemmrp_my_family_get (void)
4763 +{
4764 + return (totemsrp_my_family_get (totemsrp_handle_in));
4765 +}
4766 +
4767 extern int totemmrp_ring_reenable (void)
4768 {
4769 int res;
4770 diff -uNr openais-0.80.3/exec/totemmrp.h openais-0.80.3-r1661/exec/totemmrp.h
4771 --- openais-0.80.3/exec/totemmrp.h 2007-06-24 08:33:09.000000000 +0200
4772 +++ openais-0.80.3-r1661/exec/totemmrp.h 2008-11-17 15:54:02.390605772 +0100
4773 @@ -105,6 +105,10 @@
4774 char ***status,
4775 unsigned int *iface_count);
4776
4777 +extern int totemmrp_my_nodeid_get (void);
4778 +
4779 +extern int totemmrp_my_family_get (void);
4780 +
4781 extern int totemmrp_ring_reenable (void);
4782
4783 #endif /* TOTEMMRP_H_DEFINED */
4784 diff -uNr openais-0.80.3/exec/totemnet.c openais-0.80.3-r1661/exec/totemnet.c
4785 --- openais-0.80.3/exec/totemnet.c 2007-06-24 08:33:09.000000000 +0200
4786 +++ openais-0.80.3-r1661/exec/totemnet.c 2008-11-17 15:54:02.370604375 +0100
4787 @@ -1227,6 +1227,15 @@
4788
4789 instance->totemnet_poll_handle = poll_handle;
4790
4791 + if(instance->totem_config->node_id == 0) {
4792 + int32_t nodeid = 0;
4793 + memcpy (&nodeid, instance->totem_interface->bindnet.addr, sizeof (int32_t));
4794 + if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
4795 + nodeid = 0 - nodeid;
4796 + }
4797 + instance->totem_config->node_id = nodeid;
4798 + }
4799 +
4800 instance->totem_interface->bindnet.nodeid = instance->totem_config->node_id;
4801
4802 instance->context = context;
4803 diff -uNr openais-0.80.3/exec/totempg.c openais-0.80.3-r1661/exec/totempg.c
4804 --- openais-0.80.3/exec/totempg.c 2007-06-24 08:33:09.000000000 +0200
4805 +++ openais-0.80.3-r1661/exec/totempg.c 2008-11-17 15:54:02.380604445 +0100
4806 @@ -720,14 +720,16 @@
4807 * Multicast a message
4808 */
4809 static int mcast_msg (
4810 - struct iovec *iovec,
4811 + struct iovec *iovec_in,
4812 int iov_len,
4813 int guarantee)
4814 {
4815 int res = 0;
4816 struct totempg_mcast mcast;
4817 struct iovec iovecs[3];
4818 + struct iovec iovec[64];
4819 int i;
4820 + int dest, src;
4821 int max_packet_size = 0;
4822 int copy_len = 0;
4823 int copy_base = 0;
4824 @@ -736,6 +738,18 @@
4825 pthread_mutex_lock (&mcast_msg_mutex);
4826 totemmrp_new_msg_signal ();
4827
4828 + /*
4829 + * Remove zero length iovectors from the list
4830 + */
4831 + assert (iov_len < 64);
4832 + for (dest = 0, src = 0; src < iov_len; src++) {
4833 + if (iovec_in[src].iov_len) {
4834 + memcpy (&iovec[dest++], &iovec_in[src],
4835 + sizeof (struct iovec));
4836 + }
4837 + }
4838 + iov_len = dest;
4839 +
4840 max_packet_size = TOTEMPG_PACKET_SIZE -
4841 (sizeof (unsigned short) * (mcast_packed_msg_count + 1));
4842
4843 @@ -870,13 +884,14 @@
4844 /*
4845 * Determine if a message of msg_size could be queued
4846 */
4847 +#define FUZZY_AVAIL_SUBTRACT 5
4848 static int send_ok (
4849 int msg_size)
4850 {
4851 int avail = 0;
4852 int total;
4853
4854 - avail = totemmrp_avail ();
4855 + avail = totemmrp_avail () - FUZZY_AVAIL_SUBTRACT;
4856
4857 /*
4858 * msg size less then totempg_totem_config->net_mtu - 25 will take up
4859 @@ -1241,3 +1256,12 @@
4860 return (iface_string);
4861 }
4862
4863 +int totempg_my_nodeid_get (void)
4864 +{
4865 + return (totemmrp_my_nodeid_get());
4866 +}
4867 +
4868 +int totempg_my_family_get (void)
4869 +{
4870 + return (totemmrp_my_family_get());
4871 +}
4872 diff -uNr openais-0.80.3/exec/totempg.h openais-0.80.3-r1661/exec/totempg.h
4873 --- openais-0.80.3/exec/totempg.h 2007-06-24 08:33:09.000000000 +0200
4874 +++ openais-0.80.3-r1661/exec/totempg.h 2008-11-17 15:54:02.380604445 +0100
4875 @@ -137,8 +137,12 @@
4876 char ***status,
4877 unsigned int *iface_count);
4878
4879 -extern int totempg_ring_reenable (void);
4880 -
4881 extern char *totempg_ifaces_print (unsigned int nodeid);
4882
4883 +extern int totempg_my_nodeid_get (void);
4884 +
4885 +extern int totempg_my_family_get (void);
4886 +
4887 +extern int totempg_ring_reenable (void);
4888 +
4889 #endif /* TOTEMPG_H_DEFINED */
4890 diff -uNr openais-0.80.3/exec/totemsrp.c openais-0.80.3-r1661/exec/totemsrp.c
4891 --- openais-0.80.3/exec/totemsrp.c 2007-06-24 08:33:09.000000000 +0200
4892 +++ openais-0.80.3-r1661/exec/totemsrp.c 2008-11-17 15:54:02.400604305 +0100
4893 @@ -138,6 +138,11 @@
4894 MESSAGE_TYPE_TOKEN_HOLD_CANCEL = 5, /* cancel the holding of the token */
4895 };
4896
4897 +enum encapsulation_type {
4898 + MESSAGE_ENCAPSULATED = 1,
4899 + MESSAGE_NOT_ENCAPSULATED = 2
4900 +};
4901 +
4902 /*
4903 * New membership algorithm local variables
4904 */
4905 @@ -393,8 +398,6 @@
4906
4907 unsigned int my_token_seq;
4908
4909 - unsigned int my_commit_token_seq;
4910 -
4911 /*
4912 * Timers
4913 */
4914 @@ -551,7 +554,8 @@
4915 int fcc_mcasts_allowed);
4916 static void messages_free (struct totemsrp_instance *instance, unsigned int token_aru);
4917
4918 -static void memb_ring_id_store (struct totemsrp_instance *instance);
4919 +static void memb_ring_id_set_and_store (struct totemsrp_instance *instance,
4920 + struct memb_ring_id *ring_id);
4921 static void memb_state_commit_token_update (struct totemsrp_instance *instance, struct memb_commit_token *commit_token);
4922 static void memb_state_commit_token_target_set (struct totemsrp_instance *instance, struct memb_commit_token *commit_token);
4923 static int memb_state_commit_token_send (struct totemsrp_instance *instance, struct memb_commit_token *memb_commit_token);
4924 @@ -615,12 +619,10 @@
4925
4926 list_init (&instance->token_callback_sent_listhead);
4927
4928 - instance->my_received_flg = 0;
4929 + instance->my_received_flg = 1;
4930
4931 instance->my_token_seq = SEQNO_START_TOKEN - 1;
4932
4933 - instance->my_commit_token_seq = SEQNO_START_TOKEN - 1;
4934 -
4935 instance->memb_state = MEMB_STATE_OPERATIONAL;
4936
4937 instance->set_aru = -1;
4938 @@ -903,6 +905,43 @@
4939 return (res);
4940 }
4941
4942 +int totemsrp_my_nodeid_get (
4943 + totemsrp_handle handle)
4944 +{
4945 + struct totemsrp_instance *instance;
4946 + int res;
4947 +
4948 + res = hdb_handle_get (&totemsrp_instance_database, handle,
4949 + (void *)&instance);
4950 + if (res != 0) {
4951 + return (0);
4952 + }
4953 +
4954 + res = instance->totem_config->interfaces[0].boundto.nodeid;
4955 +
4956 + hdb_handle_put (&totemsrp_instance_database, handle);
4957 + return (res);
4958 +}
4959 +
4960 +int totemsrp_my_family_get (
4961 + totemsrp_handle handle)
4962 +{
4963 + struct totemsrp_instance *instance;
4964 + int res;
4965 +
4966 + res = hdb_handle_get (&totemsrp_instance_database, handle,
4967 + (void *)&instance);
4968 + if (res != 0) {
4969 + return (0);
4970 + }
4971 +
4972 + res = instance->totem_config->interfaces[0].boundto.family;
4973 +
4974 + hdb_handle_put (&totemsrp_instance_database, handle);
4975 + return (res);
4976 +}
4977 +
4978 +
4979 int totemsrp_ring_reenable (
4980 totemsrp_handle handle)
4981 {
4982 @@ -1552,6 +1591,8 @@
4983 unsigned int new_memb_list_totemip[PROCESSOR_COUNT_MAX];
4984 unsigned int left_list[PROCESSOR_COUNT_MAX];
4985
4986 + memb_consensus_reset (instance);
4987 +
4988 old_ring_state_reset (instance);
4989 ring_reset (instance);
4990 deliver_messages_from_recovery_to_regular (instance);
4991 @@ -1637,7 +1678,7 @@
4992 "entering OPERATIONAL state.\n");
4993 instance->memb_state = MEMB_STATE_OPERATIONAL;
4994
4995 - instance->my_received_flg = 0;
4996 + instance->my_received_flg = 1;
4997
4998 return;
4999 }
5000 @@ -1646,8 +1687,6 @@
5001 struct totemsrp_instance *instance,
5002 int gather_from)
5003 {
5004 - instance->my_commit_token_seq = SEQNO_START_TOKEN - 1;
5005 -
5006 memb_set_merge (
5007 &instance->my_id, 1,
5008 instance->my_proc_list, &instance->my_proc_list_entries);
5009 @@ -1711,10 +1750,10 @@
5010
5011 memb_state_commit_token_target_set (instance, commit_token);
5012
5013 + memb_ring_id_set_and_store (instance, &commit_token->ring_id);
5014 +
5015 memb_state_commit_token_send (instance, commit_token);
5016
5017 - memcpy (&instance->my_ring_id, &commit_token->ring_id,
5018 - sizeof (struct memb_ring_id));
5019 instance->token_ring_id_seq = instance->my_ring_id.seq;
5020
5021 poll_timer_delete (instance->totemsrp_poll_handle, instance->memb_timer_state_gather_join_timeout);
5022 @@ -1733,8 +1772,6 @@
5023
5024 instance->memb_state = MEMB_STATE_COMMIT;
5025
5026 - instance->my_commit_token_seq = SEQNO_START_TOKEN - 1;
5027 -
5028 /*
5029 * reset all flow control variables since we are starting a new ring
5030 */
5031 @@ -1779,15 +1816,10 @@
5032 /*
5033 * Build regular configuration
5034 */
5035 - instance->my_new_memb_entries = commit_token->addr_entries;
5036 -
5037 totemrrp_processor_count_set (
5038 instance->totemrrp_handle,
5039 commit_token->addr_entries);
5040
5041 - memcpy (instance->my_new_memb_list, addr,
5042 - sizeof (struct srp_addr) * instance->my_new_memb_entries);
5043 -
5044 /*
5045 * Build transitional configuration
5046 */
5047 @@ -1892,13 +1924,14 @@
5048 // TODO LEAK
5049 message_item.mcast = malloc (sizeof (struct mcast));
5050 assert (message_item.mcast);
5051 - memcpy (message_item.mcast, sort_queue_item->iovec[0].iov_base,
5052 - sizeof (struct mcast));
5053 - memcpy (&message_item.mcast->ring_id, &instance->my_ring_id,
5054 - sizeof (struct memb_ring_id));
5055 - message_item.mcast->header.encapsulated = 1;
5056 + message_item.mcast->header.type = MESSAGE_TYPE_MCAST;
5057 + srp_addr_copy (&message_item.mcast->system_from, &instance->my_id);
5058 + message_item.mcast->header.encapsulated = MESSAGE_ENCAPSULATED;
5059 message_item.mcast->header.nodeid = instance->my_id.addr[0].nodeid;
5060 assert (message_item.mcast->header.nodeid);
5061 + message_item.mcast->header.endian_detector = ENDIAN_LOCAL;
5062 + memcpy (&message_item.mcast->ring_id, &instance->my_ring_id,
5063 + sizeof (struct memb_ring_id));
5064 message_item.iov_len = sort_queue_item->iov_len;
5065 memcpy (&message_item.iovec, &sort_queue_item->iovec,
5066 sizeof (struct iovec) * sort_queue_item->iov_len);
5067 @@ -1926,7 +1959,6 @@
5068
5069 reset_token_timeout (instance); // REVIEWED
5070 reset_token_retransmit_timeout (instance); // REVIEWED
5071 - memb_ring_id_store (instance);
5072
5073 instance->memb_state = MEMB_STATE_RECOVERY;
5074 return;
5075 @@ -1993,7 +2025,7 @@
5076 */
5077 message_item.mcast->header.type = MESSAGE_TYPE_MCAST;
5078 message_item.mcast->header.endian_detector = ENDIAN_LOCAL;
5079 - message_item.mcast->header.encapsulated = 2;
5080 + message_item.mcast->header.encapsulated = MESSAGE_NOT_ENCAPSULATED;
5081 message_item.mcast->header.nodeid = instance->my_id.addr[0].nodeid;
5082 assert (message_item.mcast->header.nodeid);
5083
5084 @@ -2278,13 +2310,13 @@
5085 * Delete item from pending queue
5086 */
5087 queue_item_remove (mcast_queue);
5088 +
5089 + /*
5090 + * If messages mcasted, deliver any new messages to totempg
5091 + */
5092 + instance->my_high_seq_received = token->seq;
5093 }
5094
5095 - /*
5096 - * If messages mcasted, deliver any new messages to totempg
5097 - */
5098 - instance->my_high_seq_received = token->seq;
5099 -
5100 update_aru (instance);
5101
5102 /*
5103 @@ -2564,14 +2596,14 @@
5104 orf_token.token_seq = SEQNO_START_TOKEN;
5105 orf_token.retrans_flg = 1;
5106 instance->my_set_retrans_flg = 1;
5107 -/*
5108 +
5109 if (queue_is_empty (&instance->retrans_message_queue) == 1) {
5110 orf_token.retrans_flg = 0;
5111 + instance->my_set_retrans_flg = 0;
5112 } else {
5113 orf_token.retrans_flg = 1;
5114 instance->my_set_retrans_flg = 1;
5115 }
5116 -*/
5117
5118 orf_token.aru = 0;
5119 orf_token.aru = SEQNO_START_MSG - 1;
5120 @@ -2594,10 +2626,17 @@
5121 {
5122 struct srp_addr *addr;
5123 struct memb_commit_token_memb_entry *memb_list;
5124 + unsigned int high_aru;
5125 + unsigned int i;
5126
5127 addr = (struct srp_addr *)commit_token->end_of_commit_token;
5128 memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries);
5129
5130 + memcpy (instance->my_new_memb_list, addr,
5131 + sizeof (struct srp_addr) * commit_token->addr_entries);
5132 +
5133 + instance->my_new_memb_entries = commit_token->addr_entries;
5134 +
5135 memcpy (&memb_list[commit_token->memb_index].ring_id,
5136 &instance->my_old_ring_id, sizeof (struct memb_ring_id));
5137 assert (!totemip_zero_check(&instance->my_old_ring_id.rep));
5138 @@ -2607,9 +2646,43 @@
5139 * TODO high delivered is really instance->my_aru, but with safe this
5140 * could change?
5141 */
5142 - memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered;
5143 + instance->my_received_flg =
5144 + (instance->my_aru == instance->my_high_seq_received);
5145 +
5146 memb_list[commit_token->memb_index].received_flg = instance->my_received_flg;
5147
5148 + memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered;
5149 + /*
5150 + * find high aru up to current memb_index for all matching ring ids
5151 + * if any ring id matching memb_index has aru less then high aru set
5152 + * received flag for that entry to false
5153 + */
5154 + high_aru = memb_list[commit_token->memb_index].aru;
5155 + for (i = 0; i <= commit_token->memb_index; i++) {
5156 + if (memcmp (&memb_list[commit_token->memb_index].ring_id,
5157 + &memb_list[i].ring_id,
5158 + sizeof (struct memb_ring_id)) == 0) {
5159 +
5160 + if (sq_lt_compare (high_aru, memb_list[i].aru)) {
5161 + high_aru = memb_list[i].aru;
5162 + }
5163 + }
5164 + }
5165 +
5166 + for (i = 0; i <= commit_token->memb_index; i++) {
5167 + if (memcmp (&memb_list[commit_token->memb_index].ring_id,
5168 + &memb_list[i].ring_id,
5169 + sizeof (struct memb_ring_id)) == 0) {
5170 +
5171 + if (sq_lt_compare (memb_list[i].aru, high_aru)) {
5172 + memb_list[i].received_flg = 0;
5173 + if (i == commit_token->memb_index) {
5174 + instance->my_received_flg = 0;
5175 + }
5176 + }
5177 + }
5178 + }
5179 +
5180 commit_token->header.nodeid = instance->my_id.addr[0].nodeid;
5181 commit_token->memb_index += 1;
5182 assert (commit_token->memb_index <= commit_token->addr_entries);
5183 @@ -2773,7 +2846,7 @@
5184 iovs = 2;
5185 } else {
5186 iovs = 3;
5187 - iovec[2].iov_base = &instance->my_failed_list;
5188 + iovec[2].iov_base = instance->my_failed_list;
5189 iovec[2].iov_len = instance->my_failed_list_entries *
5190 sizeof (struct srp_addr);
5191 }
5192 @@ -2846,13 +2919,16 @@
5193 instance->token_ring_id_seq = memb_ring_id->seq;
5194 }
5195
5196 -static void memb_ring_id_store (
5197 - struct totemsrp_instance *instance)
5198 +static void memb_ring_id_set_and_store (
5199 + struct totemsrp_instance *instance,
5200 + struct memb_ring_id *ring_id)
5201 {
5202 char filename[256];
5203 int fd;
5204 int res;
5205
5206 + memcpy (&instance->my_ring_id, ring_id, sizeof (struct memb_ring_id));
5207 +
5208 sprintf (filename, "%s/ringid_%s",
5209 rundir, totemip_print (&instance->my_id.addr[0]));
5210
5211 @@ -3085,7 +3161,6 @@
5212 unsigned int mcasted_retransmit;
5213 unsigned int mcasted_regular;
5214 unsigned int last_aru;
5215 - unsigned int low_water;
5216
5217 #ifdef GIVEINFO
5218 struct timeval tv_current;
5219 @@ -3279,13 +3354,7 @@
5220 * has recovered all messages it can recover
5221 * (ie: its retrans queue is empty)
5222 */
5223 - low_water = instance->my_aru;
5224 - if (sq_lt_compare (last_aru, low_water)) {
5225 - low_water = last_aru;
5226 - }
5227 -// TODO is this code right
5228 - if (queue_is_empty (&instance->retrans_message_queue) == 0 ||
5229 - low_water != instance->my_high_seq_received) {
5230 + if (queue_is_empty (&instance->retrans_message_queue) == 0) {
5231
5232 if (token->retrans_flg == 0) {
5233 token->retrans_flg = 1;
5234 @@ -3296,10 +3365,10 @@
5235 token->retrans_flg = 0;
5236 }
5237 log_printf (instance->totemsrp_log_level_debug,
5238 - "token retrans flag is %d my set retrans flag%d retrans queue empty %d count %d, low_water %x aru %x\n",
5239 + "token retrans flag is %d my set retrans flag%d retrans queue empty %d count %d, aru %x\n",
5240 token->retrans_flg, instance->my_set_retrans_flg,
5241 queue_is_empty (&instance->retrans_message_queue),
5242 - instance->my_retrans_flg_count, low_water, token->aru);
5243 + instance->my_retrans_flg_count, token->aru);
5244 if (token->retrans_flg == 0) {
5245 instance->my_retrans_flg_count += 1;
5246 } else {
5247 @@ -3311,13 +3380,16 @@
5248 log_printf (instance->totemsrp_log_level_debug,
5249 "install seq %x aru %x high seq received %x\n",
5250 instance->my_install_seq, instance->my_aru, instance->my_high_seq_received);
5251 - if (instance->my_retrans_flg_count >= 2 && instance->my_aru >= instance->my_install_seq && instance->my_received_flg == 0) {
5252 + if (instance->my_retrans_flg_count >= 2 &&
5253 + instance->my_received_flg == 0 &&
5254 + sq_lte_compare (instance->my_install_seq, instance->my_aru)) {
5255 instance->my_received_flg = 1;
5256 instance->my_deliver_memb_entries = instance->my_trans_memb_entries;
5257 memcpy (instance->my_deliver_memb_list, instance->my_trans_memb_list,
5258 sizeof (struct totem_ip_address) * instance->my_trans_memb_entries);
5259 }
5260 - if (instance->my_retrans_flg_count >= 3 && token->aru >= instance->my_install_seq) {
5261 + if (instance->my_retrans_flg_count >= 3 &&
5262 + sq_lte_compare (instance->my_install_seq, token->aru)) {
5263 instance->my_rotation_counter += 1;
5264 } else {
5265 instance->my_rotation_counter = 0;
5266 @@ -3386,9 +3458,10 @@
5267 struct sort_queue_item *sort_queue_item_p;
5268 unsigned int i;
5269 int res;
5270 - struct mcast *mcast;
5271 + struct mcast *mcast_in;
5272 + struct mcast mcast_header;
5273 unsigned int range = 0;
5274 - int endian_conversion_required = 0 ;
5275 + int endian_conversion_required;
5276 unsigned int my_high_delivered_stored = 0;
5277
5278
5279 @@ -3436,18 +3509,27 @@
5280
5281 sort_queue_item_p = ptr;
5282
5283 - mcast = sort_queue_item_p->iovec[0].iov_base;
5284 - assert (mcast != (struct mcast *)0xdeadbeef);
5285 + mcast_in = sort_queue_item_p->iovec[0].iov_base;
5286 + assert (mcast_in != (struct mcast *)0xdeadbeef);
5287 +
5288 + endian_conversion_required = 0;
5289 + if (mcast_in->header.endian_detector != ENDIAN_LOCAL) {
5290 + endian_conversion_required = 1;
5291 + mcast_endian_convert (mcast_in, &mcast_header);
5292 + } else {
5293 + memcpy (&mcast_header, mcast_in, sizeof (struct mcast));
5294 + }
5295
5296 /*
5297 * Skip messages not originated in instance->my_deliver_memb
5298 */
5299 if (skip &&
5300 - memb_set_subset (&mcast->system_from,
5301 + memb_set_subset (&mcast_header.system_from,
5302 1,
5303 instance->my_deliver_memb_list,
5304 instance->my_deliver_memb_entries) == 0) {
5305 - instance->my_high_delivered = my_high_delivered_stored + i;
5306 +
5307 + instance->my_high_delivered = my_high_delivered_stored + i;
5308
5309 continue;
5310 }
5311 @@ -3457,12 +3539,7 @@
5312 */
5313 log_printf (instance->totemsrp_log_level_debug,
5314 "Delivering MCAST message with seq %x to pending delivery queue\n",
5315 - mcast->seq);
5316 -
5317 - if (mcast->header.endian_detector != ENDIAN_LOCAL) {
5318 - endian_conversion_required = 1;
5319 - mcast_endian_convert (mcast, mcast);
5320 - }
5321 + mcast_header.seq);
5322
5323 /*
5324 * Message is locally originated multicast
5325 @@ -3470,7 +3547,7 @@
5326 if (sort_queue_item_p->iov_len > 1 &&
5327 sort_queue_item_p->iovec[0].iov_len == sizeof (struct mcast)) {
5328 instance->totemsrp_deliver_fn (
5329 - mcast->header.nodeid,
5330 + mcast_header.header.nodeid,
5331 &sort_queue_item_p->iovec[1],
5332 sort_queue_item_p->iov_len - 1,
5333 endian_conversion_required);
5334 @@ -3479,7 +3556,7 @@
5335 sort_queue_item_p->iovec[0].iov_base += sizeof (struct mcast);
5336
5337 instance->totemsrp_deliver_fn (
5338 - mcast->header.nodeid,
5339 + mcast_header.header.nodeid,
5340 sort_queue_item_p->iovec,
5341 sort_queue_item_p->iov_len,
5342 endian_conversion_required);
5343 @@ -3511,18 +3588,12 @@
5344 memcpy (&mcast_header, msg, sizeof (struct mcast));
5345 }
5346
5347 -/*
5348 - if (mcast_header.header.encapsulated == 1) {
5349 - sort_queue = &instance->recovery_sort_queue;
5350 - } else {
5351 - sort_queue = &instance->regular_sort_queue;
5352 - }
5353 -*/
5354 - if (instance->memb_state == MEMB_STATE_RECOVERY) {
5355 + if (mcast_header.header.encapsulated == MESSAGE_ENCAPSULATED) {
5356 sort_queue = &instance->recovery_sort_queue;
5357 } else {
5358 sort_queue = &instance->regular_sort_queue;
5359 }
5360 +
5361 assert (msg_len < FRAME_SIZE_MAX);
5362
5363 #ifdef TEST_DROP_MCAST_PERCENTAGE
5364 @@ -3849,6 +3920,8 @@
5365 out->header.type = in->header.type;
5366 out->header.endian_detector = ENDIAN_LOCAL;
5367 out->header.nodeid = swab32 (in->header.nodeid);
5368 + out->header.encapsulated = in->header.encapsulated;
5369 +
5370 out->seq = swab32 (in->seq);
5371 out->this_seqno = swab32 (in->this_seqno);
5372 totemip_copy_endian_convert(&out->ring_id.rep, &in->ring_id.rep);
5373 @@ -3961,16 +4034,6 @@
5374 addr = (struct srp_addr *)memb_commit_token->end_of_commit_token;
5375 memb_list = (struct memb_commit_token_memb_entry *)(addr + memb_commit_token->addr_entries);
5376
5377 - if (sq_lte_compare (memb_commit_token->token_seq,
5378 - instance->my_commit_token_seq)) {
5379 - /*
5380 - * discard token
5381 - */
5382 - return (0);
5383 - }
5384 - instance->my_commit_token_seq = memb_commit_token->token_seq;
5385 -
5386 -
5387 #ifdef TEST_DROP_COMMIT_TOKEN_PERCENTAGE
5388 if (random()%100 < TEST_DROP_COMMIT_TOKEN_PERCENTAGE) {
5389 return (0);
5390 @@ -3998,9 +4061,15 @@
5391 break;
5392
5393 case MEMB_STATE_COMMIT:
5394 -// if (memcmp (&memb_commit_token->ring_id, &instance->my_ring_id,
5395 -// sizeof (struct memb_ring_id)) == 0) {
5396 - if (memb_commit_token->ring_id.seq == instance->my_ring_id.seq) {
5397 + /*
5398 + * If retransmitted commit tokens are sent on this ring
5399 + * filter them out and only enter recovery once the
5400 + * commit token has traversed the array. This is
5401 + * determined by :
5402 + * memb_commit_token->memb_index == memb_commit_token->addr_entries) {
5403 + */
5404 + if (memb_commit_token->ring_id.seq == instance->my_ring_id.seq &&
5405 + memb_commit_token->memb_index == memb_commit_token->addr_entries) {
5406 memb_state_recovery_enter (instance, memb_commit_token);
5407 }
5408 break;
5409 @@ -4051,7 +4120,12 @@
5410 log_printf (instance->totemsrp_log_level_security, "Received message is too short... ignoring %d.\n", msg_len);
5411 return;
5412 }
5413 -
5414 +
5415 + if ((int)message_header->type >= totemsrp_message_handlers.count) {
5416 + log_printf (instance->totemsrp_log_level_security, "Type of received message is wrong... ignoring %d.\n", (int)message_header->type);
5417 + return;
5418 + }
5419 +
5420 /*
5421 * Handle incoming message
5422 */
5423 diff -uNr openais-0.80.3/exec/totemsrp.h openais-0.80.3-r1661/exec/totemsrp.h
5424 --- openais-0.80.3/exec/totemsrp.h 2007-06-24 08:33:09.000000000 +0200
5425 +++ openais-0.80.3-r1661/exec/totemsrp.h 2008-11-17 15:54:02.400604305 +0100
5426 @@ -104,6 +104,12 @@
5427 char ***status,
5428 unsigned int *iface_count);
5429
5430 +extern int totemsrp_my_nodeid_get (
5431 + totemsrp_handle handle);
5432 +
5433 +extern int totemsrp_my_family_get (
5434 + totemsrp_handle handle);
5435 +
5436 extern int totemsrp_ring_reenable (
5437 totemsrp_handle handle);
5438
5439 diff -uNr openais-0.80.3/exec/util.c openais-0.80.3-r1661/exec/util.c
5440 --- openais-0.80.3/exec/util.c 2007-06-24 08:33:09.000000000 +0200
5441 +++ openais-0.80.3-r1661/exec/util.c 2008-11-17 15:54:02.380604445 +0100
5442 @@ -84,10 +84,88 @@
5443 return time_now;
5444 }
5445
5446 +struct error_code_entry {
5447 + enum e_ais_done code;
5448 + char *string;
5449 +};
5450 +
5451 +static struct error_code_entry error_code_map[] = {
5452 + {
5453 + .code = AIS_DONE_EXIT,
5454 + .string = "finished, exiting normally"
5455 + },
5456 + {
5457 + .code = AIS_DONE_UID_DETERMINE,
5458 + .string = "could not determine the process UID"
5459 + },
5460 + {
5461 + .code = AIS_DONE_GID_DETERMINE,
5462 + .string = "could not determine the process GID"
5463 + },
5464 + {
5465 + .code = AIS_DONE_MEMPOOL_INIT,
5466 + .string = "could not initialize the memory pools"
5467 + },
5468 + {
5469 + .code = AIS_DONE_FORK,
5470 + .string = "could not fork"
5471 + },
5472 + {
5473 + .code = AIS_DONE_LIBAIS_SOCKET,
5474 + .string = "could not create a socket"
5475 + },
5476 + {
5477 + .code = AIS_DONE_LIBAIS_BIND,
5478 + .string = "could not bind to an address"
5479 + },
5480 + {
5481 + .code = AIS_DONE_READKEY,
5482 + .string = "could not read the security key"
5483 + },
5484 + {
5485 + .code = AIS_DONE_MAINCONFIGREAD,
5486 + .string = "could not read the main configuration file"
5487 + },
5488 + {
5489 + .code = AIS_DONE_LOGSETUP,
5490 + .string = "could not setup the logging system"
5491 + },
5492 + {
5493 + .code = AIS_DONE_AMFCONFIGREAD,
5494 + .string = "could not read the AMF configuration"
5495 + },
5496 + {
5497 + .code = AIS_DONE_DYNAMICLOAD,
5498 + .string = "could not load a dynamic object"
5499 + },
5500 + { .code = AIS_DONE_OBJDB,
5501 + .string = "could not use the object database"
5502 + },
5503 + {
5504 + .code = AIS_DONE_INIT_SERVICES,
5505 + .string = "could not initlalize services"
5506 + },
5507 + {
5508 + .code = AIS_DONE_OUT_OF_MEMORY,
5509 + .string = "Out of memory"
5510 + },
5511 + {
5512 + .code = AIS_DONE_FATAL_ERR,
5513 + .string = "Unknown fatal error"
5514 + },
5515 +};
5516
5517 void openais_exit_error (enum e_ais_done err)
5518 {
5519 - log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting (%d).\n", err);
5520 + char *error_string = "Error code not available";
5521 + int i;
5522 +
5523 + for (i = 0; i < (sizeof (error_code_map) / sizeof (struct error_code_entry)); i++) {
5524 + if (err == error_code_map[i].code) {
5525 + error_string = error_code_map[i].string;
5526 + }
5527 + }
5528 + log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting (reason: %s).\n", error_string);
5529 log_flush();
5530 exit (err);
5531 }
5532 diff -uNr openais-0.80.3/exec/version.h openais-0.80.3-r1661/exec/version.h
5533 --- openais-0.80.3/exec/version.h 2007-06-26 13:36:38.000000000 +0200
5534 +++ openais-0.80.3-r1661/exec/version.h 2008-11-17 15:54:02.380604445 +0100
5535 @@ -1 +1 @@
5536 -#define RELEASE_VERSION "subrev 1358 version 0.80.3"
5537 +#define RELEASE_VERSION "subrev 1152 version 0.80"
5538 diff -uNr openais-0.80.3/exec/vsf_ykd.c openais-0.80.3-r1661/exec/vsf_ykd.c
5539 --- openais-0.80.3/exec/vsf_ykd.c 2007-06-24 08:33:09.000000000 +0200
5540 +++ openais-0.80.3-r1661/exec/vsf_ykd.c 2008-11-17 15:54:02.390605772 +0100
5541 @@ -458,7 +458,7 @@
5542 memcpy (&ykd_ring_id, ring_id, sizeof (struct memb_ring_id));
5543
5544 if (first_run) {
5545 - ykd_state.last_primary.member_list[0] = this_ip->nodeid;
5546 + ykd_state.last_primary.member_list[0] = totempg_my_nodeid_get();
5547 ykd_state.last_primary.member_list_entries = 1;
5548 ykd_state.last_primary.session_id = 0;
5549 first_run = 0;
5550 diff -uNr openais-0.80.3/include/saCkpt.h openais-0.80.3-r1661/include/saCkpt.h
5551 --- openais-0.80.3/include/saCkpt.h 2007-06-24 08:33:09.000000000 +0200
5552 +++ openais-0.80.3-r1661/include/saCkpt.h 2008-11-17 15:54:00.450629028 +0100
5553 @@ -199,7 +199,7 @@
5554 SaCkptCheckpointHandleT checkpointHandle,
5555 SaCkptSectionCreationAttributesT *sectionCreationAttributes,
5556 const void *initialData,
5557 - SaUint32T initialDataSize);
5558 + SaSizeT initialDataSize);
5559
5560
5561 SaAisErrorT
5562 diff -uNr openais-0.80.3/init/redhat openais-0.80.3-r1661/init/redhat
5563 --- openais-0.80.3/init/redhat 2007-06-26 13:38:35.000000000 +0200
5564 +++ openais-0.80.3-r1661/init/redhat 2008-11-17 15:54:02.790606471 +0100
5565 @@ -15,6 +15,7 @@
5566 lockfile="/var/lock/subsys/$prog"
5567
5568 start() {
5569 + [ -x "$exec" ] || exit 5
5570 echo -n $"Starting OpenAIS daemon ($prog): "
5571 daemon $exec
5572 retval=$?
5573 diff -uNr openais-0.80.3/lcr/Makefile openais-0.80.3-r1661/lcr/Makefile
5574 --- openais-0.80.3/lcr/Makefile 2006-04-21 01:17:16.000000000 +0200
5575 +++ openais-0.80.3-r1661/lcr/Makefile 2008-11-17 15:53:59.910615969 +0100
5576 @@ -27,7 +27,7 @@
5577 include ../Makefile.inc
5578
5579 CFLAGS += -I../include
5580 -LDFLAGS += -L./ ${DYFLAGS}
5581 +override LDFLAGS += ${DYFLAGS}
5582
5583 ifeq (${OPENAIS_COMPAT}, LINUX)
5584 LDFLAGS += -ldl
5585 @@ -57,7 +57,7 @@
5586 endif
5587
5588 test: test.o uis.o lcr_ifact.o
5589 - $(CC) $(LDFLAGS) test.o lcr_ifact.o uis.o -lpthread -o test
5590 + $(CC) $(LDFLAGS) -fPIC test.o lcr_ifact.o uis.o -lpthread -o test
5591
5592 test_static: test.o libtest_a.o libtest_b.o uis.o lcr_ifact.o
5593 $(CC) $(LDFLAGS) test.o libtest_a.o libtest_b.o lcr_ifact.o -o test_static
5594 @@ -71,6 +71,12 @@
5595 libtest_b.o: libtest_b.c
5596 $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
5597
5598 +lcr_ifact.o: lcr_ifact.c
5599 + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
5600 +
5601 +test.o: test.c
5602 + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
5603 +
5604 clean:
5605 rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg \
5606 test_static
5607 diff -uNr openais-0.80.3/lcr/lcr_ifact.c openais-0.80.3-r1661/lcr/lcr_ifact.c
5608 --- openais-0.80.3/lcr/lcr_ifact.c 2007-06-24 08:33:09.000000000 +0200
5609 +++ openais-0.80.3-r1661/lcr/lcr_ifact.c 2008-11-17 15:53:59.910615969 +0100
5610 @@ -45,6 +45,7 @@
5611 struct lcr_component_instance {
5612 struct lcr_iface *ifaces;
5613 int iface_count;
5614 + unsigned int comp_handle;
5615 void *dl_handle;
5616 int refcount;
5617 char library_name[256];
5618 @@ -68,7 +69,7 @@
5619 .iterator = 0
5620 };
5621
5622 -static unsigned int g_component_handle;
5623 +static unsigned int g_component_handle = 0xFFFFFFFF;
5624
5625 #ifdef OPENAIS_LINUX
5626 static int lcr_select_so (const struct dirent *dirent)
5627 @@ -170,7 +171,6 @@
5628
5629 res = getcwd (cwd, sizeof (cwd));
5630 if (res != NULL) {
5631 - strcat (cwd, "/");
5632 path_list[0] = strdup (cwd);
5633 path_list_entries++;
5634 }
5635 @@ -291,6 +291,8 @@
5636 }
5637 dl_handle = dlopen (dl_name, RTLD_LAZY);
5638 if (dl_handle == NULL) {
5639 + fprintf (stderr, "LCR error loading plugin: %s\n",
5640 + dlerror());
5641 continue;
5642 }
5643 instance = lcr_comp_find (iface_name, version, iface_number);
5644 @@ -301,8 +303,8 @@
5645 }
5646
5647 /*
5648 - * No matching interfaces found, try next shared object
5649 - */
5650 + * No matching interfaces found, try next shared object
5651 + */
5652 if (g_component_handle != 0xFFFFFFFF) {
5653 hdb_handle_destroy (&lcr_component_instance_database,
5654 g_component_handle);
5655 @@ -349,19 +351,19 @@
5656
5657 // TODO error checking in this code is weak
5658 /*
5659 - * Find all *.lcrso files in search paths
5660 + * Search through all lcrso files for desired interface
5661 */
5662 for (i = 0; i < path_list_entries; i++) {
5663 - res = interface_find_and_load (
5664 - path_list[i],
5665 - iface_name,
5666 - version,
5667 - &instance,
5668 - &iface_number);
5669 + res = interface_find_and_load (
5670 + path_list[i],
5671 + iface_name,
5672 + version,
5673 + &instance,
5674 + &iface_number);
5675
5676 - if (res == 0) {
5677 - goto found;
5678 - }
5679 + if (res == 0) {
5680 + goto found;
5681 + }
5682 }
5683
5684 /*
5685 @@ -379,9 +381,10 @@
5686 iface_handle);
5687 hdb_handle_get (&lcr_iface_instance_database,
5688 *iface_handle, (void *)&iface_instance);
5689 - iface_instance->component_handle = g_component_handle;
5690 + iface_instance->component_handle = instance->comp_handle;
5691 iface_instance->context = context;
5692 iface_instance->destructor = instance->ifaces[iface_number].destructor;
5693 + hdb_handle_put (&lcr_iface_instance_database, *iface_handle);
5694 return (0);
5695 }
5696
5697 @@ -408,17 +411,21 @@
5698 void lcr_component_register (struct lcr_comp *comp)
5699 {
5700 struct lcr_component_instance *instance;
5701 + static unsigned int comp_handle;
5702
5703 hdb_handle_create (&lcr_component_instance_database,
5704 sizeof (struct lcr_component_instance),
5705 - &g_component_handle);
5706 + &comp_handle);
5707 hdb_handle_get (&lcr_component_instance_database,
5708 - g_component_handle, (void *)&instance);
5709 + comp_handle, (void *)&instance);
5710
5711 instance->ifaces = comp->ifaces;
5712 instance->iface_count = comp->iface_count;
5713 + instance->comp_handle = comp_handle;
5714 instance->dl_handle = NULL;
5715
5716 hdb_handle_put (&lcr_component_instance_database,
5717 - g_component_handle);
5718 + comp_handle);
5719 +
5720 + g_component_handle = comp_handle;
5721 }
5722 diff -uNr openais-0.80.3/lcr/test.c openais-0.80.3-r1661/lcr/test.c
5723 --- openais-0.80.3/lcr/test.c 2007-06-24 08:33:09.000000000 +0200
5724 +++ openais-0.80.3-r1661/lcr/test.c 2008-11-17 15:53:59.900633359 +0100
5725 @@ -87,7 +87,7 @@
5726 (void *)0xaaaa1111);
5727 assert (res == 0);
5728
5729 - a_iface_ver1 = (struct iface *)a_iface_ver0_p;
5730 + a_iface_ver1 = (struct iface *)a_iface_ver1_p;
5731
5732 res = lcr_ifact_reference (
5733 &b_ifact_handle_ver1,
5734 @@ -97,7 +97,7 @@
5735 (void *)0xbbbb1111);
5736 assert (res == 0);
5737
5738 - b_iface_ver1 = (struct iface *)b_iface_ver0_p;
5739 + b_iface_ver1 = (struct iface *)b_iface_ver1_p;
5740
5741 a_iface_ver0->func1();
5742 a_iface_ver0->func2();
5743 diff -uNr openais-0.80.3/lib/amf.c openais-0.80.3-r1661/lib/amf.c
5744 --- openais-0.80.3/lib/amf.c 2007-06-24 08:33:09.000000000 +0200
5745 +++ openais-0.80.3-r1661/lib/amf.c 2008-11-17 15:54:03.480606331 +0100
5746 @@ -101,6 +101,10 @@
5747
5748 void amfHandleInstanceDestructor (void *instance)
5749 {
5750 + struct amfInstance *amfInstance = instance;
5751 +
5752 + pthread_mutex_destroy (&amfInstance->response_mutex);
5753 + pthread_mutex_destroy (&amfInstance->dispatch_mutex);
5754 }
5755
5756 SaAisErrorT
5757 diff -uNr openais-0.80.3/lib/cfg.c openais-0.80.3-r1661/lib/cfg.c
5758 --- openais-0.80.3/lib/cfg.c 2007-06-24 08:33:09.000000000 +0200
5759 +++ openais-0.80.3-r1661/lib/cfg.c 2008-11-17 15:54:03.480606331 +0100
5760 @@ -88,6 +88,10 @@
5761 */
5762 void cfg_handleInstanceDestructor (void *instance)
5763 {
5764 + struct cfg_instance *cfg_instance = instance;
5765 +
5766 + pthread_mutex_destroy (&cfg_instance->response_mutex);
5767 + pthread_mutex_destroy (&cfg_instance->dispatch_mutex);
5768 }
5769
5770 SaAisErrorT
5771 diff -uNr openais-0.80.3/lib/ckpt.c openais-0.80.3-r1661/lib/ckpt.c
5772 --- openais-0.80.3/lib/ckpt.c 2007-06-24 08:33:09.000000000 +0200
5773 +++ openais-0.80.3-r1661/lib/ckpt.c 2008-11-17 15:54:03.480606331 +0100
5774 @@ -155,15 +155,24 @@
5775 */
5776 void ckptHandleInstanceDestructor (void *instance)
5777 {
5778 + struct ckptInstance *ckptInstance = instance;
5779 +
5780 + pthread_mutex_destroy (&ckptInstance->response_mutex);
5781 + pthread_mutex_destroy (&ckptInstance->dispatch_mutex);
5782 }
5783
5784 void checkpointHandleInstanceDestructor (void *instance)
5785 {
5786 - return;
5787 + struct ckptCheckpointInstance *checkpointInstance = instance;
5788 +
5789 + pthread_mutex_destroy (&checkpointInstance->response_mutex);
5790 }
5791
5792 void ckptSectionIterationHandleInstanceDestructor (void *instance)
5793 {
5794 + struct ckptSectionIterationInstance *iterationInstance = instance;
5795 +
5796 + pthread_mutex_destroy (&iterationInstance->response_mutex);
5797 }
5798
5799 static void ckptSectionIterationInstanceFinalize (struct ckptSectionIterationInstance *ckptSectionIterationInstance)
5800 @@ -191,8 +200,6 @@
5801
5802 saHandleDestroy (&ckptSectionIterationHandleDatabase,
5803 ckptSectionIterationInstance->sectionIterationHandle);
5804 -
5805 - pthread_mutex_destroy (&ckptSectionIterationInstance->response_mutex);
5806 }
5807
5808 static void ckptCheckpointInstanceFinalize (struct ckptCheckpointInstance *ckptCheckpointInstance)
5809 @@ -216,8 +223,6 @@
5810 list_del (&ckptCheckpointInstance->list);
5811
5812 saHandleDestroy (&checkpointHandleDatabase, ckptCheckpointInstance->checkpointHandle);
5813 -
5814 - pthread_mutex_destroy (&ckptCheckpointInstance->response_mutex);
5815 }
5816
5817 static void ckptInstanceFinalize (struct ckptInstance *ckptInstance)
5818 @@ -1027,7 +1032,7 @@
5819 SaCkptCheckpointHandleT checkpointHandle,
5820 SaCkptSectionCreationAttributesT *sectionCreationAttributes,
5821 const void *initialData,
5822 - SaUint32T initialDataSize)
5823 + SaSizeT initialDataSize)
5824 {
5825 SaAisErrorT error;
5826 struct ckptCheckpointInstance *ckptCheckpointInstance;
5827 diff -uNr openais-0.80.3/lib/clm.c openais-0.80.3-r1661/lib/clm.c
5828 --- openais-0.80.3/lib/clm.c 2007-06-24 08:33:09.000000000 +0200
5829 +++ openais-0.80.3-r1661/lib/clm.c 2008-11-17 15:54:03.490605981 +0100
5830 @@ -92,6 +92,10 @@
5831
5832 void clmHandleInstanceDestructor (void *instance)
5833 {
5834 + struct clmInstance *clmInstance = instance;
5835 +
5836 + pthread_mutex_destroy (&clmInstance->response_mutex);
5837 + pthread_mutex_destroy (&clmInstance->dispatch_mutex);
5838 }
5839
5840
5841 @@ -494,9 +498,6 @@
5842 clmInstance->finalize = 1;
5843
5844 pthread_mutex_unlock (&clmInstance->response_mutex);
5845 - pthread_mutex_destroy (&clmInstance->response_mutex);
5846 -
5847 - pthread_mutex_destroy (&clmInstance->dispatch_mutex);
5848
5849 saHandleDestroy (&clmHandleDatabase, clmHandle);
5850
5851 diff -uNr openais-0.80.3/lib/cpg.c openais-0.80.3-r1661/lib/cpg.c
5852 --- openais-0.80.3/lib/cpg.c 2007-06-25 05:09:31.000000000 +0200
5853 +++ openais-0.80.3-r1661/lib/cpg.c 2008-11-17 15:54:03.490605981 +0100
5854 @@ -1,7 +1,7 @@
5855 /*
5856 * vi: set autoindent tabstop=4 shiftwidth=4 :
5857 *
5858 - * Copyright (c) 2006-2007 Red Hat, Inc.
5859 + * Copyright (c) 2006-2008 Red Hat, Inc.
5860 *
5861 * All rights reserved.
5862 *
5863 @@ -76,6 +76,10 @@
5864 */
5865 static void cpg_instance_destructor (void *instance)
5866 {
5867 + struct cpg_inst *cpg_inst = instance;
5868 +
5869 + pthread_mutex_destroy (&cpg_inst->response_mutex);
5870 + pthread_mutex_destroy (&cpg_inst->dispatch_mutex);
5871 }
5872
5873
5874 @@ -103,8 +107,7 @@
5875 goto error_destroy;
5876 }
5877
5878 - error = saServiceConnect (&cpg_inst->dispatch_fd,
5879 - &cpg_inst->response_fd,
5880 + error = saServiceConnect (&cpg_inst->response_fd, &cpg_inst->dispatch_fd,
5881 CPG_SERVICE);
5882 if (error != SA_AIS_OK) {
5883 goto error_put_destroy;
5884 @@ -153,9 +156,6 @@
5885 cpg_inst->finalize = 1;
5886
5887 pthread_mutex_unlock (&cpg_inst->response_mutex);
5888 - pthread_mutex_destroy (&cpg_inst->response_mutex);
5889 -
5890 - pthread_mutex_destroy (&cpg_inst->dispatch_mutex);
5891
5892 saHandleDestroy (&cpg_handle_t_db, handle);
5893
5894 @@ -457,7 +457,7 @@
5895 iov[0].iov_base = &req_lib_cpg_trackstart;
5896 iov[0].iov_len = sizeof (struct req_lib_cpg_trackstart);
5897
5898 - error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1,
5899 + error = saSendMsgReceiveReply (cpg_inst->response_fd, iov, 1,
5900 &res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart));
5901
5902 if (error != SA_AIS_OK) {
5903 diff -uNr openais-0.80.3/lib/evs.c openais-0.80.3-r1661/lib/evs.c
5904 --- openais-0.80.3/lib/evs.c 2007-06-24 08:33:09.000000000 +0200
5905 +++ openais-0.80.3-r1661/lib/evs.c 2008-11-17 15:54:03.490605981 +0100
5906 @@ -80,6 +80,10 @@
5907 */
5908 static void evs_instance_destructor (void *instance)
5909 {
5910 + struct evs_inst *evs_inst = instance;
5911 +
5912 + pthread_mutex_destroy (&evs_inst->response_mutex);
5913 + pthread_mutex_destroy (&evs_inst->dispatch_mutex);
5914 }
5915
5916
5917 @@ -162,9 +166,6 @@
5918 evs_inst->finalize = 1;
5919
5920 pthread_mutex_unlock (&evs_inst->response_mutex);
5921 - pthread_mutex_destroy (&evs_inst->response_mutex);
5922 -
5923 - pthread_mutex_destroy (&evs_inst->dispatch_mutex);
5924
5925 saHandleDestroy (&evs_handle_t_db, handle);
5926 /*
5927 diff -uNr openais-0.80.3/lib/evt.c openais-0.80.3-r1661/lib/evt.c
5928 --- openais-0.80.3/lib/evt.c 2007-06-24 08:33:09.000000000 +0200
5929 +++ openais-0.80.3-r1661/lib/evt.c 2008-11-17 15:54:03.480606331 +0100
5930 @@ -110,10 +110,12 @@
5931 * ei_version: version sent to the evtInitialize call.
5932 * ei_node_id: our node id.
5933 * ei_node_name: our node name.
5934 - * ei_finalize: instance in finalize flag
5935 - * ei_dispatch_mutex: mutex for dispatch fd
5936 + * ei_dispatch_mutex: mutex for dispatch fd. This lock also ensures that
5937 + * only one thread is using ei_dispatch_data.
5938 * ei_response_mutex: mutex for response fd
5939 * ei_channel_list: list of associated channels (struct handle_list)
5940 + * ei_dispatch_data: event buffer for evtDispatch
5941 + * ei_finalize: instance in finalize flag
5942 * ei_data_available: Indicates that there is a pending event message though
5943 * there may not be a poll event. This can happen
5944 * when we get a SA_AIS_ERR_TRY_AGAIN when asking for an
5945 @@ -127,11 +129,12 @@
5946 SaVersionT ei_version;
5947 SaClmNodeIdT ei_node_id;
5948 SaNameT ei_node_name;
5949 - int ei_finalize;
5950 pthread_mutex_t ei_dispatch_mutex;
5951 pthread_mutex_t ei_response_mutex;
5952 struct list_head ei_channel_list;
5953 - int ei_data_available;
5954 + struct res_overlay ei_dispatch_data;
5955 + unsigned int ei_finalize:1;
5956 + unsigned int ei_data_available:1;
5957 };
5958
5959
5960 @@ -245,6 +248,9 @@
5961 saHandleDestroy(&channel_handle_db, handle);
5962 saHandleInstancePut(&channel_handle_db, handle);
5963 }
5964 +
5965 + pthread_mutex_destroy(&evti->ei_dispatch_mutex);
5966 + pthread_mutex_destroy(&evti->ei_response_mutex);
5967 }
5968
5969 /*
5970 @@ -272,6 +278,7 @@
5971 saEvtEventFree(handle);
5972 }
5973
5974 + pthread_mutex_destroy(&eci->eci_mutex);
5975 }
5976
5977 /*
5978 @@ -296,6 +303,8 @@
5979 if (edi->edi_event_data) {
5980 free(edi->edi_event_data);
5981 }
5982 +
5983 + pthread_mutex_destroy(&edi->edi_mutex);
5984 }
5985
5986 static SaAisErrorT evt_recv_event(int fd, struct lib_event_data **msg)
5987 @@ -599,7 +608,6 @@
5988 int ignore_dispatch = 0;
5989 int cont = 1; /* always continue do loop except when set to 0 */
5990 int poll_fd;
5991 - struct res_overlay dispatch_data;
5992 struct lib_event_data *evt = 0;
5993 struct res_evt_event_data res;
5994
5995 @@ -674,15 +682,15 @@
5996 }
5997
5998 if (ufds.revents & POLLIN) {
5999 - error = saRecvRetry (evti->ei_dispatch_fd, &dispatch_data.header,
6000 + error = saRecvRetry (evti->ei_dispatch_fd, &evti->ei_dispatch_data.header,
6001 sizeof (mar_res_header_t));
6002
6003 if (error != SA_AIS_OK) {
6004 goto dispatch_unlock;
6005 }
6006 - if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
6007 - error = saRecvRetry (evti->ei_dispatch_fd, &dispatch_data.data,
6008 - dispatch_data.header.size - sizeof (mar_res_header_t));
6009 + if (evti->ei_dispatch_data.header.size > sizeof (mar_res_header_t)) {
6010 + error = saRecvRetry (evti->ei_dispatch_fd, &evti->ei_dispatch_data.data,
6011 + evti->ei_dispatch_data.header.size - sizeof (mar_res_header_t));
6012 if (error != SA_AIS_OK) {
6013 goto dispatch_unlock;
6014 }
6015 @@ -697,7 +705,7 @@
6016 * Fake up a header message and the switch statement will
6017 * take care of the rest.
6018 */
6019 - dispatch_data.header.id = MESSAGE_RES_EVT_AVAILABLE;
6020 + evti->ei_dispatch_data.header.id = MESSAGE_RES_EVT_AVAILABLE;
6021 }
6022
6023 /*
6024 @@ -707,13 +715,11 @@
6025 * EvtFinalize has been called in another thread.
6026 */
6027 memcpy(&callbacks, &evti->ei_callback, sizeof(evti->ei_callback));
6028 - pthread_mutex_unlock(&evti->ei_dispatch_mutex);
6029 -
6030
6031 /*
6032 * Dispatch incoming response
6033 */
6034 - switch (dispatch_data.header.id) {
6035 + switch (evti->ei_dispatch_data.header.id) {
6036
6037 case MESSAGE_RES_EVT_AVAILABLE:
6038 evti->ei_data_available = 0;
6039 @@ -782,7 +788,7 @@
6040 case MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK:
6041 {
6042 struct res_evt_open_chan_async *resa =
6043 - (struct res_evt_open_chan_async *)&dispatch_data;
6044 + (struct res_evt_open_chan_async *)&evti->ei_dispatch_data;
6045 struct event_channel_instance *eci;
6046
6047 /*
6048 @@ -815,11 +821,13 @@
6049 break;
6050
6051 default:
6052 - DPRINT (("Dispatch: Bad message type 0x%x\n", dispatch_data.header.id));
6053 + DPRINT (("Dispatch: Bad message type 0x%x\n", evti->ei_dispatch_data.header.id));
6054 error = SA_AIS_ERR_LIBRARY;
6055 - goto dispatch_put;
6056 + goto dispatch_unlock;
6057 }
6058
6059 + pthread_mutex_unlock(&evti->ei_dispatch_mutex);
6060 +
6061 /*
6062 * If empty is zero it means the we got the
6063 * message from the queue and we are responsible
6064 @@ -854,7 +862,7 @@
6065 goto dispatch_put;
6066
6067 dispatch_unlock:
6068 - pthread_mutex_unlock(&evti->ei_dispatch_mutex);
6069 + pthread_mutex_unlock(&evti->ei_dispatch_mutex);
6070 dispatch_put:
6071 saHandleInstancePut(&evt_instance_handle_db, evtHandle);
6072 return error;
6073 @@ -896,9 +904,6 @@
6074 evti->ei_finalize = 1;
6075
6076 pthread_mutex_unlock (&evti->ei_response_mutex);
6077 - pthread_mutex_destroy (&evti->ei_response_mutex);
6078 -
6079 - pthread_mutex_destroy (&evti->ei_dispatch_mutex);
6080
6081 saHandleDestroy(&evt_instance_handle_db, evtHandle);
6082 /*
6083 diff -uNr openais-0.80.3/lib/lck.c openais-0.80.3-r1661/lib/lck.c
6084 --- openais-0.80.3/lib/lck.c 2007-06-24 08:33:09.000000000 +0200
6085 +++ openais-0.80.3-r1661/lib/lck.c 2008-11-17 15:54:03.480606331 +0100
6086 @@ -144,11 +144,14 @@
6087 */
6088 void lckHandleInstanceDestructor (void *instance)
6089 {
6090 + struct lckInstance *lckInstance = instance;
6091 +
6092 + pthread_mutex_destroy (&lckInstance->response_mutex);
6093 + pthread_mutex_destroy (&lckInstance->dispatch_mutex);
6094 }
6095
6096 void lckResourceHandleInstanceDestructor (void *instance)
6097 {
6098 - return;
6099 }
6100
6101 void lckResourceHandleLockIdInstanceDestructor (void *instance)
6102 diff -uNr openais-0.80.3/lib/msg.c openais-0.80.3-r1661/lib/msg.c
6103 --- openais-0.80.3/lib/msg.c 2007-06-24 08:33:09.000000000 +0200
6104 +++ openais-0.80.3-r1661/lib/msg.c 2008-11-17 15:54:03.490605981 +0100
6105 @@ -131,11 +131,14 @@
6106 */
6107 void msgHandleInstanceDestructor (void *instance)
6108 {
6109 + struct msgInstance *msgInstance = instance;
6110 +
6111 + pthread_mutex_destroy (&msgInstance->response_mutex);
6112 + pthread_mutex_destroy (&msgInstance->dispatch_mutex);
6113 }
6114
6115 void queueHandleInstanceDestructor (void *instance)
6116 {
6117 - return;
6118 }
6119
6120 #ifdef COMPILE_OUT
6121 diff -uNr openais-0.80.3/lib/util.c openais-0.80.3-r1661/lib/util.c
6122 --- openais-0.80.3/lib/util.c 2007-06-24 08:33:09.000000000 +0200
6123 +++ openais-0.80.3-r1661/lib/util.c 2008-11-17 15:54:03.490605981 +0100
6124 @@ -543,7 +543,7 @@
6125 handleDatabase->handleCount += 1;
6126 newHandles = (struct saHandle *)realloc (handleDatabase->handles,
6127 sizeof (struct saHandle) * handleDatabase->handleCount);
6128 - if (newHandles == 0) {
6129 + if (newHandles == NULL) {
6130 pthread_mutex_unlock (&handleDatabase->mutex);
6131 return (SA_AIS_ERR_NO_MEMORY);
6132 }
6133 @@ -552,6 +552,8 @@
6134
6135 instance = malloc (instanceSize);
6136 if (instance == 0) {
6137 + free (newHandles);
6138 + pthread_mutex_unlock (&handleDatabase->mutex);
6139 return (SA_AIS_ERR_NO_MEMORY);
6140 }
6141
6142 diff -uNr openais-0.80.3/man/openais.conf.5 openais-0.80.3-r1661/man/openais.conf.5
6143 --- openais-0.80.3/man/openais.conf.5 2007-06-24 08:33:09.000000000 +0200
6144 +++ openais-0.80.3-r1661/man/openais.conf.5 2008-11-17 15:54:04.010616877 +0100
6145 @@ -135,6 +135,17 @@
6146 reserved and should not be used.
6147
6148 .TP
6149 +clear_node_high_bit
6150 +This configuration option is optional and is only relevant when no nodeid is
6151 +specified. Some openais clients require a signed 32 bit nodeid that is greater
6152 +than zero however by default openais uses all 32 bits of the IPv4 address space
6153 +when generating a nodeid. Set this option to yes to force the high bit to be
6154 +zero and therefor ensure the nodeid is a positive signed 32 bit integer.
6155 +
6156 +WARNING: The clusters behavior is undefined if this option is enabled on only
6157 +a subset of the cluster (for example during a rolling upgrade).
6158 +
6159 +.TP
6160 secauth
6161 This specifies that HMAC/SHA1 authentication should be used to authenticate
6162 all messages. It further specifies that all data should be encrypted with the
6163 diff -uNr openais-0.80.3/test/Makefile openais-0.80.3-r1661/test/Makefile
6164 --- openais-0.80.3/test/Makefile 2007-06-25 04:52:58.000000000 +0200
6165 +++ openais-0.80.3-r1661/test/Makefile 2008-11-17 15:53:59.760604514 +0100
6166 @@ -49,7 +49,7 @@
6167
6168 all: testclm testamf1 \
6169 testckpt ckptstress ckptbench \
6170 - ckptbenchth ckpt-rd ckpt-wr testevt testevs \
6171 + ckptbenchth ckpt-rd ckpt-wr ckpt-overload-exit testevt testevs \
6172 evsbench subscription publish evtbench unlink testclm2 testlck \
6173 testmsg testcpg testcpg2 cpgbench openais-cfgtool
6174
6175 @@ -128,6 +128,9 @@
6176 ckpt-wr: ckpt-wr.o sa_error.o $(LIBRARIES)
6177 $(CC) $(LDFLAGS) -o ckpt-wr ckpt-wr.o sa_error.o $(LIBS)
6178
6179 +ckpt-overload-exit: ckpt-overload-exit.o sa_error.o $(LIBRARIES)
6180 + $(CC) $(LDFLAGS) -o ckpt-overload-exit ckpt-overload-exit.o sa_error.o $(LIBS)
6181 +
6182 testclm2: testclm2.o $(LIBRARIES)
6183 $(CC) $(LDFLAGS) -o testclm2 testclm2.o $(LIBS)
6184
6185 diff -uNr openais-0.80.3/test/ckpt-overload-exit.c openais-0.80.3-r1661/test/ckpt-overload-exit.c
6186 --- openais-0.80.3/test/ckpt-overload-exit.c 1970-01-01 01:00:00.000000000 +0100
6187 +++ openais-0.80.3-r1661/test/ckpt-overload-exit.c 2008-11-17 15:53:59.760604514 +0100
6188 @@ -0,0 +1,157 @@
6189 +/*
6190 + * Copyright (c) 2008 Red Hat, Inc.
6191 + *
6192 + * All rights reserved.
6193 + *
6194 + * Author: Steven Dake (sdake@××××××.com)
6195 + *
6196 + * This software licensed under BSD license, the text of which follows:
6197 + *
6198 + * Redistribution and use in source and binary forms, with or without
6199 + * modification, are permitted provided that the following conditions are met:
6200 + *
6201 + * - Redistributions of source code must retain the above copyright notice,
6202 + * this list of conditions and the following disclaimer.
6203 + * - Redistributions in binary form must reproduce the above copyright notice,
6204 + * this list of conditions and the following disclaimer in the documentation
6205 + * and/or other materials provided with the distribution.
6206 + * - Neither the name of the MontaVista Software, Inc. nor the names of its
6207 + * contributors may be used to endorse or promote products derived from this
6208 + * software without specific prior written permission.
6209 + *
6210 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6211 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6212 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
6213 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
6214 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
6215 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
6216 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
6217 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
6218 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
6219 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
6220 + * THE POSSIBILITY OF SUCH DAMAGE.
6221 + */
6222 +/*
6223 + * Overloads the ckpt system with checkpoints (30k checkpoints) and then exits
6224 + * ungracefully. This will cause the entire system to go into overload
6225 + * as it sends out close messages for the 30k open checkpoints.
6226 + */
6227 +
6228 +
6229 +#include <stdio.h>
6230 +#include <stdlib.h>
6231 +#include <string.h>
6232 +#include <errno.h>
6233 +#include <unistd.h>
6234 +#include <sys/types.h>
6235 +#include <sys/socket.h>
6236 +#include <sys/select.h>
6237 +#include <sys/un.h>
6238 +#include <time.h>
6239 +
6240 +#include "saAis.h"
6241 +#include "saCkpt.h"
6242 +#include "sa_error.h"
6243 +
6244 +#define SECONDS_TO_EXPIRE 500
6245 +
6246 +int ckptinv;
6247 +void printSaNameT (SaNameT *name)
6248 +{
6249 + int i;
6250 +
6251 + for (i = 0; i < name->length; i++) {
6252 + printf ("%c", name->value[i]);
6253 + }
6254 +}
6255 +
6256 +SaVersionT version = { 'B', 1, 1 };
6257 +
6258 +SaNameT checkpointName = { 16, "checkpoint-sync\0" };
6259 +
6260 +SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = {
6261 + .creationFlags = SA_CKPT_WR_ALL_REPLICAS,
6262 + .checkpointSize = 250000,
6263 + .retentionDuration = SA_TIME_ONE_SECOND * 60,
6264 + .maxSections = 1,
6265 + .maxSectionSize = 250000,
6266 + .maxSectionIdSize = 10
6267 +};
6268 +
6269 +char readBuffer1[1025];
6270 +
6271 +SaCkptIOVectorElementT ReadVectorElements[] = {
6272 + {
6273 + SA_CKPT_DEFAULT_SECTION_ID,
6274 + readBuffer1,
6275 + sizeof (readBuffer1),
6276 + 0,
6277 + 0
6278 + }
6279 +};
6280 +
6281 +#define DATASIZE 127000
6282 +char data[DATASIZE];
6283 +SaCkptIOVectorElementT WriteVectorElements[] = {
6284 + {
6285 + SA_CKPT_DEFAULT_SECTION_ID,
6286 + data, /*"written data #1, this should extend past end of old section data", */
6287 + DATASIZE, /*sizeof ("data #1, this should extend past end of old section data") + 1, */
6288 + 0, //5,
6289 + 0
6290 + }
6291 +};
6292 +
6293 +SaCkptCallbacksT callbacks = {
6294 + 0,
6295 + 0
6296 +};
6297 +
6298 +#define MAX_DATA_SIZE 100
6299 +
6300 +int main (void) {
6301 + SaCkptHandleT ckptHandle;
6302 + SaCkptCheckpointHandleT checkpointHandle;
6303 + SaAisErrorT error;
6304 + char data[MAX_DATA_SIZE];
6305 + SaCkptIOVectorElementT writeElement;
6306 + SaUint32T erroroneousVectorIndex = 0;
6307 + int i;
6308 +
6309 + error = saCkptInitialize (&ckptHandle, &callbacks, &version);
6310 + printf ("%s: CkptInitialize\n",
6311 + get_test_output (error, SA_AIS_OK));
6312 +
6313 + for (i = 0; i < 30000; i++) {
6314 + checkpointName.length =
6315 + sprintf((char*)checkpointName.value, "ckp%05d",i);
6316 +
6317 + do {
6318 + error = saCkptCheckpointOpen (ckptHandle,
6319 + &checkpointName,
6320 + &checkpointCreationAttributes,
6321 + SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
6322 + 0,
6323 + &checkpointHandle);
6324 + } while (error == SA_AIS_ERR_TRY_AGAIN);
6325 +
6326 + sprintf((char*)&data, "%04d", i);
6327 + writeElement.sectionId = (SaCkptSectionIdT)SA_CKPT_DEFAULT_SECTION_ID;
6328 + writeElement.dataBuffer = data;
6329 + writeElement.dataSize = strlen (data) + 1;
6330 + writeElement.dataOffset = 0;
6331 + writeElement.readSize = 0;
6332 +
6333 + do {
6334 + error = saCkptCheckpointWrite (checkpointHandle,
6335 + &writeElement,
6336 + 1,
6337 + &erroroneousVectorIndex);
6338 +
6339 + } while (error == SA_AIS_ERR_TRY_AGAIN);
6340 +
6341 + }
6342 +
6343 + return (0);
6344 +
6345 +}
6346 diff -uNr openais-0.80.3/test/testckpt.c openais-0.80.3-r1661/test/testckpt.c
6347 --- openais-0.80.3/test/testckpt.c 2007-06-25 10:42:58.000000000 +0200
6348 +++ openais-0.80.3-r1661/test/testckpt.c 2008-11-17 15:53:59.760604514 +0100
6349 @@ -341,7 +341,7 @@
6350 timersub (&tv_end, &tv_start, &tv_elapsed);
6351 printf ("Elapsed Time to expiry is %ld & %ld usec (should be about %d seconds)\n",
6352 tv_elapsed.tv_sec,
6353 - tv_elapsed.tv_usec,
6354 + (long) tv_elapsed.tv_usec,
6355 SECONDS_TO_EXPIRE);
6356
6357 error = saCkptCheckpointRetentionDurationSet (checkpointHandle,
6358
6359
6360
6361 1.1 sys-cluster/openais/files/openais-0.80.3-Makefile-VARS.patch
6362
6363 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-Makefile-VARS.patch?rev=1.1&view=markup
6364 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-cluster/openais/files/openais-0.80.3-Makefile-VARS.patch?rev=1.1&content-type=text/plain
6365
6366 Index: openais-0.80.3-Makefile-VARS.patch
6367 ===================================================================
6368 --- openais-0.80.3/Makefile.orig 2008-11-18 19:38:46.000000000 +0100
6369 +++ openais-0.80.3/Makefile 2008-11-18 19:42:08.000000000 +0100
6370 @@ -29,30 +29,30 @@
6371 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
6372 # THE POSSIBILITY OF SUCH DAMAGE.
6373
6374 -DESTDIR=/usr/local
6375 -SBINDIR=/usr/sbin
6376 -INCLUDEDIR=/usr/include/openais
6377 -INCLUDEDIR_TOTEM=/usr/include/openais/totem
6378 -INCLUDEDIR_LCR=/usr/include/openais/lcr
6379 -INCLUDEDIR_SERVICE=/usr/include/openais/service
6380 -MANDIR=/usr/share/man
6381 +include Makefile.inc
6382 +
6383 +SBINDIR=$(PREFIX)/sbin
6384 +INCLUDEDIR=$(PREFIX)/include/openais
6385 +INCLUDEDIR_TOTEM=$(PREFIX)/include/openais/totem
6386 +INCLUDEDIR_LCR=$(PREFIX)/include/openais/lcr
6387 +INCLUDEDIR_SERVICE=$(PREFIX)/include/openais/service
6388 +MANDIR=$(PREFIX)/share/man
6389 ETCDIR=/etc/ais
6390 -LCRSODIR=/usr/libexec/lcrso
6391 ARCH=$(shell uname -m)
6392
6393 ifeq (,$(findstring 64,$(ARCH)))
6394 -LIBDIR=/usr/lib/openais
6395 +LIBDIR=$(PREFIX)/lib/openais
6396 else
6397 -LIBDIR=/usr/lib64/openais
6398 +LIBDIR=$(PREFIX)/lib64/openais
6399 endif
6400 ifeq (s390,$(ARCH))
6401 -LIBDIR=/usr/lib/openais
6402 +LIBDIR=$(PREFIX)/lib/openais
6403 endif
6404 ifeq (s390x,$(ARCH))
6405 -LIBDIR=/usr/lib64/openais
6406 +LIBDIR=$(PREFIX)/lib64/openais
6407 endif
6408 ifeq (ia64,$(ARCH))
6409 -LIBDIR=/usr/lib/openais
6410 +LIBDIR=$(PREFIX)/lib/openais
6411 endif
6412
6413 all:
6414 @@ -105,29 +105,29 @@
6415 ln -sf libcfg.so.2.0.0 lib/libcfg.so.2
6416 ln -sf libtotem_pg.so.2.0.0 exec/libtotem_pg.so.2
6417
6418 - cp -a lib/libais.so $(DESTDIR)$(LIBDIR)
6419 - cp -a lib/libSaAmf.so $(DESTDIR)$(LIBDIR)
6420 - cp -a lib/libSaClm.so $(DESTDIR)$(LIBDIR)
6421 - cp -a lib/libSaCkpt.so $(DESTDIR)$(LIBDIR)
6422 - cp -a lib/libSaEvt.so $(DESTDIR)$(LIBDIR)
6423 - cp -a lib/libSaLck.so $(DESTDIR)$(LIBDIR)
6424 - cp -a lib/libSaMsg.so $(DESTDIR)$(LIBDIR)
6425 - cp -a lib/libevs.so $(DESTDIR)$(LIBDIR)
6426 - cp -a lib/libcpg.so $(DESTDIR)$(LIBDIR)
6427 - cp -a lib/libcfg.so $(DESTDIR)$(LIBDIR)
6428 - cp -a exec/libtotem_pg.so $(DESTDIR)$(LIBDIR)
6429 -
6430 - cp -a lib/libais.so.2 $(DESTDIR)$(LIBDIR)
6431 - cp -a lib/libSaAmf.so.2 $(DESTDIR)$(LIBDIR)
6432 - cp -a lib/libSaClm.so.2 $(DESTDIR)$(LIBDIR)
6433 - cp -a lib/libSaCkpt.so.2 $(DESTDIR)$(LIBDIR)
6434 - cp -a lib/libSaEvt.so.2 $(DESTDIR)$(LIBDIR)
6435 - cp -a lib/libSaLck.so.2 $(DESTDIR)$(LIBDIR)
6436 - cp -a lib/libSaMsg.so.2 $(DESTDIR)$(LIBDIR)
6437 - cp -a lib/libevs.so.2 $(DESTDIR)$(LIBDIR)
6438 - cp -a lib/libcpg.so.2 $(DESTDIR)$(LIBDIR)
6439 - cp -a lib/libcfg.so.2 $(DESTDIR)$(LIBDIR)
6440 - cp -a exec/libtotem_pg.so.2 $(DESTDIR)$(LIBDIR)
6441 + $(CP) -a lib/libais.so $(DESTDIR)$(LIBDIR)
6442 + $(CP) -a lib/libSaAmf.so $(DESTDIR)$(LIBDIR)
6443 + $(CP) -a lib/libSaClm.so $(DESTDIR)$(LIBDIR)
6444 + $(CP) -a lib/libSaCkpt.so $(DESTDIR)$(LIBDIR)
6445 + $(CP) -a lib/libSaEvt.so $(DESTDIR)$(LIBDIR)
6446 + $(CP) -a lib/libSaLck.so $(DESTDIR)$(LIBDIR)
6447 + $(CP) -a lib/libSaMsg.so $(DESTDIR)$(LIBDIR)
6448 + $(CP) -a lib/libevs.so $(DESTDIR)$(LIBDIR)
6449 + $(CP) -a lib/libcpg.so $(DESTDIR)$(LIBDIR)
6450 + $(CP) -a lib/libcfg.so $(DESTDIR)$(LIBDIR)
6451 + $(CP) -a exec/libtotem_pg.so $(DESTDIR)$(LIBDIR)
6452 +
6453 + $(CP) -a lib/libais.so.2 $(DESTDIR)$(LIBDIR)
6454 + $(CP) -a lib/libSaAmf.so.2 $(DESTDIR)$(LIBDIR)
6455 + $(CP) -a lib/libSaClm.so.2 $(DESTDIR)$(LIBDIR)
6456 + $(CP) -a lib/libSaCkpt.so.2 $(DESTDIR)$(LIBDIR)
6457 + $(CP) -a lib/libSaEvt.so.2 $(DESTDIR)$(LIBDIR)
6458 + $(CP) -a lib/libSaLck.so.2 $(DESTDIR)$(LIBDIR)
6459 + $(CP) -a lib/libSaMsg.so.2 $(DESTDIR)$(LIBDIR)
6460 + $(CP) -a lib/libevs.so.2 $(DESTDIR)$(LIBDIR)
6461 + $(CP) -a lib/libcpg.so.2 $(DESTDIR)$(LIBDIR)
6462 + $(CP) -a lib/libcfg.so.2 $(DESTDIR)$(LIBDIR)
6463 + $(CP) -a exec/libtotem_pg.so.2 $(DESTDIR)$(LIBDIR)
6464
6465 install -m 755 lib/libais.so.2.* $(DESTDIR)$(LIBDIR)
6466 install -m 755 lib/libSaAmf.so.2.* $(DESTDIR)$(LIBDIR)