corosync
exec/cpg.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006-2026 Red Hat, Inc.
3 *
4 * All rights reserved.
5 *
6 * Author: Christine Caulfield (ccaulfie@redhat.com)
7 * Author: Jan Friesse (jfriesse@redhat.com)
8 *
9 * This software licensed under BSD license, the text of which follows:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * - Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * - Neither the name of the MontaVista Software, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33 * THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#include <config.h>
37
38#ifdef HAVE_ALLOCA_H
39#include <alloca.h>
40#endif
41#include <sys/types.h>
42#include <sys/socket.h>
43#include <sys/un.h>
44#include <sys/ioctl.h>
45#include <netinet/in.h>
46#include <sys/uio.h>
47#include <unistd.h>
48#include <fcntl.h>
49#include <stdlib.h>
50#include <stdio.h>
51#include <errno.h>
52#include <time.h>
53#include <assert.h>
54#include <arpa/inet.h>
55#include <sys/mman.h>
56
57#include <qb/qblist.h>
58#include <qb/qbmap.h>
59
60#include <corosync/corotypes.h>
61#include <qb/qbipc_common.h>
62#include <corosync/corodefs.h>
63#include <corosync/logsys.h>
64#include <corosync/coroapi.h>
65
66#include <corosync/cpg.h>
67#include <corosync/ipc_cpg.h>
68
69#ifndef MAP_ANONYMOUS
70#define MAP_ANONYMOUS MAP_ANON
71#endif
72
73#include "service.h"
74
76
77#define GROUP_HASH_SIZE 32
78
88
89/*
90 * state` exec deliver
91 * match group name, pid -> if matched deliver for YES:
92 * XXX indicates impossible state
93 *
94 * join leave mcast
95 * UNJOINED XXX XXX NO
96 * LEAVE_STARTED XXX YES(unjoined_enter) YES
97 * JOIN_STARTED YES(join_started_enter) XXX NO
98 * JOIN_COMPLETED XXX NO YES
99 *
100 * join_started_enter
101 * set JOIN_COMPLETED
102 * add entry to process_info list
103 * unjoined_enter
104 * set UNJOINED
105 * delete entry from process_info list
106 *
107 *
108 * library accept join error codes
109 * UNJOINED YES(CS_OK) set JOIN_STARTED
110 * LEAVE_STARTED NO(CS_ERR_BUSY)
111 * JOIN_STARTED NO(CS_ERR_EXIST)
112 * JOIN_COMPlETED NO(CS_ERR_EXIST)
113 *
114 * library accept leave error codes
115 * UNJOINED NO(CS_ERR_NOT_EXIST)
116 * LEAVE_STARTED NO(CS_ERR_NOT_EXIST)
117 * JOIN_STARTED NO(CS_ERR_BUSY)
118 * JOIN_COMPLETED YES(CS_OK) set LEAVE_STARTED
119 *
120 * library accept mcast
121 * UNJOINED NO(CS_ERR_NOT_EXIST)
122 * LEAVE_STARTED NO(CS_ERR_NOT_EXIST)
123 * JOIN_STARTED YES(CS_OK)
124 * JOIN_COMPLETED YES(CS_OK)
125 */
132
137
138static struct qb_list_head joinlist_messages_head;
139
152
159
161
163
164static unsigned int my_member_list[PROCESSOR_COUNT_MAX];
165
166static unsigned int my_member_list_entries;
167
168static unsigned int my_old_member_list[PROCESSOR_COUNT_MAX];
169
170static unsigned int my_old_member_list_entries = 0;
171
172static struct corosync_api_v1 *api = NULL;
173
174static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST;
175
176static mar_cpg_ring_id_t last_sync_ring_id;
177
179 unsigned int nodeid;
182 struct qb_list_head list; /* on the group_info members list */
183};
185
190
196
197/*
198 * Service Interfaces required by service_message_handler struct
199 */
200static char *cpg_exec_init_fn (struct corosync_api_v1 *);
201
202static int cpg_lib_init_fn (void *conn);
203
204static int cpg_lib_exit_fn (void *conn);
205
206static void message_handler_req_exec_cpg_procjoin (
207 const void *message,
208 unsigned int nodeid);
209
210static void message_handler_req_exec_cpg_procleave (
211 const void *message,
212 unsigned int nodeid);
213
214static void message_handler_req_exec_cpg_joinlist (
215 const void *message,
216 unsigned int nodeid);
217
218static void message_handler_req_exec_cpg_mcast (
219 const void *message,
220 unsigned int nodeid);
221
222static void message_handler_req_exec_cpg_partial_mcast (
223 const void *message,
224 unsigned int nodeid);
225
226static void message_handler_req_exec_cpg_downlist_old (
227 const void *message,
228 unsigned int nodeid);
229
230static void message_handler_req_exec_cpg_downlist (
231 const void *message,
232 unsigned int nodeid);
233
234static void exec_cpg_procjoin_endian_convert (void *msg);
235
236static void exec_cpg_joinlist_endian_convert (void *msg);
237
238static void exec_cpg_mcast_endian_convert (void *msg);
239
240static void exec_cpg_partial_mcast_endian_convert (void *msg);
241
242static void exec_cpg_downlist_endian_convert_old (void *msg);
243
244static void exec_cpg_downlist_endian_convert (void *msg);
245
246static void message_handler_req_lib_cpg_null (void *conn, const void *message);
247
248static void message_handler_req_lib_cpg_join (void *conn, const void *message);
249
250static void message_handler_req_lib_cpg_leave (void *conn, const void *message);
251
252static void message_handler_req_lib_cpg_finalize (void *conn, const void *message);
253
254static void message_handler_req_lib_cpg_mcast (void *conn, const void *message);
255
256static void message_handler_req_lib_cpg_partial_mcast (void *conn, const void *message);
257
258static void message_handler_req_lib_cpg_membership (void *conn,
259 const void *message);
260
261static void message_handler_req_lib_cpg_local_get (void *conn,
262 const void *message);
263
264static void message_handler_req_lib_cpg_iteration_initialize (
265 void *conn,
266 const void *message);
267
268static void message_handler_req_lib_cpg_iteration_next (
269 void *conn,
270 const void *message);
271
272static void message_handler_req_lib_cpg_iteration_finalize (
273 void *conn,
274 const void *message);
275
276static int cpg_node_joinleave_send (unsigned int pid, const mar_cpg_name_t *group_name, int fn, int reason);
277
278static int cpg_exec_send_downlist(void);
279
280static int cpg_exec_send_joinlist(void);
281
282static void downlist_inform_clients (void);
283
284static void joinlist_inform_clients (void);
285
286static void joinlist_messages_delete (void);
287
288static void cpg_sync_init (
289 const unsigned int *trans_list,
290 size_t trans_list_entries,
291 const unsigned int *member_list,
292 size_t member_list_entries,
293 const struct memb_ring_id *ring_id);
294
295static int cpg_sync_process (void);
296
297static void cpg_sync_activate (void);
298
299static void cpg_sync_abort (void);
300
301static void do_proc_join(
302 const mar_cpg_name_t *name,
303 uint32_t pid,
304 unsigned int nodeid,
305 int reason,
307
308static void do_proc_leave(
309 const mar_cpg_name_t *name,
310 uint32_t pid,
311 unsigned int nodeid,
312 int reason);
313
314static int notify_lib_totem_membership (
315 void *conn,
316 int member_list_entries,
317 const unsigned int *member_list);
318
319static char *cpg_print_group_name (
320 const mar_cpg_name_t *group);
321
322/*
323 * Library Handler Definition
324 */
325static struct corosync_lib_handler cpg_lib_engine[] =
326{
327 { /* 0 - MESSAGE_REQ_CPG_JOIN */
328 .lib_handler_fn = message_handler_req_lib_cpg_join,
329 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
330 },
331 { /* 1 - MESSAGE_REQ_CPG_LEAVE */
332 .lib_handler_fn = message_handler_req_lib_cpg_leave,
333 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
334 },
335 { /* 2 - MESSAGE_REQ_CPG_MCAST */
336 .lib_handler_fn = message_handler_req_lib_cpg_mcast,
337 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
338 },
339 { /* 3 - MESSAGE_REQ_CPG_MEMBERSHIP */
340 .lib_handler_fn = message_handler_req_lib_cpg_membership,
342 },
343 { /* 4 - MESSAGE_REQ_CPG_LOCAL_GET */
344 .lib_handler_fn = message_handler_req_lib_cpg_local_get,
346 },
347 { /* 5 - MESSAGE_REQ_CPG_ITERATIONINITIALIZE */
348 .lib_handler_fn = message_handler_req_lib_cpg_iteration_initialize,
350 },
351 { /* 6 - MESSAGE_REQ_CPG_ITERATIONNEXT */
352 .lib_handler_fn = message_handler_req_lib_cpg_iteration_next,
354 },
355 { /* 7 - MESSAGE_REQ_CPG_ITERATIONFINALIZE */
356 .lib_handler_fn = message_handler_req_lib_cpg_iteration_finalize,
358 },
359 { /* 8 - MESSAGE_REQ_CPG_FINALIZE */
360 .lib_handler_fn = message_handler_req_lib_cpg_finalize,
361 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
362 },
363 { /* 9 ZCB handers do nothing now, but we can't remove them from this list */
364 .lib_handler_fn = message_handler_req_lib_cpg_null,
365 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
366 },
367 { /* 10 */
368 .lib_handler_fn = message_handler_req_lib_cpg_null,
369 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
370 },
371 { /* 11 */
372 .lib_handler_fn = message_handler_req_lib_cpg_null,
373 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
374 },
375 { /* 12 */
376 .lib_handler_fn = message_handler_req_lib_cpg_partial_mcast,
377 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
378 },
379
380};
381
382static struct corosync_exec_handler cpg_exec_engine[] =
383{
384 { /* 0 - MESSAGE_REQ_EXEC_CPG_PROCJOIN */
385 .exec_handler_fn = message_handler_req_exec_cpg_procjoin,
386 .exec_endian_convert_fn = exec_cpg_procjoin_endian_convert
387 },
388 { /* 1 - MESSAGE_REQ_EXEC_CPG_PROCLEAVE */
389 .exec_handler_fn = message_handler_req_exec_cpg_procleave,
390 .exec_endian_convert_fn = exec_cpg_procjoin_endian_convert
391 },
392 { /* 2 - MESSAGE_REQ_EXEC_CPG_JOINLIST */
393 .exec_handler_fn = message_handler_req_exec_cpg_joinlist,
394 .exec_endian_convert_fn = exec_cpg_joinlist_endian_convert
395 },
396 { /* 3 - MESSAGE_REQ_EXEC_CPG_MCAST */
397 .exec_handler_fn = message_handler_req_exec_cpg_mcast,
398 .exec_endian_convert_fn = exec_cpg_mcast_endian_convert
399 },
400 { /* 4 - MESSAGE_REQ_EXEC_CPG_DOWNLIST_OLD */
401 .exec_handler_fn = message_handler_req_exec_cpg_downlist_old,
402 .exec_endian_convert_fn = exec_cpg_downlist_endian_convert_old
403 },
404 { /* 5 - MESSAGE_REQ_EXEC_CPG_DOWNLIST */
405 .exec_handler_fn = message_handler_req_exec_cpg_downlist,
406 .exec_endian_convert_fn = exec_cpg_downlist_endian_convert
407 },
408 { /* 6 - MESSAGE_REQ_EXEC_CPG_PARTIAL_MCAST */
409 .exec_handler_fn = message_handler_req_exec_cpg_partial_mcast,
410 .exec_endian_convert_fn = exec_cpg_partial_mcast_endian_convert
411 },
412};
413
415 .name = "corosync cluster closed process group service v1.01",
416 .id = CPG_SERVICE,
417 .priority = 1,
418 .private_data_size = sizeof (struct cpg_pd),
419 .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED,
420 .allow_inquorate = CS_LIB_ALLOW_INQUORATE,
421 .lib_init_fn = cpg_lib_init_fn,
422 .lib_exit_fn = cpg_lib_exit_fn,
423 .lib_engine = cpg_lib_engine,
424 .lib_engine_count = sizeof (cpg_lib_engine) / sizeof (struct corosync_lib_handler),
425 .exec_init_fn = cpg_exec_init_fn,
426 .exec_dump_fn = NULL,
427 .exec_engine = cpg_exec_engine,
428 .exec_engine_count = sizeof (cpg_exec_engine) / sizeof (struct corosync_exec_handler),
429 .sync_init = cpg_sync_init,
430 .sync_process = cpg_sync_process,
431 .sync_activate = cpg_sync_activate,
432 .sync_abort = cpg_sync_abort
433};
434
439
446
455
466
472
481
488
489static struct req_exec_cpg_downlist g_req_exec_cpg_downlist;
490
491/*
492 * Function print group name. It's not reentrant
493 */
494static char *cpg_print_group_name(const mar_cpg_name_t *group)
495{
496 static char res[CPG_MAX_NAME_LENGTH * 4 + 1];
497 int dest_pos = 0;
498 char c;
499 int i;
500
501 for (i = 0; i < group->length; i++) {
502 c = group->value[i];
503
504 if (c >= ' ' && c < 0x7f && c != '\\') {
505 res[dest_pos++] = c;
506 } else {
507 if (c == '\\') {
508 res[dest_pos++] = '\\';
509 res[dest_pos++] = '\\';
510 } else {
511 snprintf(res + dest_pos, sizeof(res) - dest_pos, "\\x%02X", c);
512 dest_pos += 4;
513 }
514 }
515 }
516 res[dest_pos] = 0;
517
518 return (res);
519}
520
521static void cpg_sync_init (
522 const unsigned int *trans_list,
523 size_t trans_list_entries,
524 const unsigned int *member_list,
525 size_t member_list_entries,
526 const struct memb_ring_id *ring_id)
527{
528 int entries;
529 int i, j;
530 int found;
531
532 my_sync_state = CPGSYNC_DOWNLIST;
533
534 memcpy (my_member_list, member_list, member_list_entries *
535 sizeof (unsigned int));
536 my_member_list_entries = member_list_entries;
537
538 last_sync_ring_id.nodeid = ring_id->nodeid;
539 last_sync_ring_id.seq = ring_id->seq;
540
541 entries = 0;
542 /*
543 * Determine list of nodeids for downlist message
544 */
545 for (i = 0; i < my_old_member_list_entries; i++) {
546 found = 0;
547 for (j = 0; j < trans_list_entries; j++) {
548 if (my_old_member_list[i] == trans_list[j]) {
549 found = 1;
550 break;
551 }
552 }
553 if (found == 0) {
554 g_req_exec_cpg_downlist.nodeids[entries++] =
555 my_old_member_list[i];
556 }
557 }
558 g_req_exec_cpg_downlist.left_nodes = entries;
559}
560
561static int cpg_sync_process (void)
562{
563 int res = -1;
564
565 if (my_sync_state == CPGSYNC_DOWNLIST) {
566 res = cpg_exec_send_downlist();
567 if (res == -1) {
568 return (-1);
569 }
570 my_sync_state = CPGSYNC_JOINLIST;
571 }
572 if (my_sync_state == CPGSYNC_JOINLIST) {
573 res = cpg_exec_send_joinlist();
574 }
575 return (res);
576}
577
578static void cpg_sync_activate (void)
579{
580 memcpy (my_old_member_list, my_member_list,
581 my_member_list_entries * sizeof (unsigned int));
582 my_old_member_list_entries = my_member_list_entries;
583
584 downlist_inform_clients ();
585
586 joinlist_inform_clients ();
587
588 joinlist_messages_delete ();
589
590 notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list);
591}
592
593static void cpg_sync_abort (void)
594{
595
596 joinlist_messages_delete ();
597}
598
599static int notify_lib_totem_membership (
600 void *conn,
601 int member_list_entries,
602 const unsigned int *member_list)
603{
604 struct qb_list_head *iter;
605 char *buf;
606 int size;
608
609 size = sizeof(struct res_lib_cpg_totem_confchg_callback) +
610 sizeof(mar_uint32_t) * (member_list_entries);
611 buf = alloca(size);
612 if (!buf)
613 return CS_ERR_LIBRARY;
614
616 res->member_list_entries = member_list_entries;
617 res->header.size = size;
619 res->header.error = CS_OK;
620
621 memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t));
622 memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t));
623
624 if (conn == NULL) {
626 struct cpg_pd *cpg_pd = qb_list_entry (iter, struct cpg_pd, list);
627 api->ipc_dispatch_send (cpg_pd->conn, buf, size);
628 }
629 } else {
630 api->ipc_dispatch_send (conn, buf, size);
631 }
632
633 return CS_OK;
634}
635
636/*
637 * Helper function for notify_lib_joinlist which prepares member_list using
638 * process_info_list with removed left_list items.
639 * member_list_entries - When not NULL it contains number of member_list entries
640 * member_list - When not NULL it is used as pointer to start of preallocated
641 * array of members. Pointer is adjusted to the end of array on
642 * exit.
643 */
644static void notify_lib_joinlist_fill_member_list(
648 int *member_list_entries,
649 mar_cpg_address_t **member_list)
650{
651 struct qb_list_head *iter;
652 int i;
653
654 if (member_list_entries != NULL) {
655 *member_list_entries = 0;
656 }
657
659 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
660
661 if (mar_name_compare (&pi->group, group_name) == 0) {
662 int in_left_list = 0;
663
664 for (i = 0; i < left_list_entries; i++) {
665 if (left_list[i].nodeid == pi->nodeid && left_list[i].pid == pi->pid) {
666 in_left_list = 1;
667 break ;
668 }
669 }
670
671 if (!in_left_list) {
672 if (member_list_entries != NULL) {
673 (*member_list_entries)++;
674 }
675
676 if (member_list != NULL) {
677 (*member_list)->nodeid = pi->nodeid;
678 (*member_list)->pid = pi->pid;
679 (*member_list)->reason = CPG_REASON_UNDEFINED;
680 (*member_list)++;
681 }
682 }
683 }
684 }
685}
686
687static int notify_lib_joinlist(
688 const mar_cpg_name_t *group_name,
693 int id)
694{
695 int size;
696 char *buf;
697 struct qb_list_head *iter;
698 int member_list_entries;
701 int i;
702
703 /*
704 * Find size of member_list (use process_info_list but remove items in left_list)
705 */
706 notify_lib_joinlist_fill_member_list(group_name, left_list_entries, left_list,
707 &member_list_entries, NULL);
708
709 size = sizeof(struct res_lib_cpg_confchg_callback) +
711 buf = alloca(size);
712 if (!buf)
713 return CS_ERR_LIBRARY;
714
716 res->joined_list_entries = joined_list_entries;
717 res->left_list_entries = left_list_entries;
718 res->member_list_entries = member_list_entries;
719 retgi = res->member_list;
720 res->header.size = size;
721 res->header.id = id;
722 res->header.error = CS_OK;
723 memcpy(&res->group_name, group_name, sizeof(mar_cpg_name_t));
724
725 /*
726 * Fill res->memberlist. Use process_info_list but remove items in left_list.
727 */
728 notify_lib_joinlist_fill_member_list(group_name, left_list_entries, left_list,
729 NULL, &retgi);
730
731 /*
732 * Fill res->left_list
733 */
734 if (left_list_entries) {
737 }
738
740 /*
741 * Fill res->joined_list
742 */
745
746 /*
747 * Update cpd_state for all local joined processes in group
748 */
749 for (i = 0; i < joined_list_entries; i++) {
750 if (joined_list[i].nodeid == api->totem_nodeid_get()) {
752 struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list);
753 if (joined_list[i].pid == cpd->pid &&
754 mar_name_compare (&cpd->group_name, group_name) == 0) {
755 cpd->cpd_state = CPD_STATE_JOIN_COMPLETED;
756 }
757 }
758 }
759 }
760 }
761
762 /*
763 * Send notification to all ipc clients joined in group_name
764 */
766 struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list);
767 if (mar_name_compare (&cpd->group_name, group_name) == 0) {
768 if (cpd->cpd_state == CPD_STATE_JOIN_COMPLETED ||
769 cpd->cpd_state == CPD_STATE_LEAVE_STARTED) {
770
771 api->ipc_dispatch_send (cpd->conn, buf, size);
772 cpd->transition_counter++;
773 }
774 }
775 }
776
777 if (left_list_entries) {
778 /*
779 * Zero internal cpd state for all local processes leaving group
780 * (this loop is not strictly needed because left_list always either
781 * contains exactly one process running on local node or more items
782 * but none of them is running on local node)
783 */
784 for (i = 0; i < joined_list_entries; i++) {
785 if (left_list[i].nodeid == api->totem_nodeid_get() &&
788 struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list);
789 if (left_list[i].pid == cpd->pid &&
790 mar_name_compare (&cpd->group_name, group_name) == 0) {
791 cpd->pid = 0;
792 memset (&cpd->group_name, 0, sizeof(cpd->group_name));
793 cpd->cpd_state = CPD_STATE_UNJOINED;
794 }
795 }
796 }
797 }
798 }
799
800 /*
801 * Traverse thru cpds and send totem membership for cpd, where it is not send yet
802 */
804 struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list);
805
806 if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) {
807 cpd->initial_totem_conf_sent = 1;
808
809 notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list);
810 }
811 }
812
813 return CS_OK;
814}
815
816static void downlist_log(const char *msg, struct req_exec_cpg_downlist *dl)
817{
819 "%s: members(old:%d left:%d)",
820 msg,
821 dl->old_members,
822 dl->left_nodes);
823}
824
825static void downlist_inform_clients (void)
826{
827 struct qb_list_head *iter, *tmp_iter;
828 struct process_info *left_pi;
830 struct cpg_name cpg_group;
831 mar_cpg_name_t group;
832 struct confchg_data{
833 struct cpg_name cpg_group;
836 struct qb_list_head list;
837 } *pcd;
839 int i, size;
840
841 downlist_log("my downlist", &g_req_exec_cpg_downlist);
842
844
845 /*
846 * only the cpg groups included in left nodes should receive
847 * confchg event, so we will collect these cpg groups and
848 * relative left_lists here.
849 */
852
853 left_pi = NULL;
854 for (i = 0; i < g_req_exec_cpg_downlist.left_nodes; i++) {
855
856 if (pi->nodeid == g_req_exec_cpg_downlist.nodeids[i]) {
857 left_pi = pi;
858 break;
859 }
860 }
861
862 if (left_pi) {
863 marshall_from_mar_cpg_name_t(&cpg_group, &left_pi->group);
864 cpg_group.value[cpg_group.length] = 0;
865
866 pcd = (struct confchg_data *)qb_map_get(group_map, cpg_group.value);
867 if (pcd == NULL) {
868 pcd = (struct confchg_data *)calloc(1, sizeof(struct confchg_data));
869 memcpy(&pcd->cpg_group, &cpg_group, sizeof(struct cpg_name));
870 qb_map_put(group_map, pcd->cpg_group.value, pcd);
871 }
872 size = pcd->left_list_entries;
873 pcd->left_list[size].nodeid = left_pi->nodeid;
874 pcd->left_list[size].pid = left_pi->pid;
875 pcd->left_list[size].reason = CONFCHG_CPG_REASON_NODEDOWN;
876 pcd->left_list_entries++;
877 qb_list_del (&left_pi->list);
878 free (left_pi);
879 }
880 }
881
882 /* send only one confchg event per cpg group */
884 while (qb_map_iter_next(miter, (void **)&pcd)) {
885 marshall_to_mar_cpg_name_t(&group, &pcd->cpg_group);
886
887 log_printf (LOG_DEBUG, "left_list_entries:%d", pcd->left_list_entries);
888 for (i=0; i<pcd->left_list_entries; i++) {
889 log_printf (LOG_DEBUG, "left_list[%d] group:%s, ip:%s, pid:%d",
890 i, cpg_print_group_name(&group),
891 (char*)api->totem_ifaces_print(pcd->left_list[i].nodeid),
892 pcd->left_list[i].pid);
893 }
894
895 /* send confchg event */
896 notify_lib_joinlist(&group,
897 0, NULL,
898 pcd->left_list_entries,
899 pcd->left_list,
901
902 free(pcd);
903 }
906}
907
908/*
909 * Remove processes that might have left the group while we were suspended.
910 */
911static void joinlist_remove_zombie_pi_entries (void)
912{
913 struct qb_list_head *pi_iter, *tmp_iter;
914 struct qb_list_head *jl_iter;
915 struct process_info *pi;
916 struct joinlist_msg *stored_msg;
917 int found;
918
921
922 /*
923 * Ignore local node
924 */
925 if (pi->nodeid == api->totem_nodeid_get()) {
926 continue ;
927 }
928
929 /*
930 * Try to find message in joinlist messages
931 */
932 found = 0;
933 qb_list_for_each(jl_iter, &joinlist_messages_head) {
935
936 if (stored_msg->sender_nodeid == api->totem_nodeid_get()) {
937 continue ;
938 }
939
940 if (pi->nodeid == stored_msg->sender_nodeid &&
941 pi->pid == stored_msg->pid &&
942 mar_name_compare (&pi->group, &stored_msg->group_name) == 0) {
943 found = 1;
944 break ;
945 }
946 }
947
948 if (!found) {
949 do_proc_leave(&pi->group, pi->pid, pi->nodeid, CONFCHG_CPG_REASON_PROCDOWN);
950 }
951 }
952}
953
954static void joinlist_inform_clients (void)
955{
956 struct joinlist_msg *stored_msg;
957 struct qb_list_head *iter;
958 unsigned int i;
962
964
965 i = 0;
966 qb_list_for_each(iter, &joinlist_messages_head) {
967 stored_msg = qb_list_entry(iter, struct joinlist_msg, list);
968
969 log_printf (LOG_DEBUG, "joinlist_messages[%u] group:%s, ip:%s, pid:%d",
970 i++, cpg_print_group_name(&stored_msg->group_name),
971 (char*)api->totem_ifaces_print(stored_msg->sender_nodeid),
972 stored_msg->pid);
973
974 /* Ignore our own messages */
975 if (stored_msg->sender_nodeid == api->totem_nodeid_get()) {
976 continue ;
977 }
978
979 do_proc_join (&stored_msg->group_name, stored_msg->pid, stored_msg->sender_nodeid,
981 }
982
984 while (qb_map_iter_next(miter, (void **)&jld)) {
985 notify_lib_joinlist(&jld->cpg_group,
986 jld->join_list_entries, jld->join_list,
987 0, NULL,
989 free(jld);
990 }
993
994 joinlist_remove_zombie_pi_entries ();
995}
996
997static void joinlist_messages_delete (void)
998{
999 struct joinlist_msg *stored_msg;
1000 struct qb_list_head *iter, *tmp_iter;
1001
1002 qb_list_for_each_safe(iter, tmp_iter, &joinlist_messages_head) {
1003 stored_msg = qb_list_entry(iter, struct joinlist_msg, list);
1004 qb_list_del (&stored_msg->list);
1005 free (stored_msg);
1006 }
1007 qb_list_init (&joinlist_messages_head);
1008}
1009
1010static char *cpg_exec_init_fn (struct corosync_api_v1 *corosync_api)
1011{
1012 qb_list_init (&joinlist_messages_head);
1013 api = corosync_api;
1014 return (NULL);
1015}
1016
1017static void cpg_iteration_instance_finalize (struct cpg_iteration_instance *cpg_iteration_instance)
1018{
1019 struct qb_list_head *iter, *tmp_iter;
1020 struct process_info *pi;
1021
1023 pi = qb_list_entry (iter, struct process_info, list);
1024 qb_list_del (&pi->list);
1025 free (pi);
1026 }
1027
1030}
1031
1032static void cpg_pd_finalize (struct cpg_pd *cpd)
1033{
1034 struct qb_list_head *iter, *tmp_iter;
1036
1037 qb_list_for_each_safe(iter, tmp_iter, &(cpd->iteration_instance_list_head)) {
1039
1040 cpg_iteration_instance_finalize (cpii);
1041 }
1042
1043 qb_list_del (&cpd->list);
1044}
1045
1046static int cpg_lib_exit_fn (void *conn)
1047{
1048 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1049
1050 log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p", conn);
1051
1052 if (cpd->group_name.length > 0 && cpd->cpd_state != CPD_STATE_LEAVE_STARTED) {
1053 cpg_node_joinleave_send (cpd->pid, &cpd->group_name,
1055 }
1056
1057 cpg_pd_finalize (cpd);
1058
1059 api->ipc_refcnt_dec (conn);
1060 return (0);
1061}
1062
1063static int cpg_node_joinleave_send (unsigned int pid, const mar_cpg_name_t *group_name, int fn, int reason)
1064{
1067 int result;
1068
1070
1071 memcpy(&req_exec_cpg_procjoin.group_name, group_name, sizeof(mar_cpg_name_t));
1072 req_exec_cpg_procjoin.pid = pid;
1073 req_exec_cpg_procjoin.reason = reason;
1074
1075 req_exec_cpg_procjoin.header.size = sizeof(req_exec_cpg_procjoin);
1077
1078 req_exec_cpg_iovec.iov_base = (char *)&req_exec_cpg_procjoin;
1079 req_exec_cpg_iovec.iov_len = sizeof(req_exec_cpg_procjoin);
1080
1082
1083 return (result);
1084}
1085
1086/* Can byteswap join & leave messages */
1087static void exec_cpg_procjoin_endian_convert (void *msg)
1088{
1090
1092 swab_mar_cpg_name_t (&req_exec_cpg_procjoin->group_name);
1094}
1095
1096static void exec_cpg_joinlist_endian_convert (void *msg_v)
1097{
1098 char *msg = msg_v;
1099 struct qb_ipc_response_header *res = (struct qb_ipc_response_header *)msg;
1100 struct join_list_entry *jle = (struct join_list_entry *)(msg + sizeof(struct qb_ipc_response_header));
1101
1102 swab_mar_int32_t (&res->size);
1103
1104 while ((const char*)jle < msg + res->size) {
1105 jle->pid = swab32(jle->pid);
1106 swab_mar_cpg_name_t (&jle->group_name);
1107 jle++;
1108 }
1109}
1110
1111static void exec_cpg_downlist_endian_convert_old (void *msg)
1112{
1113}
1114
1115static void exec_cpg_downlist_endian_convert (void *msg)
1116{
1118 unsigned int i;
1119
1120 req_exec_cpg_downlist->left_nodes = swab32(req_exec_cpg_downlist->left_nodes);
1121 req_exec_cpg_downlist->old_members = swab32(req_exec_cpg_downlist->old_members);
1122
1123 for (i = 0; i < req_exec_cpg_downlist->left_nodes; i++) {
1124 req_exec_cpg_downlist->nodeids[i] = swab32(req_exec_cpg_downlist->nodeids[i]);
1125 }
1126}
1127
1128
1129static void exec_cpg_mcast_endian_convert (void *msg)
1130{
1132
1133 swab_coroipc_request_header_t (&req_exec_cpg_mcast->header);
1134 swab_mar_cpg_name_t (&req_exec_cpg_mcast->group_name);
1136 req_exec_cpg_mcast->msglen = swab32(req_exec_cpg_mcast->msglen);
1137 swab_mar_message_source_t (&req_exec_cpg_mcast->source);
1138}
1139
1140static void exec_cpg_partial_mcast_endian_convert (void *msg)
1141{
1143
1144 swab_coroipc_request_header_t (&req_exec_cpg_mcast->header);
1145 swab_mar_cpg_name_t (&req_exec_cpg_mcast->group_name);
1147 req_exec_cpg_mcast->msglen = swab32(req_exec_cpg_mcast->msglen);
1148 req_exec_cpg_mcast->fraglen = swab32(req_exec_cpg_mcast->fraglen);
1150 swab_mar_message_source_t (&req_exec_cpg_mcast->source);
1151}
1152
1153static struct process_info *process_info_find(const mar_cpg_name_t *group_name, uint32_t pid, unsigned int nodeid) {
1154 struct qb_list_head *iter;
1155
1157 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1158
1159 if (pi->pid == pid && pi->nodeid == nodeid &&
1160 mar_name_compare (&pi->group, group_name) == 0) {
1161 return pi;
1162 }
1163 }
1164
1165 return NULL;
1166}
1167
1168static void do_proc_join(
1169 const mar_cpg_name_t *name,
1170 uint32_t pid,
1171 unsigned int nodeid,
1172 int reason,
1174{
1175 struct process_info *pi;
1176 struct process_info *pi_entry;
1178 struct qb_list_head *list;
1179 struct qb_list_head *list_to_add = NULL;
1180 int size;
1181
1182 if (process_info_find (name, pid, nodeid) != NULL) {
1183 return ;
1184 }
1185 pi = malloc (sizeof (struct process_info));
1186 if (!pi) {
1187 log_printf(LOGSYS_LEVEL_WARNING, "Unable to allocate process_info struct");
1188 return;
1189 }
1190 pi->nodeid = nodeid;
1191 pi->pid = pid;
1192 memcpy(&pi->group, name, sizeof(*name));
1193 qb_list_init(&pi->list);
1194
1195 /*
1196 * Insert new process in sorted order so synchronization works properly
1197 */
1200 pi_entry = qb_list_entry(list, struct process_info, list);
1201 if (pi_entry->nodeid > pi->nodeid ||
1202 (pi_entry->nodeid == pi->nodeid && pi_entry->pid > pi->pid)) {
1203
1204 break;
1205 }
1206 list_to_add = list;
1207 }
1208 qb_list_add (&pi->list, list_to_add);
1209
1210 notify_info.pid = pi->pid;
1211 notify_info.nodeid = nodeid;
1212 notify_info.reason = reason;
1213
1214 if (group_notify_map == NULL) {
1215 notify_lib_joinlist(&pi->group,
1216 1, &notify_info,
1217 0, NULL,
1219 } else {
1220 struct join_list_confchg_data *jld = qb_map_get(group_notify_map, pi->group.value);
1221 if (jld == NULL) {
1222 jld = (struct join_list_confchg_data *)calloc(1, sizeof(struct join_list_confchg_data));
1223 memcpy(&jld->cpg_group, &pi->group, sizeof(mar_cpg_name_t));
1224 qb_map_put(group_notify_map, jld->cpg_group.value, jld);
1225 }
1226 size = jld->join_list_entries;
1227 jld->join_list[size].nodeid = notify_info.nodeid;
1228 jld->join_list[size].pid = notify_info.pid;
1229 jld->join_list[size].reason = notify_info.reason;
1230 jld->join_list_entries++;
1231 }
1232}
1233
1234static void do_proc_leave(
1235 const mar_cpg_name_t *name,
1236 uint32_t pid,
1237 unsigned int nodeid,
1238 int reason)
1239{
1240 struct process_info *pi;
1241 struct qb_list_head *iter, *tmp_iter;
1243
1244 notify_info.pid = pid;
1245 notify_info.nodeid = nodeid;
1246 notify_info.reason = reason;
1247
1248 notify_lib_joinlist(name,
1249 0, NULL,
1250 1, &notify_info,
1252
1254 pi = qb_list_entry(iter, struct process_info, list);
1255
1256 if (pi->pid == pid && pi->nodeid == nodeid &&
1257 mar_name_compare (&pi->group, name)==0) {
1258 qb_list_del (&pi->list);
1259 free (pi);
1260 }
1261 }
1262}
1263
1264static void message_handler_req_exec_cpg_downlist_old (
1265 const void *message,
1266 unsigned int nodeid)
1267{
1268 log_printf (LOGSYS_LEVEL_DEBUG, "downlist OLD from node " CS_PRI_NODE_ID,
1269 nodeid);
1270}
1271
1272static void message_handler_req_exec_cpg_downlist(
1273 const void *message,
1274 unsigned int nodeid)
1275{
1277
1278 log_printf (LOGSYS_LEVEL_DEBUG, "downlist left_list: %d received",
1279 req_exec_cpg_downlist->left_nodes);
1280}
1281
1282
1283static void message_handler_req_exec_cpg_procjoin (
1284 const void *message,
1285 unsigned int nodeid)
1286{
1288
1289 log_printf(LOGSYS_LEVEL_DEBUG, "got procjoin message from cluster node " CS_PRI_NODE_ID " (%s) for pid %u",
1290 nodeid,
1292 (unsigned int)req_exec_cpg_procjoin->pid);
1293
1294 do_proc_join (&req_exec_cpg_procjoin->group_name,
1297}
1298
1299static void message_handler_req_exec_cpg_procleave (
1300 const void *message,
1301 unsigned int nodeid)
1302{
1304
1305 log_printf(LOGSYS_LEVEL_DEBUG, "got procleave message from cluster node " CS_PRI_NODE_ID " (%s) for pid %u",
1306 nodeid,
1308 (unsigned int)req_exec_cpg_procjoin->pid);
1309
1310 do_proc_leave (&req_exec_cpg_procjoin->group_name,
1312 req_exec_cpg_procjoin->reason);
1313}
1314
1315
1316/* Got a proclist from another node */
1317static void message_handler_req_exec_cpg_joinlist (
1318 const void *message_v,
1319 unsigned int nodeid)
1320{
1321 const char *message = message_v;
1322 const struct qb_ipc_response_header *res = (const struct qb_ipc_response_header *)message;
1323 const struct join_list_entry *jle = (const struct join_list_entry *)(message + sizeof(struct qb_ipc_response_header));
1324 struct joinlist_msg *stored_msg;
1325
1326 log_printf(LOGSYS_LEVEL_DEBUG, "got joinlist message from node " CS_PRI_NODE_ID,
1327 nodeid);
1328
1329 while ((const char*)jle < message + res->size) {
1330 stored_msg = malloc (sizeof (struct joinlist_msg));
1331 memset(stored_msg, 0, sizeof (struct joinlist_msg));
1332 stored_msg->sender_nodeid = nodeid;
1333 stored_msg->pid = jle->pid;
1334 memcpy(&stored_msg->group_name, &jle->group_name, sizeof(mar_cpg_name_t));
1335 qb_list_init (&stored_msg->list);
1336 qb_list_add (&stored_msg->list, &joinlist_messages_head);
1337 jle++;
1338 }
1339}
1340
1341static void message_handler_req_exec_cpg_mcast (
1342 const void *message,
1343 unsigned int nodeid)
1344{
1347 int msglen = req_exec_cpg_mcast->msglen;
1348 struct qb_list_head *iter, *pi_iter, *tmp_iter;
1349 struct cpg_pd *cpd;
1350 struct iovec iovec[2];
1351 int known_node = 0;
1352
1354 res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast) + msglen;
1355 res_lib_cpg_mcast.msglen = msglen;
1357 res_lib_cpg_mcast.nodeid = nodeid;
1358
1359 memcpy(&res_lib_cpg_mcast.group_name, &req_exec_cpg_mcast->group_name,
1360 sizeof(mar_cpg_name_t));
1361 iovec[0].iov_base = (void *)&res_lib_cpg_mcast;
1362 iovec[0].iov_len = sizeof (res_lib_cpg_mcast);
1363
1364 iovec[1].iov_base = (char*)message+sizeof(*req_exec_cpg_mcast);
1365 iovec[1].iov_len = msglen;
1366
1368 cpd = qb_list_entry(iter, struct cpg_pd, list);
1369 if ((cpd->cpd_state == CPD_STATE_LEAVE_STARTED || cpd->cpd_state == CPD_STATE_JOIN_COMPLETED)
1370 && (mar_name_compare (&cpd->group_name, &req_exec_cpg_mcast->group_name) == 0)) {
1371
1372 if (!known_node) {
1373 /* Try to find, if we know the node */
1376
1377 if (pi->nodeid == nodeid &&
1378 mar_name_compare (&pi->group, &req_exec_cpg_mcast->group_name) == 0) {
1379 known_node = 1;
1380 break;
1381 }
1382 }
1383 }
1384
1385 if (!known_node) {
1386 log_printf(LOGSYS_LEVEL_WARNING, "Unknown node -> we will not deliver message");
1387 return ;
1388 }
1389
1390 api->ipc_dispatch_iov_send (cpd->conn, iovec, 2);
1391 }
1392 }
1393}
1394
1395static void message_handler_req_exec_cpg_partial_mcast (
1396 const void *message,
1397 unsigned int nodeid)
1398{
1401 int msglen = req_exec_cpg_mcast->fraglen;
1402 struct qb_list_head *iter, *pi_iter, *tmp_iter;
1403 struct cpg_pd *cpd;
1404 struct iovec iovec[2];
1405 int known_node = 0;
1406
1407 log_printf(LOGSYS_LEVEL_DEBUG, "Got fragmented message from node " CS_PRI_NODE_ID ", size = %d bytes\n", nodeid, msglen);
1408
1410 res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast) + msglen;
1411 res_lib_cpg_mcast.fraglen = msglen;
1412 res_lib_cpg_mcast.msglen = req_exec_cpg_mcast->msglen;
1415 res_lib_cpg_mcast.nodeid = nodeid;
1416
1417 memcpy(&res_lib_cpg_mcast.group_name, &req_exec_cpg_mcast->group_name,
1418 sizeof(mar_cpg_name_t));
1419 iovec[0].iov_base = (void *)&res_lib_cpg_mcast;
1420 iovec[0].iov_len = sizeof (res_lib_cpg_mcast);
1421
1422 iovec[1].iov_base = (char*)message+sizeof(*req_exec_cpg_mcast);
1423 iovec[1].iov_len = msglen;
1424
1426 cpd = qb_list_entry(iter, struct cpg_pd, list);
1427
1428 if ((cpd->cpd_state == CPD_STATE_LEAVE_STARTED || cpd->cpd_state == CPD_STATE_JOIN_COMPLETED)
1429 && (mar_name_compare (&cpd->group_name, &req_exec_cpg_mcast->group_name) == 0)) {
1430
1431 if (!known_node) {
1432 /* Try to find, if we know the node */
1435
1436 if (pi->nodeid == nodeid &&
1437 mar_name_compare (&pi->group, &req_exec_cpg_mcast->group_name) == 0) {
1438 known_node = 1;
1439 break;
1440 }
1441 }
1442 }
1443
1444 if (!known_node) {
1445 log_printf(LOGSYS_LEVEL_WARNING, "Unknown node -> we will not deliver message");
1446 return ;
1447 }
1448
1449 api->ipc_dispatch_iov_send (cpd->conn, iovec, 2);
1450 }
1451 }
1452}
1453
1454
1455static int cpg_exec_send_downlist(void)
1456{
1457 struct iovec iov;
1458
1459 g_req_exec_cpg_downlist.header.id = SERVICE_ID_MAKE(CPG_SERVICE, MESSAGE_REQ_EXEC_CPG_DOWNLIST);
1460 g_req_exec_cpg_downlist.header.size = sizeof(struct req_exec_cpg_downlist);
1461
1462 g_req_exec_cpg_downlist.old_members = my_old_member_list_entries;
1463
1464 iov.iov_base = (void *)&g_req_exec_cpg_downlist;
1465 iov.iov_len = g_req_exec_cpg_downlist.header.size;
1466
1467 return (api->totem_mcast (&iov, 1, TOTEM_AGREED));
1468}
1469
1470static int cpg_exec_send_joinlist(void)
1471{
1472 int count = 0;
1473 struct qb_list_head *iter;
1475 char *buf;
1476 size_t buf_size;
1477 struct join_list_entry *jle;
1479
1481 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1482
1483 if (pi->nodeid == api->totem_nodeid_get ()) {
1484 count++;
1485 }
1486 }
1487
1488 /* Nothing to send */
1489 if (!count)
1490 return 0;
1491
1492 buf_size = sizeof(struct qb_ipc_response_header) + sizeof(struct join_list_entry) * count;
1493 buf = alloca(buf_size);
1494 if (!buf) {
1495 log_printf(LOGSYS_LEVEL_WARNING, "Unable to allocate joinlist buffer");
1496 return -1;
1497 }
1498 memset(buf, 0, buf_size);
1499
1500 jle = (struct join_list_entry *)(buf + sizeof(struct qb_ipc_response_header));
1501 res = (struct qb_ipc_response_header *)buf;
1502
1504 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1505
1506 if (pi->nodeid == api->totem_nodeid_get ()) {
1507 memcpy (&jle->group_name, &pi->group, sizeof (mar_cpg_name_t));
1508 jle->pid = pi->pid;
1509 jle++;
1510 }
1511 }
1512
1514 res->size = sizeof(struct qb_ipc_response_header)+sizeof(struct join_list_entry) * count;
1515
1516 req_exec_cpg_iovec.iov_base = buf;
1517 req_exec_cpg_iovec.iov_len = res->size;
1518
1519 return (api->totem_mcast (&req_exec_cpg_iovec, 1, TOTEM_AGREED));
1520}
1521
1522static int cpg_lib_init_fn (void *conn)
1523{
1524 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1525 memset (cpd, 0, sizeof(struct cpg_pd));
1526 cpd->conn = conn;
1527 qb_list_add (&cpd->list, &cpg_pd_list_head);
1528
1529 qb_list_init (&cpd->iteration_instance_list_head);
1530
1531 api->ipc_refcnt_inc (conn);
1532 log_printf(LOGSYS_LEVEL_DEBUG, "lib_init_fn: conn=%p, cpd=%p", conn, cpd);
1533 return (0);
1534}
1535
1536
1537/* NULL message so old zcb clients don't crash us */
1538static void message_handler_req_lib_cpg_null (void *conn, const void *message)
1539{
1541
1542 res_lib_cpg_null.header.size = sizeof(res_lib_cpg_null);
1546}
1547
1548/* Join message from the library */
1549static void message_handler_req_lib_cpg_join (void *conn, const void *message)
1550{
1552 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1555 struct qb_list_head *iter;
1556
1557 /* Test, if we don't have same pid and group name joined */
1559 struct cpg_pd *cpd_item = qb_list_entry (iter, struct cpg_pd, list);
1560
1561 if (cpd_item->pid == req_lib_cpg_join->pid &&
1562 mar_name_compare(&req_lib_cpg_join->group_name, &cpd_item->group_name) == 0) {
1563
1564 /* We have same pid and group name joined -> return error */
1566 goto response_send;
1567 }
1568 }
1569
1570 /*
1571 * Same check must be done in process info list, because there may be not yet delivered
1572 * leave of client.
1573 */
1575 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1576
1577 if (pi->nodeid == api->totem_nodeid_get () && pi->pid == req_lib_cpg_join->pid &&
1578 mar_name_compare(&req_lib_cpg_join->group_name, &pi->group) == 0) {
1579 /* We have same pid and group name joined -> return error */
1581 goto response_send;
1582 }
1583 }
1584
1585 if (req_lib_cpg_join->group_name.length > CPG_MAX_NAME_LENGTH) {
1587 goto response_send;
1588 }
1589
1590 switch (cpd->cpd_state) {
1591 case CPD_STATE_UNJOINED:
1592 error = CS_OK;
1593 cpd->cpd_state = CPD_STATE_JOIN_STARTED;
1594 cpd->pid = req_lib_cpg_join->pid;
1595 cpd->flags = req_lib_cpg_join->flags;
1596 memcpy (&cpd->group_name, &req_lib_cpg_join->group_name,
1597 sizeof (cpd->group_name));
1598
1599 cpg_node_joinleave_send (req_lib_cpg_join->pid,
1600 &req_lib_cpg_join->group_name,
1602 break;
1605 break;
1608 break;
1611 break;
1612 }
1613
1615 res_lib_cpg_join.header.size = sizeof(res_lib_cpg_join);
1617 res_lib_cpg_join.header.error = error;
1619}
1620
1621/* Leave message from the library */
1622static void message_handler_req_lib_cpg_leave (void *conn, const void *message)
1623{
1627 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1628
1629 log_printf(LOGSYS_LEVEL_DEBUG, "got leave request on %p", conn);
1630
1631 switch (cpd->cpd_state) {
1632 case CPD_STATE_UNJOINED:
1634 break;
1637 break;
1640 break;
1642 error = CS_OK;
1643 cpd->cpd_state = CPD_STATE_LEAVE_STARTED;
1644 cpg_node_joinleave_send (req_lib_cpg_leave->pid,
1645 &req_lib_cpg_leave->group_name,
1648 break;
1649 }
1650
1651 /* send return */
1652 res_lib_cpg_leave.header.size = sizeof(res_lib_cpg_leave);
1654 res_lib_cpg_leave.header.error = error;
1656}
1657
1658/* Finalize message from library */
1659static void message_handler_req_lib_cpg_finalize (
1660 void *conn,
1661 const void *message)
1662{
1663 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1666
1667 log_printf (LOGSYS_LEVEL_DEBUG, "cpg finalize for conn=%p", conn);
1668
1669 /*
1670 * We will just remove cpd from list. After this call, connection will be
1671 * closed on lib side, and cpg_lib_exit_fn will be called
1672 */
1673 qb_list_del (&cpd->list);
1674 qb_list_init (&cpd->list);
1675
1676 res_lib_cpg_finalize.header.size = sizeof (res_lib_cpg_finalize);
1678 res_lib_cpg_finalize.header.error = error;
1679
1681 sizeof (res_lib_cpg_finalize));
1682}
1683
1684
1685/* Fragmented mcast message from the library */
1686static void message_handler_req_lib_cpg_partial_mcast (void *conn, const void *message)
1687{
1689 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1690 mar_cpg_name_t group_name = cpd->group_name;
1691
1692 struct iovec req_exec_cpg_iovec[2];
1695 int msglen = req_lib_cpg_mcast->fraglen;
1696 int result;
1698
1699 log_printf(LOGSYS_LEVEL_TRACE, "got fragmented mcast request on %p", conn);
1700 log_printf(LOGSYS_LEVEL_DEBUG, "Sending fragmented message size = %d bytes\n", msglen);
1701
1702 switch (cpd->cpd_state) {
1703 case CPD_STATE_UNJOINED:
1705 break;
1708 break;
1710 error = CS_OK;
1711 break;
1713 error = CS_OK;
1714 break;
1715 }
1716
1719
1721 cpd->initial_transition_counter = cpd->transition_counter;
1722 }
1723 if (cpd->transition_counter != cpd->initial_transition_counter) {
1725 }
1726
1727 if (error == CS_OK) {
1728 req_exec_cpg_mcast.header.size = sizeof(req_exec_cpg_mcast) + msglen;
1731 req_exec_cpg_mcast.pid = cpd->pid;
1732 req_exec_cpg_mcast.msglen = req_lib_cpg_mcast->msglen;
1734 req_exec_cpg_mcast.fraglen = req_lib_cpg_mcast->fraglen;
1735 api->ipc_source_set (&req_exec_cpg_mcast.source, conn);
1736 memcpy(&req_exec_cpg_mcast.group_name, &group_name,
1737 sizeof(mar_cpg_name_t));
1738
1739 req_exec_cpg_iovec[0].iov_base = (char *)&req_exec_cpg_mcast;
1740 req_exec_cpg_iovec[0].iov_len = sizeof(req_exec_cpg_mcast);
1741 req_exec_cpg_iovec[1].iov_base = (char *)&req_lib_cpg_mcast->message;
1742 req_exec_cpg_iovec[1].iov_len = msglen;
1743
1745 assert(result == 0);
1746 } else {
1747 log_printf(LOGSYS_LEVEL_ERROR, "*** %p can't mcast to group %s state:%d, error:%d",
1748 conn, group_name.value, cpd->cpd_state, error);
1749 }
1750
1751 res_lib_cpg_partial_send.header.error = error;
1753 sizeof (res_lib_cpg_partial_send));
1754}
1755
1756/* Mcast message from the library */
1757static void message_handler_req_lib_cpg_mcast (void *conn, const void *message)
1758{
1760 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1761 mar_cpg_name_t group_name = cpd->group_name;
1762
1763 struct iovec req_exec_cpg_iovec[2];
1765 int msglen = req_lib_cpg_mcast->msglen;
1766 int result;
1768
1769 log_printf(LOGSYS_LEVEL_TRACE, "got mcast request on %p", conn);
1770
1771 switch (cpd->cpd_state) {
1772 case CPD_STATE_UNJOINED:
1774 break;
1777 break;
1779 error = CS_OK;
1780 break;
1782 error = CS_OK;
1783 break;
1784 }
1785
1786 if (error == CS_OK) {
1788
1789 req_exec_cpg_mcast.header.size = sizeof(req_exec_cpg_mcast) + msglen;
1792 req_exec_cpg_mcast.pid = cpd->pid;
1793 req_exec_cpg_mcast.msglen = msglen;
1794 api->ipc_source_set (&req_exec_cpg_mcast.source, conn);
1795 memcpy(&req_exec_cpg_mcast.group_name, &group_name,
1796 sizeof(mar_cpg_name_t));
1797
1798 req_exec_cpg_iovec[0].iov_base = (char *)&req_exec_cpg_mcast;
1799 req_exec_cpg_iovec[0].iov_len = sizeof(req_exec_cpg_mcast);
1800 req_exec_cpg_iovec[1].iov_base = (char *)&req_lib_cpg_mcast->message;
1801 req_exec_cpg_iovec[1].iov_len = msglen;
1802
1804 assert(result == 0);
1805 } else {
1806 log_printf(LOGSYS_LEVEL_ERROR, "*** %p can't mcast to group %s state:%d, error:%d",
1807 conn, group_name.value, cpd->cpd_state, error);
1808 }
1809}
1810
1811static void message_handler_req_lib_cpg_membership (void *conn,
1812 const void *message)
1813{
1817 struct qb_list_head *iter;
1818 int member_count = 0;
1819
1821 res_lib_cpg_membership_get.header.error = CS_OK;
1822 res_lib_cpg_membership_get.header.size =
1823 sizeof (struct res_lib_cpg_membership_get);
1824
1826 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1827 if (mar_name_compare (&pi->group, &req_lib_cpg_membership_get->group_name) == 0) {
1828 res_lib_cpg_membership_get.member_list[member_count].nodeid = pi->nodeid;
1829 res_lib_cpg_membership_get.member_list[member_count].pid = pi->pid;
1830 member_count += 1;
1831 }
1832 }
1833 res_lib_cpg_membership_get.member_count = member_count;
1834
1837}
1838
1839static void message_handler_req_lib_cpg_local_get (void *conn,
1840 const void *message)
1841{
1843
1844 res_lib_cpg_local_get.header.size = sizeof (res_lib_cpg_local_get);
1846 res_lib_cpg_local_get.header.error = CS_OK;
1847 res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get ();
1848
1850 sizeof (res_lib_cpg_local_get));
1851}
1852
1853static void message_handler_req_lib_cpg_iteration_initialize (
1854 void *conn,
1855 const void *message)
1856{
1858 struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
1859 hdb_handle_t cpg_iteration_handle = 0;
1861 struct qb_list_head *iter, *iter2;
1864 int res;
1865
1866 log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration initialize");
1867
1868 /* Because between calling this function and *next can be some operations which will
1869 * change list, we must do full copy.
1870 */
1871
1872 /*
1873 * Create new iteration instance
1874 */
1875 res = hdb_handle_create (&cpg_iteration_handle_t_db, sizeof (struct cpg_iteration_instance),
1876 &cpg_iteration_handle);
1877
1878 if (res != 0) {
1880 goto response_send;
1881 }
1882
1883 res = hdb_handle_get (&cpg_iteration_handle_t_db, cpg_iteration_handle, (void *)&cpg_iteration_instance);
1884
1885 if (res != 0) {
1887 goto error_destroy;
1888 }
1889
1891 cpg_iteration_instance->handle = cpg_iteration_handle;
1892
1893 /*
1894 * Create copy of process_info list "grouped by" group name
1895 */
1897 struct process_info *pi = qb_list_entry (iter, struct process_info, list);
1898 struct process_info *new_pi;
1899
1901 /*
1902 * Try to find processed group name in our list new list
1903 */
1904 int found = 0;
1905
1907 struct process_info *pi2 = qb_list_entry (iter2, struct process_info, list);
1908
1909 if (mar_name_compare (&pi2->group, &pi->group) == 0) {
1910 found = 1;
1911 break;
1912 }
1913 }
1914
1915 if (found) {
1916 /*
1917 * We have this name in list -> don't add
1918 */
1919 continue ;
1920 }
1921 } else if (req_lib_cpg_iterationinitialize->iteration_type == CPG_ITERATION_ONE_GROUP) {
1922 /*
1923 * Test pi group name with request
1924 */
1925 if (mar_name_compare (&pi->group, &req_lib_cpg_iterationinitialize->group_name) != 0)
1926 /*
1927 * Not same -> don't add
1928 */
1929 continue ;
1930 }
1931
1932 new_pi = malloc (sizeof (struct process_info));
1933 if (!new_pi) {
1934 log_printf(LOGSYS_LEVEL_WARNING, "Unable to allocate process_info struct");
1935
1937
1938 goto error_put_destroy;
1939 }
1940
1941 memcpy (new_pi, pi, sizeof (struct process_info));
1942 qb_list_init (&new_pi->list);
1943
1945 /*
1946 * pid and nodeid -> undefined
1947 */
1948 new_pi->pid = new_pi->nodeid = 0;
1949 }
1950
1951 /*
1952 * We will return list "grouped" by "group name", so try to find right place to add
1953 */
1955 struct process_info *pi2 = qb_list_entry (iter2, struct process_info, list);
1956
1957 if (mar_name_compare (&pi2->group, &pi->group) == 0) {
1958 break;
1959 }
1960 }
1961
1962 qb_list_add (&new_pi->list, iter2);
1963 }
1964
1965 /*
1966 * Now we have a full "grouped by" copy of process_info list
1967 */
1968
1969 /*
1970 * Add instance to current cpd list
1971 */
1973 qb_list_add (&cpg_iteration_instance->list, &cpd->iteration_instance_list_head);
1974
1976
1978 hdb_handle_put (&cpg_iteration_handle_t_db, cpg_iteration_handle);
1980 if (error != CS_OK) {
1981 hdb_handle_destroy (&cpg_iteration_handle_t_db, cpg_iteration_handle);
1982 }
1983
1988 res_lib_cpg_iterationinitialize.iteration_handle = cpg_iteration_handle;
1989
1992}
1993
1994static void message_handler_req_lib_cpg_iteration_next (
1995 void *conn,
1996 const void *message)
1997{
2002 int res;
2003 struct process_info *pi;
2004
2005 log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration next");
2006
2007 res = hdb_handle_get (&cpg_iteration_handle_t_db,
2008 req_lib_cpg_iterationnext->iteration_handle,
2009 (void *)&cpg_iteration_instance);
2010
2011 if (res != 0) {
2013 goto error_exit;
2014 }
2015
2017
2019
2022 goto error_put;
2023 }
2024
2026
2027 /*
2028 * Copy iteration data
2029 */
2030 res_lib_cpg_iterationnext.description.nodeid = pi->nodeid;
2031 res_lib_cpg_iterationnext.description.pid = pi->pid;
2032 memcpy (&res_lib_cpg_iterationnext.description.group,
2033 &pi->group,
2035
2036error_put:
2037 hdb_handle_put (&cpg_iteration_handle_t_db, req_lib_cpg_iterationnext->iteration_handle);
2041 res_lib_cpg_iterationnext.header.error = error;
2042
2044 sizeof (res_lib_cpg_iterationnext));
2045}
2046
2047static void message_handler_req_lib_cpg_iteration_finalize (
2048 void *conn,
2049 const void *message)
2050{
2055 int res;
2056
2057 log_printf (LOGSYS_LEVEL_DEBUG, "cpg iteration finalize");
2058
2059 res = hdb_handle_get (&cpg_iteration_handle_t_db,
2060 req_lib_cpg_iterationfinalize->iteration_handle,
2061 (void *)&cpg_iteration_instance);
2062
2063 if (res != 0) {
2065 goto error_exit;
2066 }
2067
2069
2070 cpg_iteration_instance_finalize (cpg_iteration_instance);
2072
2076 res_lib_cpg_iterationfinalize.header.error = error;
2077
2080}
#define SERVICE_ID_MAKE(a, b)
Definition coroapi.h:458
@ CS_LIB_ALLOW_INQUORATE
Definition coroapi.h:164
unsigned int nodeid
the ID of the node whose info needs updating
Definition coroapi.h:0
@ CS_LIB_FLOW_CONTROL_REQUIRED
Definition coroapi.h:152
@ CS_LIB_FLOW_CONTROL_NOT_REQUIRED
Definition coroapi.h:153
#define TOTEM_AGREED
Definition coroapi.h:102
#define PROCESSOR_COUNT_MAX
Definition coroapi.h:96
@ CPG_SERVICE
Definition corodefs.h:46
#define CS_PRI_NODE_ID
Definition corotypes.h:59
cs_error_t
The cs_error_t enum.
Definition corotypes.h:98
@ CS_ERR_NO_SECTIONS
Definition corotypes.h:125
@ CS_ERR_NAME_TOO_LONG
Definition corotypes.h:111
@ CS_ERR_NO_MEMORY
Definition corotypes.h:106
@ CS_ERR_BUSY
Definition corotypes.h:108
@ CS_ERR_BAD_HANDLE
Definition corotypes.h:107
@ CS_ERR_TRY_AGAIN
Definition corotypes.h:104
@ CS_OK
Definition corotypes.h:99
@ CS_ERR_LIBRARY
Definition corotypes.h:100
@ CS_ERR_INTERRUPT
Definition corotypes.h:114
@ CS_ERR_NOT_EXIST
Definition corotypes.h:110
@ CS_ERR_EXIST
Definition corotypes.h:112
@ CS_ERR_NOT_SUPPORTED
Definition corotypes.h:117
struct corosync_service_engine cpg_service_engine
Definition exec/cpg.c:414
QB_LIST_DECLARE(cpg_pd_list_head)
cpg_message_req_types
Definition exec/cpg.c:79
@ MESSAGE_REQ_EXEC_CPG_JOINLIST
Definition exec/cpg.c:82
@ MESSAGE_REQ_EXEC_CPG_PARTIAL_MCAST
Definition exec/cpg.c:86
@ MESSAGE_REQ_EXEC_CPG_PROCLEAVE
Definition exec/cpg.c:81
@ MESSAGE_REQ_EXEC_CPG_DOWNLIST_OLD
Definition exec/cpg.c:84
@ MESSAGE_REQ_EXEC_CPG_MCAST
Definition exec/cpg.c:83
@ MESSAGE_REQ_EXEC_CPG_PROCJOIN
Definition exec/cpg.c:80
@ MESSAGE_REQ_EXEC_CPG_DOWNLIST
Definition exec/cpg.c:85
cpd_state
Definition exec/cpg.c:126
@ CPD_STATE_JOIN_STARTED
Definition exec/cpg.c:129
@ CPD_STATE_LEAVE_STARTED
Definition exec/cpg.c:128
@ CPD_STATE_UNJOINED
Definition exec/cpg.c:127
@ CPD_STATE_JOIN_COMPLETED
Definition exec/cpg.c:130
struct corosync_service_engine * cpg_get_service_engine_ver0(void)
Definition exec/cpg.c:435
cpg_sync_state
Definition exec/cpg.c:133
@ CPGSYNC_DOWNLIST
Definition exec/cpg.c:134
@ CPGSYNC_JOINLIST
Definition exec/cpg.c:135
#define CPG_MAX_NAME_LENGTH
Definition cpg.h:117
#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF
Definition cpg.h:194
#define CPG_MEMBERS_MAX
Definition cpg.h:126
@ CPG_ITERATION_ONE_GROUP
Definition cpg.h:97
@ CPG_ITERATION_NAME_ONLY
Definition cpg.h:96
@ CPG_REASON_UNDEFINED
Definition cpg.h:84
#define DECLARE_HDB_DATABASE
Definition hdb.h:98
qb_handle_t hdb_handle_t
Definition hdb.h:52
@ LIBCPG_PARTIAL_FIRST
Definition ipc_cpg.h:102
@ MESSAGE_RES_CPG_NULL
Definition ipc_cpg.h:80
@ MESSAGE_RES_CPG_ITERATIONFINALIZE
Definition ipc_cpg.h:77
@ MESSAGE_RES_CPG_MEMBERSHIP
Definition ipc_cpg.h:69
@ MESSAGE_RES_CPG_LEAVE
Definition ipc_cpg.h:67
@ MESSAGE_RES_CPG_PARTIAL_DELIVER_CALLBACK
Definition ipc_cpg.h:83
@ MESSAGE_RES_CPG_FINALIZE
Definition ipc_cpg.h:78
@ MESSAGE_RES_CPG_DELIVER_CALLBACK
Definition ipc_cpg.h:71
@ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK
Definition ipc_cpg.h:79
@ MESSAGE_RES_CPG_ITERATIONNEXT
Definition ipc_cpg.h:76
@ MESSAGE_RES_CPG_CONFCHG_CALLBACK
Definition ipc_cpg.h:70
@ MESSAGE_RES_CPG_PARTIAL_SEND
Definition ipc_cpg.h:84
@ MESSAGE_RES_CPG_ITERATIONINITIALIZE
Definition ipc_cpg.h:75
@ MESSAGE_RES_CPG_LOCAL_GET
Definition ipc_cpg.h:73
@ MESSAGE_RES_CPG_JOIN
Definition ipc_cpg.h:66
@ CONFCHG_CPG_REASON_LEAVE
Definition ipc_cpg.h:92
@ CONFCHG_CPG_REASON_PROCDOWN
Definition ipc_cpg.h:95
@ CONFCHG_CPG_REASON_NODEUP
Definition ipc_cpg.h:94
@ CONFCHG_CPG_REASON_JOIN
Definition ipc_cpg.h:91
@ CONFCHG_CPG_REASON_NODEDOWN
Definition ipc_cpg.h:93
#define LOGSYS_LEVEL_ERROR
Definition logsys.h:72
#define log_printf(level, format, args...)
Definition logsys.h:332
#define LOGSYS_DECLARE_SUBSYS(subsys)
The LOGSYS_DECLARE_SUBSYS macro.
Definition logsys.h:306
#define LOGSYS_LEVEL_WARNING
Definition logsys.h:73
#define LOGSYS_LEVEL_DEBUG
Definition logsys.h:76
#define LOGSYS_LEVEL_TRACE
Definition logsys.h:77
uint32_t mar_uint32_t
Definition mar_gen.h:53
uint8_t mar_uint8_t
Definition mar_gen.h:51
The corosync_api_v1 struct.
Definition coroapi.h:225
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
Definition coroapi.h:279
void *(* ipc_private_data_get)(void *conn)
Definition coroapi.h:256
unsigned int(* totem_nodeid_get)(void)
Definition coroapi.h:275
const char *(* totem_ifaces_print)(unsigned int nodeid)
Definition coroapi.h:290
void(* ipc_refcnt_dec)(void *conn)
Definition coroapi.h:270
void(* ipc_source_set)(mar_message_source_t *source, void *conn)
Definition coroapi.h:252
void(* ipc_refcnt_inc)(void *conn)
Definition coroapi.h:268
int(* ipc_dispatch_send)(void *conn, const void *msg, size_t mlen)
Definition coroapi.h:263
int(* ipc_response_send)(void *conn, const void *msg, size_t mlen)
Definition coroapi.h:258
int(* ipc_dispatch_iov_send)(void *conn, const struct iovec *iov, unsigned int iov_len)
Definition coroapi.h:265
The corosync_exec_handler struct.
Definition coroapi.h:475
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
Definition coroapi.h:476
The corosync_lib_handler struct.
Definition coroapi.h:467
void(* lib_handler_fn)(void *conn, const void *msg)
Definition coroapi.h:468
The corosync_service_engine struct.
Definition coroapi.h:490
const char * name
Definition coroapi.h:491
hdb_handle_t handle
Definition exec/cpg.c:154
struct qb_list_head list
Definition exec/cpg.c:155
struct qb_list_head items_list_head
Definition exec/cpg.c:156
struct qb_list_head * current_pointer
Definition exec/cpg.c:157
The cpg_name struct.
Definition cpg.h:121
enum cpd_state cpd_state
Definition exec/cpg.c:144
uint32_t pid
Definition exec/cpg.c:143
uint64_t transition_counter
Definition exec/cpg.c:147
int initial_totem_conf_sent
Definition exec/cpg.c:146
mar_cpg_name_t group_name
Definition exec/cpg.c:142
struct qb_list_head iteration_instance_list_head
Definition exec/cpg.c:150
uint64_t initial_transition_counter
Definition exec/cpg.c:148
struct qb_list_head list
Definition exec/cpg.c:149
void * conn
Definition exec/cpg.c:141
unsigned int flags
Definition exec/cpg.c:145
mar_cpg_address_t join_list[CPG_MEMBERS_MAX]
Definition exec/cpg.c:193
mar_cpg_name_t cpg_group
Definition exec/cpg.c:192
Definition exec/cpg.c:186
uint32_t pid
Definition exec/cpg.c:187
mar_cpg_name_t group_name
Definition exec/cpg.c:188
mar_uint32_t sender_nodeid
Definition exec/cpg.c:483
uint32_t pid
Definition exec/cpg.c:484
struct qb_list_head list
Definition exec/cpg.c:486
mar_cpg_name_t group_name
Definition exec/cpg.c:485
mar_cpg_address_t struct
Definition ipc_cpg.h:153
mar_cpg_name_t struct
Definition ipc_cpg.h:110
mar_cpg_ring_id_t struct
Definition ipc_cpg.h:228
The mar_message_source_t struct.
Definition coroapi.h:50
The memb_ring_id struct.
Definition coroapi.h:122
unsigned long long seq
Definition coroapi.h:124
unsigned int nodeid
Definition coroapi.h:123
struct qb_list_head list
Definition exec/cpg.c:182
uint32_t pid
Definition exec/cpg.c:180
mar_cpg_name_t group
Definition exec/cpg.c:181
unsigned int nodeid
Definition exec/cpg.c:179
mar_uint32_t nodeids[PROCESSOR_COUNT_MAX] __attribute__((aligned(8)))
mar_uint32_t left_nodes __attribute__((aligned(8)))
mar_uint32_t old_members __attribute__((aligned(8)))
mar_uint32_t left_nodes __attribute__((aligned(8)))
mar_uint32_t nodeids[PROCESSOR_COUNT_MAX] __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint32_t msglen __attribute__((aligned(8)))
mar_message_source_t source __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
mar_uint32_t type __attribute__((aligned(8)))
mar_message_source_t source __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
mar_uint32_t msglen __attribute__((aligned(8)))
mar_uint32_t fraglen __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint32_t reason __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
The req_lib_cpg_iterationfinalize struct.
Definition ipc_cpg.h:462
The req_lib_cpg_iterationinitialize struct.
Definition ipc_cpg.h:429
The req_lib_cpg_iterationnext struct.
Definition ipc_cpg.h:446
The req_lib_cpg_join struct.
Definition ipc_cpg.h:249
The req_lib_cpg_leave struct.
Definition ipc_cpg.h:413
The req_lib_cpg_mcast struct.
Definition ipc_cpg.h:309
The req_lib_cpg_membership_get struct.
Definition ipc_cpg.h:372
The req_lib_cpg_partial_mcast struct.
Definition ipc_cpg.h:319
The res_lib_cpg_confchg_callback struct.
Definition ipc_cpg.h:389
Message from another node.
Definition ipc_cpg.h:338
The res_lib_cpg_finalize struct.
Definition ipc_cpg.h:273
The res_lib_cpg_iterationfinalize struct.
Definition ipc_cpg.h:470
The res_lib_cpg_iterationinitialize struct.
Definition ipc_cpg.h:438
The res_lib_cpg_iterationnext struct.
Definition ipc_cpg.h:454
The res_lib_cpg_join struct.
Definition ipc_cpg.h:259
The res_lib_cpg_leave struct.
Definition ipc_cpg.h:422
The res_lib_cpg_local_get struct.
Definition ipc_cpg.h:294
The res_lib_cpg_mcast struct.
Definition ipc_cpg.h:331
The res_lib_cpg_membership_get struct.
Definition ipc_cpg.h:380
mar_cpg_address_t member_list[PROCESSOR_COUNT_MAX]
Definition ipc_cpg.h:383
The res_lib_cpg_null struct.
Definition ipc_cpg.h:287
The res_lib_cpg_partial_deliver_callback struct.
Definition ipc_cpg.h:350
The res_lib_cpg_partial_send struct.
Definition ipc_cpg.h:302
The res_lib_cpg_totem_confchg_callback struct.
Definition ipc_cpg.h:403
#define swab32(x)
The swab32 macro.
Definition swab.h:51
typedef __attribute__
char type
Definition totem.h:2
struct memb_ring_id ring_id
Definition totemsrp.c:4
struct totem_message_header header
Definition totemsrp.c:0