From 78f2d64051326084038c4b0316d59f5fe4289d6f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 25 Nov 2019 15:38:25 +0100 Subject: [PATCH] rebase to new upstream release 3.0.3 Signed-off-by: Thomas Lamprecht --- ...ify_lib_joinlist-drop-conn-parameter.patch | 119 -- ...-confchg-event-per-group-on-joinlist.patch | 201 --- ...more-comments-to-notify_lib_joinlist.patch | 200 --- ...illing-of-member_list-to-subfunction.patch | 137 -- ...if-all-nodes-have-name-attrs-in-mult.patch | 48 - ...if-all-nodes-have-same-number-of-lin.patch | 40 - ...mknet-Disable-forwarding-on-shutdown.patch | 55 - ...dd-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch | 1224 ----------------- ...1-totemknet-Add-locking-for-log-call.patch | 93 -- ...ck-sanity-length-of-received-message.patch | 71 - ...Reduce-MTU-to-left-room-second-mcast.patch | 44 - debian/patches/series | 11 - upstream | 2 +- 13 files changed, 1 insertion(+), 2244 deletions(-) delete mode 100644 debian/patches/0003-cpg-notify_lib_joinlist-drop-conn-parameter.patch delete mode 100644 debian/patches/0004-cpg-send-single-confchg-event-per-group-on-joinlist.patch delete mode 100644 debian/patches/0005-cpg-Add-more-comments-to-notify_lib_joinlist.patch delete mode 100644 debian/patches/0006-cpg-Move-filling-of-member_list-to-subfunction.patch delete mode 100644 debian/patches/0007-totem-fix-check-if-all-nodes-have-name-attrs-in-mult.patch delete mode 100644 debian/patches/0008-totem-fix-check-if-all-nodes-have-same-number-of-lin.patch delete mode 100644 debian/patches/0009-totemknet-Disable-forwarding-on-shutdown.patch delete mode 100644 debian/patches/0010-logging-Add-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch delete mode 100644 debian/patches/0011-totemknet-Add-locking-for-log-call.patch delete mode 100644 debian/patches/0012-totempg-Check-sanity-length-of-received-message.patch delete mode 100644 debian/patches/0013-totemsrp-Reduce-MTU-to-left-room-second-mcast.patch diff --git a/debian/patches/0003-cpg-notify_lib_joinlist-drop-conn-parameter.patch b/debian/patches/0003-cpg-notify_lib_joinlist-drop-conn-parameter.patch deleted file mode 100644 index 62bd796..0000000 --- a/debian/patches/0003-cpg-notify_lib_joinlist-drop-conn-parameter.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= -Date: Wed, 15 May 2019 13:45:13 +0200 -Subject: [PATCH] cpg: notify_lib_joinlist: drop conn parameter -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -since it is always set to NULL. - -Signed-off-by: Fabian Grünbichler -Reviewed-by: Jan Friesse -(cherry picked from commit c16abe515f895579f11b9012c888b7e067bb99fc) -Signed-off-by: Thomas Lamprecht ---- - exec/cpg.c | 54 ++++++++++++++++++++++++------------------------------ - 1 file changed, 24 insertions(+), 30 deletions(-) - -diff --git a/exec/cpg.c b/exec/cpg.c -index e39ca340..b752cc15 100644 ---- a/exec/cpg.c -+++ b/exec/cpg.c -@@ -647,7 +647,6 @@ static int notify_lib_totem_membership ( - - static int notify_lib_joinlist( - const mar_cpg_name_t *group_name, -- void *conn, - int joined_list_entries, - mar_cpg_address_t *joined_list, - int left_list_entries, -@@ -728,40 +727,35 @@ static int notify_lib_joinlist( - retgi += joined_list_entries; - } - -- if (conn) { -- api->ipc_dispatch_send (conn, buf, size); -- } else { - qb_list_for_each(iter, &cpg_pd_list_head) { -- struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -- if (mar_name_compare (&cpd->group_name, group_name) == 0) { -- assert (joined_list_entries <= 1); -- if (joined_list_entries) { -- if (joined_list[0].pid == cpd->pid && -- joined_list[0].nodeid == api->totem_nodeid_get()) { -- cpd->cpd_state = CPD_STATE_JOIN_COMPLETED; -- } -+ struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -+ if (mar_name_compare (&cpd->group_name, group_name) == 0) { -+ assert (joined_list_entries <= 1); -+ if (joined_list_entries) { -+ if (joined_list[0].pid == cpd->pid && -+ joined_list[0].nodeid == api->totem_nodeid_get()) { -+ cpd->cpd_state = CPD_STATE_JOIN_COMPLETED; - } -- if (cpd->cpd_state == CPD_STATE_JOIN_COMPLETED || -- cpd->cpd_state == CPD_STATE_LEAVE_STARTED) { -+ } -+ if (cpd->cpd_state == CPD_STATE_JOIN_COMPLETED || -+ cpd->cpd_state == CPD_STATE_LEAVE_STARTED) { - -- api->ipc_dispatch_send (cpd->conn, buf, size); -- cpd->transition_counter++; -- } -- if (left_list_entries) { -- if (left_list[0].pid == cpd->pid && -- left_list[0].nodeid == api->totem_nodeid_get() && -- left_list[0].reason == CONFCHG_CPG_REASON_LEAVE) { -- -- cpd->pid = 0; -- memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -- cpd->cpd_state = CPD_STATE_UNJOINED; -- } -+ api->ipc_dispatch_send (cpd->conn, buf, size); -+ cpd->transition_counter++; -+ } -+ if (left_list_entries) { -+ if (left_list[0].pid == cpd->pid && -+ left_list[0].nodeid == api->totem_nodeid_get() && -+ left_list[0].reason == CONFCHG_CPG_REASON_LEAVE) { -+ -+ cpd->pid = 0; -+ memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -+ cpd->cpd_state = CPD_STATE_UNJOINED; - } - } - } - } - -- - /* - * Traverse thru cpds and send totem membership for cpd, where it is not send yet - */ -@@ -858,7 +852,7 @@ static void downlist_inform_clients (void) - } - - /* send confchg event */ -- notify_lib_joinlist(&group, NULL, -+ notify_lib_joinlist(&group, - 0, NULL, - pcd->left_list_entries, - pcd->left_list, -@@ -1157,7 +1151,7 @@ static void do_proc_join( - notify_info.nodeid = nodeid; - notify_info.reason = reason; - -- notify_lib_joinlist(&pi->group, NULL, -+ notify_lib_joinlist(&pi->group, - 1, ¬ify_info, - 0, NULL, - MESSAGE_RES_CPG_CONFCHG_CALLBACK); -@@ -1177,7 +1171,7 @@ static void do_proc_leave( - notify_info.nodeid = nodeid; - notify_info.reason = reason; - -- notify_lib_joinlist(name, NULL, -+ notify_lib_joinlist(name, - 0, NULL, - 1, ¬ify_info, - MESSAGE_RES_CPG_CONFCHG_CALLBACK); diff --git a/debian/patches/0004-cpg-send-single-confchg-event-per-group-on-joinlist.patch b/debian/patches/0004-cpg-send-single-confchg-event-per-group-on-joinlist.patch deleted file mode 100644 index 117e3f3..0000000 --- a/debian/patches/0004-cpg-send-single-confchg-event-per-group-on-joinlist.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= -Date: Wed, 8 May 2019 16:31:15 +0200 -Subject: [PATCH] cpg: send single confchg event per group on joinlist -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -using a similar approach to - -43bead364514e8ae2ba00bcf07c460e31d0b1765 -"Send one confchg event per CPG group to CPG client" - -which did the same for leave events on a network partition. - -Signed-off-by: Fabian Grünbichler -Reviewed-by: Jan Friesse -(cherry picked from commit 7fb247096687d4232b6e90e4c732229b971c8378) -Signed-off-by: Thomas Lamprecht ---- - exec/cpg.c | 97 ++++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 73 insertions(+), 24 deletions(-) - -diff --git a/exec/cpg.c b/exec/cpg.c -index b752cc15..e04ba579 100644 ---- a/exec/cpg.c -+++ b/exec/cpg.c -@@ -194,6 +194,12 @@ struct join_list_entry { - mar_cpg_name_t group_name; - }; - -+struct join_list_confchg_data { -+ mar_cpg_name_t cpg_group; -+ mar_cpg_address_t join_list[CPG_MEMBERS_MAX]; -+ int join_list_entries; -+}; -+ - /* - * Service Interfaces required by service_message_handler struct - */ -@@ -312,7 +318,8 @@ static void do_proc_join( - const mar_cpg_name_t *name, - uint32_t pid, - unsigned int nodeid, -- int reason); -+ int reason, -+ qb_map_t *group_notify_map); - - static void do_proc_leave( - const mar_cpg_name_t *name, -@@ -723,35 +730,46 @@ static int notify_lib_joinlist( - } - - if (joined_list_entries) { -+ int i; -+ - memcpy (retgi, joined_list, joined_list_entries * sizeof(mar_cpg_address_t)); - retgi += joined_list_entries; -+ -+ for (i=0; i < joined_list_entries; i++) { -+ if (joined_list[i].nodeid == api->totem_nodeid_get()) { -+ qb_list_for_each(iter, &cpg_pd_list_head) { -+ struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -+ if (mar_name_compare (&cpd->group_name, group_name) == 0 && -+ joined_list[i].pid == cpd->pid) { -+ cpd->cpd_state = CPD_STATE_JOIN_COMPLETED; -+ } -+ } -+ } -+ } - } - - qb_list_for_each(iter, &cpg_pd_list_head) { - struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); - if (mar_name_compare (&cpd->group_name, group_name) == 0) { -- assert (joined_list_entries <= 1); -- if (joined_list_entries) { -- if (joined_list[0].pid == cpd->pid && -- joined_list[0].nodeid == api->totem_nodeid_get()) { -- cpd->cpd_state = CPD_STATE_JOIN_COMPLETED; -- } -- } - if (cpd->cpd_state == CPD_STATE_JOIN_COMPLETED || - cpd->cpd_state == CPD_STATE_LEAVE_STARTED) { - - api->ipc_dispatch_send (cpd->conn, buf, size); - cpd->transition_counter++; - } -- if (left_list_entries) { -- if (left_list[0].pid == cpd->pid && -- left_list[0].nodeid == api->totem_nodeid_get() && -- left_list[0].reason == CONFCHG_CPG_REASON_LEAVE) { -- -- cpd->pid = 0; -- memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -- cpd->cpd_state = CPD_STATE_UNJOINED; -- } -+ } -+ } -+ -+ if (left_list_entries && -+ left_list[0].nodeid == api->totem_nodeid_get() && -+ left_list[0].reason == CONFCHG_CPG_REASON_LEAVE) { -+ qb_list_for_each(iter, &cpg_pd_list_head) { -+ struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -+ if (mar_name_compare (&cpd->group_name, group_name) == 0 && -+ left_list[0].pid == cpd->pid) { -+ cpd->pid = 0; -+ memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -+ cpd->cpd_state = CPD_STATE_UNJOINED; - } - } - } -@@ -915,6 +933,11 @@ static void joinlist_inform_clients (void) - struct joinlist_msg *stored_msg; - struct qb_list_head *iter; - unsigned int i; -+ qb_map_t *group_notify_map; -+ qb_map_iter_t *miter; -+ struct join_list_confchg_data *jld; -+ -+ group_notify_map = qb_skiplist_create(); - - i = 0; - qb_list_for_each(iter, &joinlist_messages_head) { -@@ -931,9 +954,19 @@ static void joinlist_inform_clients (void) - } - - do_proc_join (&stored_msg->group_name, stored_msg->pid, stored_msg->sender_nodeid, -- CONFCHG_CPG_REASON_NODEUP); -+ CONFCHG_CPG_REASON_NODEUP, group_notify_map); - } - -+ miter = qb_map_iter_create(group_notify_map); -+ while (qb_map_iter_next(miter, (void **)&jld)) { -+ notify_lib_joinlist(&jld->cpg_group, -+ jld->join_list_entries, jld->join_list, -+ 0, NULL, -+ MESSAGE_RES_CPG_CONFCHG_CALLBACK); -+ free(jld); -+ } -+ qb_map_iter_free(miter); -+ - joinlist_remove_zombie_pi_entries (); - } - -@@ -1111,13 +1144,15 @@ static void do_proc_join( - const mar_cpg_name_t *name, - uint32_t pid, - unsigned int nodeid, -- int reason) -+ int reason, -+ qb_map_t *group_notify_map) - { - struct process_info *pi; - struct process_info *pi_entry; - mar_cpg_address_t notify_info; - struct qb_list_head *list; - struct qb_list_head *list_to_add = NULL; -+ int size; - - if (process_info_find (name, pid, nodeid) != NULL) { - return ; -@@ -1151,10 +1186,24 @@ static void do_proc_join( - notify_info.nodeid = nodeid; - notify_info.reason = reason; - -- notify_lib_joinlist(&pi->group, -- 1, ¬ify_info, -- 0, NULL, -- MESSAGE_RES_CPG_CONFCHG_CALLBACK); -+ if (group_notify_map == NULL) { -+ notify_lib_joinlist(&pi->group, -+ 1, ¬ify_info, -+ 0, NULL, -+ MESSAGE_RES_CPG_CONFCHG_CALLBACK); -+ } else { -+ struct join_list_confchg_data *jld = qb_map_get(group_notify_map, pi->group.value); -+ if (jld == NULL) { -+ jld = (struct join_list_confchg_data *)calloc(1, sizeof(struct join_list_confchg_data)); -+ memcpy(&jld->cpg_group, &pi->group, sizeof(mar_cpg_name_t)); -+ qb_map_put(group_notify_map, jld->cpg_group.value, jld); -+ } -+ size = jld->join_list_entries; -+ jld->join_list[size].nodeid = notify_info.nodeid; -+ jld->join_list[size].pid = notify_info.pid; -+ jld->join_list[size].reason = notify_info.reason; -+ jld->join_list_entries++; -+ } - } - - static void do_proc_leave( -@@ -1219,7 +1268,7 @@ static void message_handler_req_exec_cpg_procjoin ( - - do_proc_join (&req_exec_cpg_procjoin->group_name, - req_exec_cpg_procjoin->pid, nodeid, -- CONFCHG_CPG_REASON_JOIN); -+ CONFCHG_CPG_REASON_JOIN, NULL); - } - - static void message_handler_req_exec_cpg_procleave ( diff --git a/debian/patches/0005-cpg-Add-more-comments-to-notify_lib_joinlist.patch b/debian/patches/0005-cpg-Add-more-comments-to-notify_lib_joinlist.patch deleted file mode 100644 index 14e9fe7..0000000 --- a/debian/patches/0005-cpg-Add-more-comments-to-notify_lib_joinlist.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Wed, 15 May 2019 17:39:13 +0200 -Subject: [PATCH] cpg: Add more comments to notify_lib_joinlist -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -And make handling of left_list more generic. Also free skiplist -allocated by joinlist_inform_clients function. Last (but not least) -remove czechlish founded (should have been pp of "find"). - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield -Reviewed-by: Fabian Grünbichler -(cherry picked from commit 1e2df0ba0c341bc1a2a72da4d63e0993bb643909) -Signed-off-by: Thomas Lamprecht ---- - exec/cpg.c | 91 +++++++++++++++++++++++++++++++++++------------------- - 1 file changed, 60 insertions(+), 31 deletions(-) - -diff --git a/exec/cpg.c b/exec/cpg.c -index e04ba579..2ecdc6b4 100644 ---- a/exec/cpg.c -+++ b/exec/cpg.c -@@ -663,31 +663,37 @@ static int notify_lib_joinlist( - int size; - char *buf; - struct qb_list_head *iter; -- int count; -+ int member_list_entries; - struct res_lib_cpg_confchg_callback *res; - mar_cpg_address_t *retgi; -+ int i; - -- count = 0; -+ /* -+ * Find size of member_list (use process_info_list but remove items in left_list) -+ */ -+ member_list_entries = 0; - - qb_list_for_each(iter, &process_info_list_head) { - struct process_info *pi = qb_list_entry (iter, struct process_info, list); -+ - if (mar_name_compare (&pi->group, group_name) == 0) { -- int i; -- int founded = 0; -+ int in_left_list = 0; - - for (i = 0; i < left_list_entries; i++) { - if (left_list[i].nodeid == pi->nodeid && left_list[i].pid == pi->pid) { -- founded++; -+ in_left_list = 1; -+ break ; - } - } - -- if (!founded) -- count++; -+ if (!in_left_list) { -+ member_list_entries++; -+ } - } - } - - size = sizeof(struct res_lib_cpg_confchg_callback) + -- sizeof(mar_cpg_address_t) * (count + left_list_entries + joined_list_entries); -+ sizeof(mar_cpg_address_t) * (member_list_entries + left_list_entries + joined_list_entries); - buf = alloca(size); - if (!buf) - return CS_ERR_LIBRARY; -@@ -695,27 +701,30 @@ static int notify_lib_joinlist( - res = (struct res_lib_cpg_confchg_callback *)buf; - res->joined_list_entries = joined_list_entries; - res->left_list_entries = left_list_entries; -- res->member_list_entries = count; -+ res->member_list_entries = member_list_entries; - retgi = res->member_list; - res->header.size = size; - res->header.id = id; - res->header.error = CS_OK; - memcpy(&res->group_name, group_name, sizeof(mar_cpg_name_t)); - -+ /* -+ * Fill res->memberlist. Use process_info_list but remove items in left_list. -+ */ - qb_list_for_each(iter, &process_info_list_head) { -- struct process_info *pi=qb_list_entry (iter, struct process_info, list); -+ struct process_info *pi = qb_list_entry (iter, struct process_info, list); - - if (mar_name_compare (&pi->group, group_name) == 0) { -- int i; -- int founded = 0; -+ int in_left_list = 0; - -- for (i = 0;i < left_list_entries; i++) { -+ for (i = 0; i < left_list_entries; i++) { - if (left_list[i].nodeid == pi->nodeid && left_list[i].pid == pi->pid) { -- founded++; -+ in_left_list = 1; -+ break ; - } - } - -- if (!founded) { -+ if (!in_left_list) { - retgi->nodeid = pi->nodeid; - retgi->pid = pi->pid; - retgi->reason = CPG_REASON_UNDEFINED; -@@ -724,23 +733,30 @@ static int notify_lib_joinlist( - } - } - -+ /* -+ * Fill res->left_list -+ */ - if (left_list_entries) { - memcpy (retgi, left_list, left_list_entries * sizeof(mar_cpg_address_t)); - retgi += left_list_entries; - } - - if (joined_list_entries) { -- int i; -- -+ /* -+ * Fill res->joined_list -+ */ - memcpy (retgi, joined_list, joined_list_entries * sizeof(mar_cpg_address_t)); - retgi += joined_list_entries; - -- for (i=0; i < joined_list_entries; i++) { -+ /* -+ * Update cpd_state for all local joined processes in group -+ */ -+ for (i = 0; i < joined_list_entries; i++) { - if (joined_list[i].nodeid == api->totem_nodeid_get()) { -- qb_list_for_each(iter, &cpg_pd_list_head) { -+ qb_list_for_each(iter, &cpg_pd_list_head) { - struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -- if (mar_name_compare (&cpd->group_name, group_name) == 0 && -- joined_list[i].pid == cpd->pid) { -+ if (joined_list[i].pid == cpd->pid && -+ mar_name_compare (&cpd->group_name, group_name) == 0) { - cpd->cpd_state = CPD_STATE_JOIN_COMPLETED; - } - } -@@ -748,6 +764,9 @@ static int notify_lib_joinlist( - } - } - -+ /* -+ * Send notification to all ipc clients joined in group_name -+ */ - qb_list_for_each(iter, &cpg_pd_list_head) { - struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); - if (mar_name_compare (&cpd->group_name, group_name) == 0) { -@@ -760,16 +779,25 @@ static int notify_lib_joinlist( - } - } - -- if (left_list_entries && -- left_list[0].nodeid == api->totem_nodeid_get() && -- left_list[0].reason == CONFCHG_CPG_REASON_LEAVE) { -- qb_list_for_each(iter, &cpg_pd_list_head) { -- struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -- if (mar_name_compare (&cpd->group_name, group_name) == 0 && -- left_list[0].pid == cpd->pid) { -- cpd->pid = 0; -- memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -- cpd->cpd_state = CPD_STATE_UNJOINED; -+ if (left_list_entries) { -+ /* -+ * Zero internal cpd state for all local processes leaving group -+ * (this loop is not strictly needed because left_list always either -+ * contains exactly one process running on local node or more items -+ * but none of them is running on local node) -+ */ -+ for (i = 0; i < joined_list_entries; i++) { -+ if (left_list[i].nodeid == api->totem_nodeid_get() && -+ left_list[i].reason == CONFCHG_CPG_REASON_LEAVE) { -+ qb_list_for_each(iter, &cpg_pd_list_head) { -+ struct cpg_pd *cpd = qb_list_entry (iter, struct cpg_pd, list); -+ if (left_list[i].pid == cpd->pid && -+ mar_name_compare (&cpd->group_name, group_name) == 0) { -+ cpd->pid = 0; -+ memset (&cpd->group_name, 0, sizeof(cpd->group_name)); -+ cpd->cpd_state = CPD_STATE_UNJOINED; -+ } -+ } - } - } - } -@@ -966,6 +994,7 @@ static void joinlist_inform_clients (void) - free(jld); - } - qb_map_iter_free(miter); -+ qb_map_destroy(group_notify_map); - - joinlist_remove_zombie_pi_entries (); - } diff --git a/debian/patches/0006-cpg-Move-filling-of-member_list-to-subfunction.patch b/debian/patches/0006-cpg-Move-filling-of-member_list-to-subfunction.patch deleted file mode 100644 index 56b9728..0000000 --- a/debian/patches/0006-cpg-Move-filling-of-member_list-to-subfunction.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Thu, 16 May 2019 14:08:25 +0200 -Subject: [PATCH] cpg: Move filling of member_list to subfunction -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield -Reviewed-by: Fabian Grünbichler -(cherry picked from commit 3c7f19a02fbff19414638952043691d92be86d41) -Signed-off-by: Thomas Lamprecht ---- - exec/cpg.c | 86 +++++++++++++++++++++++++++++++----------------------- - 1 file changed, 50 insertions(+), 36 deletions(-) - -diff --git a/exec/cpg.c b/exec/cpg.c -index 2ecdc6b4..98a16a60 100644 ---- a/exec/cpg.c -+++ b/exec/cpg.c -@@ -652,26 +652,27 @@ static int notify_lib_totem_membership ( - return CS_OK; - } - --static int notify_lib_joinlist( -+/* -+ * Helper function for notify_lib_joinlist which prepares member_list using -+ * process_info_list with removed left_list items. -+ * member_list_entries - When not NULL it contains number of member_list entries -+ * member_list - When not NULL it is used as pointer to start of preallocated -+ * array of members. Pointer is adjusted to the end of array on -+ * exit. -+ */ -+static void notify_lib_joinlist_fill_member_list( - const mar_cpg_name_t *group_name, -- int joined_list_entries, -- mar_cpg_address_t *joined_list, - int left_list_entries, -- mar_cpg_address_t *left_list, -- int id) -+ const mar_cpg_address_t *left_list, -+ int *member_list_entries, -+ mar_cpg_address_t **member_list) - { -- int size; -- char *buf; - struct qb_list_head *iter; -- int member_list_entries; -- struct res_lib_cpg_confchg_callback *res; -- mar_cpg_address_t *retgi; - int i; - -- /* -- * Find size of member_list (use process_info_list but remove items in left_list) -- */ -- member_list_entries = 0; -+ if (member_list_entries != NULL) { -+ *member_list_entries = 0; -+ } - - qb_list_for_each(iter, &process_info_list_head) { - struct process_info *pi = qb_list_entry (iter, struct process_info, list); -@@ -687,10 +688,42 @@ static int notify_lib_joinlist( - } - - if (!in_left_list) { -- member_list_entries++; -+ if (member_list_entries != NULL) { -+ (*member_list_entries)++; -+ } -+ -+ if (member_list != NULL) { -+ (*member_list)->nodeid = pi->nodeid; -+ (*member_list)->pid = pi->pid; -+ (*member_list)->reason = CPG_REASON_UNDEFINED; -+ (*member_list)++; -+ } - } - } - } -+} -+ -+static int notify_lib_joinlist( -+ const mar_cpg_name_t *group_name, -+ int joined_list_entries, -+ mar_cpg_address_t *joined_list, -+ int left_list_entries, -+ mar_cpg_address_t *left_list, -+ int id) -+{ -+ int size; -+ char *buf; -+ struct qb_list_head *iter; -+ int member_list_entries; -+ struct res_lib_cpg_confchg_callback *res; -+ mar_cpg_address_t *retgi; -+ int i; -+ -+ /* -+ * Find size of member_list (use process_info_list but remove items in left_list) -+ */ -+ notify_lib_joinlist_fill_member_list(group_name, left_list_entries, left_list, -+ &member_list_entries, NULL); - - size = sizeof(struct res_lib_cpg_confchg_callback) + - sizeof(mar_cpg_address_t) * (member_list_entries + left_list_entries + joined_list_entries); -@@ -711,27 +744,8 @@ static int notify_lib_joinlist( - /* - * Fill res->memberlist. Use process_info_list but remove items in left_list. - */ -- qb_list_for_each(iter, &process_info_list_head) { -- struct process_info *pi = qb_list_entry (iter, struct process_info, list); -- -- if (mar_name_compare (&pi->group, group_name) == 0) { -- int in_left_list = 0; -- -- for (i = 0; i < left_list_entries; i++) { -- if (left_list[i].nodeid == pi->nodeid && left_list[i].pid == pi->pid) { -- in_left_list = 1; -- break ; -- } -- } -- -- if (!in_left_list) { -- retgi->nodeid = pi->nodeid; -- retgi->pid = pi->pid; -- retgi->reason = CPG_REASON_UNDEFINED; -- retgi++; -- } -- } -- } -+ notify_lib_joinlist_fill_member_list(group_name, left_list_entries, left_list, -+ NULL, &retgi); - - /* - * Fill res->left_list diff --git a/debian/patches/0007-totem-fix-check-if-all-nodes-have-name-attrs-in-mult.patch b/debian/patches/0007-totem-fix-check-if-all-nodes-have-name-attrs-in-mult.patch deleted file mode 100644 index e541d22..0000000 --- a/debian/patches/0007-totem-fix-check-if-all-nodes-have-name-attrs-in-mult.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thomas Lamprecht -Date: Fri, 14 Jun 2019 18:31:16 +0200 -Subject: [PATCH] totem: fix check if all nodes have name attrs in multi-link - setups - -As totem_config->interfaces entries are _all_ possible links and not -only the configured ones we cannot trust that interface[0] is -configured at the time of checking, and thus has a valid -member_count. So set the members variable to the member_count entry -from an actually configured interface and loop over that one. - -This fixes a case where the check for the name property on all nodes -for multi links was skipped if link 0 was not configured, as then its -member_count was 0. - -Signed-off-by: Thomas Lamprecht -Reviewed-by: Christine Caulfield -Reviewed-by: Jan Friesse -(cherry picked from commit 7ada508a82680dcf23510e585ec295b10ac5da11) -Signed-off-by: Thomas Lamprecht ---- - exec/totemconfig.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index ff86e232..dfde90df 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -449,14 +449,15 @@ static int totem_volatile_config_validate ( - num_configured = 0; - for (i = 0; i < INTERFACE_MAX; i++) { - if (totem_config->interfaces[i].configured) { -+ if (num_configured == 0) { -+ members = totem_config->interfaces[i].member_count; -+ } - num_configured++; - } - } - - if (num_configured > 1) { -- members = totem_config->interfaces[0].member_count; -- -- for (i=0; iinterfaces[0].member_count; i++) { -+ for (i=0; i < members; i++) { - snprintf(name_key, sizeof(name_key), "nodelist.node.%d.name", i); - - if (icmap_get_string(name_key, &name_str) != CS_OK) { diff --git a/debian/patches/0008-totem-fix-check-if-all-nodes-have-same-number-of-lin.patch b/debian/patches/0008-totem-fix-check-if-all-nodes-have-same-number-of-lin.patch deleted file mode 100644 index 8209d7d..0000000 --- a/debian/patches/0008-totem-fix-check-if-all-nodes-have-same-number-of-lin.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thomas Lamprecht -Date: Fri, 14 Jun 2019 18:56:57 +0200 -Subject: [PATCH] totem: fix check if all nodes have same number of links - -configured links may not come in order in the interfaces array, which -holds an entry for _all_ possible links, not just configured ones. - -So iterate through all interfaces, but skip those which are not -configured. This allows to start corosync with a configuration where -link 0 is currently not mentioned, as else it was checked but had -member_count = 0 from it's default initialization, which then made -this code report a false positive for the "Not all nodes have the -same number of links" check even on a correct config. - -Signed-off-by: Thomas Lamprecht -Reviewed-by: Christine Caulfield -Reviewed-by: Jan Friesse -(cherry picked from commit 816324c94cfb917b11f43954b8757424db28b390) -Signed-off-by: Thomas Lamprecht ---- - exec/totemconfig.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index dfde90df..67a61ac2 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -467,7 +467,10 @@ static int totem_volatile_config_validate ( - } - } - -- for (i=0; iinterfaces[i].configured) { -+ continue; -+ } - if (totem_config->interfaces[i].member_count != members) { - snprintf (local_error_reason, sizeof(local_error_reason), - "Not all nodes have the same number of links"); diff --git a/debian/patches/0009-totemknet-Disable-forwarding-on-shutdown.patch b/debian/patches/0009-totemknet-Disable-forwarding-on-shutdown.patch deleted file mode 100644 index d8e081f..0000000 --- a/debian/patches/0009-totemknet-Disable-forwarding-on-shutdown.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Thu, 27 Jun 2019 08:33:27 +0200 -Subject: [PATCH] totemknet: Disable forwarding on shutdown - -Disabling forwarding will make knet flush the messages (especially -LEAVE one). - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield -(cherry picked from commit d59a18d4a13717ffe56ef31fadda9f67c7cfcf8e) -Signed-off-by: Thomas Lamprecht ---- - exec/totemknet.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - -diff --git a/exec/totemknet.c b/exec/totemknet.c -index e6e04d3a..e1ea8515 100644 ---- a/exec/totemknet.c -+++ b/exec/totemknet.c -@@ -554,6 +554,14 @@ int totemknet_finalize ( - qb_loop_poll_del (instance->poll_handle, instance->logpipes[0]); - qb_loop_poll_del (instance->poll_handle, instance->knet_fd); - -+ /* -+ * Disable forwarding to make knet flush send queue. This ensures that the LEAVE message will be sent. -+ */ -+ res = knet_handle_setfwd(instance->knet_handle, 0); -+ if (res) { -+ knet_log_printf (LOGSYS_LEVEL_CRIT, "totemknet: knet_handle_setfwd failed: %s", strerror(errno)); -+ } -+ - res = knet_host_get_host_list(instance->knet_handle, nodes, &num_nodes); - if (res) { - knet_log_printf (LOGSYS_LEVEL_ERROR, "Cannot get knet node list for shutdown: %s", strerror(errno)); -@@ -561,7 +569,7 @@ int totemknet_finalize ( - goto finalise_error; - } - -- /* Tidily shut down all nodes & links. This ensures that the LEAVE message will be sent */ -+ /* Tidily shut down all nodes & links. */ - for (i=0; iknet_handle, nodes[i], links, &num_links); -@@ -586,10 +594,6 @@ int totemknet_finalize ( - } - - finalise_error: -- res = knet_handle_setfwd(instance->knet_handle, 0); -- if (res) { -- knet_log_printf (LOGSYS_LEVEL_CRIT, "totemknet: knet_handle_setfwd failed: %s", strerror(errno)); -- } - res = knet_handle_free(instance->knet_handle); - if (res) { - knet_log_printf (LOGSYS_LEVEL_CRIT, "totemknet: knet_handle_free failed: %s", strerror(errno)); diff --git a/debian/patches/0010-logging-Add-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch b/debian/patches/0010-logging-Add-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch deleted file mode 100644 index 2eb0794..0000000 --- a/debian/patches/0010-logging-Add-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch +++ /dev/null @@ -1,1224 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Tue, 2 Jul 2019 10:36:30 +0200 -Subject: [PATCH] logging: Add CS_PRI_NODE_ID and CS_PRI_RING_ID - -Previously node id was logged ether as a %d (most often), %u, %x or -PRI.32 and ring id ether as %lld, %llx with various separators (., :, /) -between rep nodeid and seq. This seems to cause confusion. - -This patch adds macros CS_PRI_NODE_ID, CS_PRI_RING_ID and -CS_PRI_RING_ID_SEQ (CS prefix = corosync, PRI modeled in spirit of -inttypes.h PRIx32) and makes code use them. - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield -(cherry picked from commit 5731af278288bf2a27d2a71a8478066ca6047ba7) -Signed-off-by: Thomas Lamprecht ---- - exec/cfg.c | 8 +++--- - exec/cmap.c | 2 +- - exec/cpg.c | 10 ++++---- - exec/main.c | 8 +++--- - exec/totemconfig.c | 2 +- - exec/totemknet.c | 36 +++++++++++++-------------- - exec/totemsrp.c | 47 ++++++++++++++++++------------------ - exec/votequorum.c | 32 ++++++++++++------------ - exec/vsf_quorum.c | 2 +- - include/corosync/corotypes.h | 3 +++ - test/cpghum.c | 11 +++++---- - test/testcpg.c | 20 +++++++-------- - test/testcpg2.c | 7 +++--- - test/testcpgzc.c | 11 +++++---- - test/testquorum.c | 5 ++-- - test/testvotequorum1.c | 6 ++--- - test/testvotequorum2.c | 2 +- - test/testzcgc.c | 9 ++++--- - tools/corosync-cfgtool.c | 4 +-- - tools/corosync-notifyd.c | 14 +++++------ - tools/corosync-quorumtool.c | 12 ++++----- - vqsim/vqmain.c | 24 +++++++++--------- - vqsim/vqsim_vq_engine.c | 4 +-- - 23 files changed, 143 insertions(+), 136 deletions(-) - -diff --git a/exec/cfg.c b/exec/cfg.c -index f42cb608..28ba58d0 100644 ---- a/exec/cfg.c -+++ b/exec/cfg.c -@@ -514,11 +514,11 @@ static void message_handler_req_exec_cfg_killnode ( - cs_name_t reason; - - ENTER(); -- log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node %d(us=%d)", -+ log_printf(LOGSYS_LEVEL_DEBUG, "request to kill node " CS_PRI_NODE_ID " (us=" CS_PRI_NODE_ID ")", - req_exec_cfg_killnode->nodeid, api->totem_nodeid_get()); - if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) { - marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason); -- log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node %d: %s", -+ log_printf(LOGSYS_LEVEL_NOTICE, "Killed by node " CS_PRI_NODE_ID " : %s", - nodeid, reason.value); - corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); - } -@@ -534,7 +534,7 @@ static void message_handler_req_exec_cfg_shutdown ( - { - ENTER(); - -- log_printf(LOGSYS_LEVEL_NOTICE, "Node %d was shut down by sysadmin", nodeid); -+ log_printf(LOGSYS_LEVEL_NOTICE, "Node " CS_PRI_NODE_ID " was shut down by sysadmin", nodeid); - if (nodeid == api->totem_nodeid_get()) { - api->shutdown_request(); - } -@@ -674,7 +674,7 @@ static void message_handler_req_exec_cfg_reload_config ( - - ENTER(); - -- log_printf(LOGSYS_LEVEL_NOTICE, "Config reload requested by node %d", nodeid); -+ log_printf(LOGSYS_LEVEL_NOTICE, "Config reload requested by node " CS_PRI_NODE_ID, nodeid); - - /* - * Set up a new hashtable as a staging area. -diff --git a/exec/cmap.c b/exec/cmap.c -index 51656706..f3e36371 100644 ---- a/exec/cmap.c -+++ b/exec/cmap.c -@@ -1050,7 +1050,7 @@ static void message_handler_req_exec_cmap_mcast_reason_sync_nv( - } - } - -- qb_log(LOG_TRACE, "Received config version %"PRIu64" from node %x", config_version, nodeid); -+ qb_log(LOG_TRACE, "Received config version %"PRIu64" from node " CS_PRI_NODE_ID, config_version, nodeid); - - if (nodeid != api->totem_nodeid_get() && - config_version > cmap_highest_config_version_received) { -diff --git a/exec/cpg.c b/exec/cpg.c -index 98a16a60..34283c03 100644 ---- a/exec/cpg.c -+++ b/exec/cpg.c -@@ -1283,7 +1283,7 @@ static void message_handler_req_exec_cpg_downlist_old ( - const void *message, - unsigned int nodeid) - { -- log_printf (LOGSYS_LEVEL_WARNING, "downlist OLD from node 0x%x", -+ log_printf (LOGSYS_LEVEL_WARNING, "downlist OLD from node " CS_PRI_NODE_ID, - nodeid); - } - -@@ -1304,7 +1304,7 @@ static void message_handler_req_exec_cpg_procjoin ( - { - const struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = message; - -- log_printf(LOGSYS_LEVEL_DEBUG, "got procjoin message from cluster node 0x%x (%s) for pid %u", -+ log_printf(LOGSYS_LEVEL_DEBUG, "got procjoin message from cluster node " CS_PRI_NODE_ID " (%s) for pid %u", - nodeid, - api->totem_ifaces_print(nodeid), - (unsigned int)req_exec_cpg_procjoin->pid); -@@ -1320,7 +1320,7 @@ static void message_handler_req_exec_cpg_procleave ( - { - const struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = message; - -- log_printf(LOGSYS_LEVEL_DEBUG, "got procleave message from cluster node 0x%x (%s) for pid %u", -+ log_printf(LOGSYS_LEVEL_DEBUG, "got procleave message from cluster node " CS_PRI_NODE_ID " (%s) for pid %u", - nodeid, - api->totem_ifaces_print(nodeid), - (unsigned int)req_exec_cpg_procjoin->pid); -@@ -1341,7 +1341,7 @@ static void message_handler_req_exec_cpg_joinlist ( - const struct join_list_entry *jle = (const struct join_list_entry *)(message + sizeof(struct qb_ipc_response_header)); - struct joinlist_msg *stored_msg; - -- log_printf(LOGSYS_LEVEL_DEBUG, "got joinlist message from node 0x%x", -+ log_printf(LOGSYS_LEVEL_DEBUG, "got joinlist message from node " CS_PRI_NODE_ID, - nodeid); - - while ((const char*)jle < message + res->size) { -@@ -1422,7 +1422,7 @@ static void message_handler_req_exec_cpg_partial_mcast ( - struct iovec iovec[2]; - int known_node = 0; - -- log_printf(LOGSYS_LEVEL_DEBUG, "Got fragmented message from node %d, size = %d bytes\n", nodeid, msglen); -+ log_printf(LOGSYS_LEVEL_DEBUG, "Got fragmented message from node " CS_PRI_NODE_ID ", size = %d bytes\n", nodeid, msglen); - - res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_PARTIAL_DELIVER_CALLBACK; - res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast) + msglen; -diff --git a/exec/main.c b/exec/main.c -index 06a519c9..7a471a16 100644 ---- a/exec/main.c -+++ b/exec/main.c -@@ -692,18 +692,18 @@ static void corosync_ring_id_store ( - } - if (fd == -1) { - LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, -- "Couldn't store new ring id %llx to stable storage", -- memb_ring_id->seq); -+ "Couldn't store new ring id " CS_PRI_RING_ID_SEQ " to stable storage", -+ memb_ring_id->seq); - - corosync_exit_error (COROSYNC_DONE_STORE_RINGID); - } - log_printf (LOGSYS_LEVEL_DEBUG, -- "Storing new sequence id for ring %llx", memb_ring_id->seq); -+ "Storing new sequence id for ring " CS_PRI_RING_ID_SEQ, memb_ring_id->seq); - res = write (fd, &memb_ring_id->seq, sizeof(memb_ring_id->seq)); - close (fd); - if (res != sizeof(memb_ring_id->seq)) { - LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, -- "Couldn't store new ring id %llx to stable storage", -+ "Couldn't store new ring id " CS_PRI_RING_ID_SEQ " to stable storage", - memb_ring_id->seq); - - corosync_exit_error (COROSYNC_DONE_STORE_RINGID); -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index 67a61ac2..3af25239 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -1338,7 +1338,7 @@ static int put_nodelist_members_to_config(struct totem_config *totem_config, int - } - - log_printf(LOGSYS_LEVEL_DEBUG, -- "Generated nodeid = 0x%x for %s", nodeid, str); -+ "Generated nodeid = " CS_PRI_NODE_ID " for %s", nodeid, str); - free(str); - } - } -diff --git a/exec/totemknet.c b/exec/totemknet.c -index e1ea8515..38b69e7b 100644 ---- a/exec/totemknet.c -+++ b/exec/totemknet.c -@@ -324,7 +324,7 @@ static void host_change_callback_fn(void *private_data, knet_node_id_t host_id, - struct totemknet_instance *instance = (struct totemknet_instance *)private_data; - - // TODO: what? if anything. -- knet_log_printf (LOGSYS_LEVEL_DEBUG, "Knet host change callback. nodeid: %d reachable: %d", host_id, reachable); -+ knet_log_printf (LOGSYS_LEVEL_DEBUG, "Knet host change callback. nodeid: " CS_PRI_NODE_ID " reachable: %d", host_id, reachable); - } - - static void pmtu_change_callback_fn(void *private_data, unsigned int data_mtu) -@@ -574,22 +574,22 @@ int totemknet_finalize ( - - res = knet_link_get_link_list(instance->knet_handle, nodes[i], links, &num_links); - if (res) { -- knet_log_printf (LOGSYS_LEVEL_ERROR, "Cannot get knet link list for node %d: %s", nodes[i], strerror(errno)); -+ knet_log_printf (LOGSYS_LEVEL_ERROR, "Cannot get knet link list for node " CS_PRI_NODE_ID ": %s", nodes[i], strerror(errno)); - goto finalise_error; - } - for (j=0; jknet_handle, nodes[i], links[j], 0); - if (res) { -- knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_link_set_enable(node %d, link %d) failed: %s", nodes[i], links[j], strerror(errno)); -+ knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_link_set_enable(node " CS_PRI_NODE_ID ", link %d) failed: %s", nodes[i], links[j], strerror(errno)); - } - res = knet_link_clear_config(instance->knet_handle, nodes[i], links[j]); - if (res) { -- knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_link_clear_config(node %d, link %d) failed: %s", nodes[i], links[j], strerror(errno)); -+ knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_link_clear_config(node " CS_PRI_NODE_ID ", link %d) failed: %s", nodes[i], links[j], strerror(errno)); - } - } - res = knet_host_remove(instance->knet_handle, nodes[i]); - if (res) { -- knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_host_remove(node %d) failed: %s", nodes[i], strerror(errno)); -+ knet_log_printf (LOGSYS_LEVEL_ERROR, "totemknet: knet_host_remove(node " CS_PRI_NODE_ID ") failed: %s", nodes[i], strerror(errno)); - } - } - -@@ -814,17 +814,17 @@ static void totemknet_refresh_config( - instance->totem_config->interfaces[link_no].knet_ping_timeout, - instance->totem_config->interfaces[link_no].knet_ping_precision); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for node %d link %d failed", host_ids[i], link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for node " CS_PRI_NODE_ID " link %d failed", host_ids[i], link_no); - } - err = knet_link_set_pong_count(instance->knet_handle, host_ids[i], link_no, - instance->totem_config->interfaces[link_no].knet_pong_count); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for node %d link %d failed",host_ids[i], link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for node " CS_PRI_NODE_ID " link %d failed",host_ids[i], link_no); - } - err = knet_link_set_priority(instance->knet_handle, host_ids[i], link_no, - instance->totem_config->interfaces[link_no].knet_link_priority); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_priority for node %d link %d failed", host_ids[i], link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_priority for node " CS_PRI_NODE_ID " link %d failed", host_ids[i], link_no); - } - - } -@@ -1267,8 +1267,8 @@ int totemknet_member_add ( - } - } - -- knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: member_add: %d (%s), link=%d", member->nodeid, totemip_print(member), link_no); -- knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: local: %d (%s)", local->nodeid, totemip_print(local)); -+ knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: member_add: " CS_PRI_NODE_ID " (%s), link=%d", member->nodeid, totemip_print(member), link_no); -+ knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: local: " CS_PRI_NODE_ID " (%s)", local->nodeid, totemip_print(local)); - - - /* Only add the host if it doesn't already exist in knet */ -@@ -1290,7 +1290,7 @@ int totemknet_member_add ( - return -1; - } - } else { -- knet_log_printf (LOGSYS_LEVEL_DEBUG, "nodeid %d already added", member->nodeid); -+ knet_log_printf (LOGSYS_LEVEL_DEBUG, "nodeid " CS_PRI_NODE_ID " already added", member->nodeid); - } - - -@@ -1329,7 +1329,7 @@ int totemknet_member_add ( - err = knet_link_set_priority(instance->knet_handle, member->nodeid, link_no, - instance->totem_config->interfaces[link_no].knet_link_priority); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_priority for nodeid %d, link %d failed", member->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_priority for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); - } - - /* ping timeouts maybe 0 here for a newly added interface so we leave this till later, it will -@@ -1340,18 +1340,18 @@ int totemknet_member_add ( - instance->totem_config->interfaces[link_no].knet_ping_timeout, - instance->totem_config->interfaces[link_no].knet_ping_precision); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for nodeid %d, link %d failed", member->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); - } - err = knet_link_set_pong_count(instance->knet_handle, member->nodeid, link_no, - instance->totem_config->interfaces[link_no].knet_pong_count); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for nodeid %d, link %d failed", member->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); - } - } - - err = knet_link_set_enable(instance->knet_handle, member->nodeid, link_no, 1); - if (err) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_enable for nodeid %d, link %d failed", member->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_enable for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); - return -1; - } - -@@ -1370,7 +1370,7 @@ int totemknet_member_remove ( - uint8_t link_list[KNET_MAX_LINK]; - size_t num_links; - -- knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: member_remove: %d, link=%d", token_target->nodeid, link_no); -+ knet_log_printf (LOGSYS_LEVEL_DEBUG, "knet: member_remove: " CS_PRI_NODE_ID ", link=%d", token_target->nodeid, link_no); - - /* Don't remove the link with the loopback on it until we shut down */ - if (token_target->nodeid == instance->our_nodeid) { -@@ -1383,13 +1383,13 @@ int totemknet_member_remove ( - /* Remove the link first */ - res = knet_link_set_enable(instance->knet_handle, token_target->nodeid, link_no, 0); - if (res != 0) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set enable(off) for nodeid %d, link %d failed", token_target->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set enable(off) for nodeid " CS_PRI_NODE_ID ", link %d failed", token_target->nodeid, link_no); - return res; - } - - res = knet_link_clear_config(instance->knet_handle, token_target->nodeid, link_no); - if (res != 0) { -- KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_clear_config for nodeid %d, link %d failed", token_target->nodeid, link_no); -+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_clear_config for nodeid " CS_PRI_NODE_ID ", link %d failed", token_target->nodeid, link_no); - return res; - } - -diff --git a/exec/totemsrp.c b/exec/totemsrp.c -index a48d97bc..e988c531 100644 ---- a/exec/totemsrp.c -+++ b/exec/totemsrp.c -@@ -1415,9 +1415,9 @@ static void memb_set_log( - - for (i = 0; i < list_entries; i++) { - if (i == 0) { -- snprintf(int_buf, sizeof(int_buf), "%u", list[i].nodeid); -+ snprintf(int_buf, sizeof(int_buf), CS_PRI_NODE_ID, list[i].nodeid); - } else { -- snprintf(int_buf, sizeof(int_buf), ",%u", list[i].nodeid); -+ snprintf(int_buf, sizeof(int_buf), "," CS_PRI_NODE_ID, list[i].nodeid); - } - - if (strlen(list_str) + strlen(int_buf) >= sizeof(list_str)) { -@@ -1471,7 +1471,7 @@ static void my_leave_memb_set( - instance->my_leave_memb_entries++; - } else { - log_printf (instance->totemsrp_log_level_warning, -- "Cannot set LEAVE nodeid=%d", nodeid); -+ "Cannot set LEAVE nodeid=" CS_PRI_NODE_ID, nodeid); - } - } - -@@ -1871,8 +1871,8 @@ static void deliver_messages_from_recovery_to_regular (struct totemsrp_instance - } - - log_printf (instance->totemsrp_log_level_debug, -- "comparing if ring id is for this processors old ring seqno %d", -- mcast->seq); -+ "comparing if ring id is for this processors old ring seqno " CS_PRI_RING_ID_SEQ, -+ (uint64_t)mcast->seq); - - /* - * Only add this message to the regular sort -@@ -1892,7 +1892,7 @@ static void deliver_messages_from_recovery_to_regular (struct totemsrp_instance - } - } else { - log_printf (instance->totemsrp_log_level_debug, -- "-not adding msg with seq no %x", mcast->seq); -+ "-not adding msg with seq no " CS_PRI_RING_ID_SEQ, (uint64_t)mcast->seq); - } - } - } -@@ -2056,7 +2056,7 @@ static void memb_state_operational_enter (struct totemsrp_instance *instance) - int sptr = 0; - sptr += snprintf(joined_node_msg, sizeof(joined_node_msg)-sptr, " joined:"); - for (i=0; i< joined_list_entries; i++) { -- sptr += snprintf(joined_node_msg+sptr, sizeof(joined_node_msg)-sptr, " %u", joined_list_totemip[i]); -+ sptr += snprintf(joined_node_msg+sptr, sizeof(joined_node_msg)-sptr, " " CS_PRI_NODE_ID, joined_list_totemip[i]); - } - } - else { -@@ -2068,14 +2068,14 @@ static void memb_state_operational_enter (struct totemsrp_instance *instance) - int sptr2 = 0; - sptr += snprintf(left_node_msg, sizeof(left_node_msg)-sptr, " left:"); - for (i=0; i< instance->my_left_memb_entries; i++) { -- sptr += snprintf(left_node_msg+sptr, sizeof(left_node_msg)-sptr, " %u", left_list[i]); -+ sptr += snprintf(left_node_msg+sptr, sizeof(left_node_msg)-sptr, " " CS_PRI_NODE_ID, left_list[i]); - } - for (i=0; i< instance->my_left_memb_entries; i++) { - if (my_leave_memb_match(instance, left_list[i]) == 0) { - if (sptr2 == 0) { - sptr2 += snprintf(failed_node_msg, sizeof(failed_node_msg)-sptr2, " failed:"); - } -- sptr2 += snprintf(failed_node_msg+sptr2, sizeof(left_node_msg)-sptr2, " %u", left_list[i]); -+ sptr2 += snprintf(failed_node_msg+sptr2, sizeof(left_node_msg)-sptr2, " " CS_PRI_NODE_ID, left_list[i]); - } - } - if (sptr2 == 0) { -@@ -2092,9 +2092,9 @@ static void memb_state_operational_enter (struct totemsrp_instance *instance) - log_printf (instance->totemsrp_log_level_debug, - "entering OPERATIONAL state."); - log_printf (instance->totemsrp_log_level_notice, -- "A new membership (%u:%lld) was formed. Members%s%s", -+ "A new membership (" CS_PRI_RING_ID ") was formed. Members%s%s", - instance->my_ring_id.rep, -- instance->my_ring_id.seq, -+ (uint64_t)instance->my_ring_id.seq, - joined_node_msg, - left_node_msg); - -@@ -2313,15 +2313,14 @@ static void memb_state_recovery_enter ( - - for (i = 0; i < instance->my_trans_memb_entries; i++) { - log_printf (instance->totemsrp_log_level_debug, -- "TRANS [%d] member %u:", i, instance->my_trans_memb_list[i].nodeid); -+ "TRANS [%d] member " CS_PRI_NODE_ID ":", i, instance->my_trans_memb_list[i].nodeid); - } - for (i = 0; i < instance->my_new_memb_entries; i++) { - log_printf (instance->totemsrp_log_level_debug, -- "position [%d] member %u:", i, addr[i].nodeid); -+ "position [%d] member " CS_PRI_NODE_ID ":", i, addr[i].nodeid); - log_printf (instance->totemsrp_log_level_debug, -- "previous ring seq %llx rep %u", -- memb_list[i].ring_id.seq, -- memb_list[i].ring_id.rep); -+ "previous ringid (" CS_PRI_RING_ID ")", -+ memb_list[i].ring_id.rep, (uint64_t)memb_list[i].ring_id.seq); - - log_printf (instance->totemsrp_log_level_debug, - "aru %x high delivered %x received flag %d", -@@ -4292,9 +4291,9 @@ static int message_handler_mcast ( - } - - log_printf (instance->totemsrp_log_level_trace, -- "Received ringid(%u:%lld) seq %x", -+ "Received ringid (" CS_PRI_RING_ID ") seq %x", - mcast_header.ring_id.rep, -- mcast_header.ring_id.seq, -+ (uint64_t)mcast_header.ring_id.seq, - mcast_header.seq); - - /* -@@ -4423,20 +4422,20 @@ static void memb_join_process ( - if (instance->flushing) { - if (memb_join->header.nodeid == LEAVE_DUMMY_NODEID) { - log_printf (instance->totemsrp_log_level_warning, -- "Discarding LEAVE message during flush, nodeid=%u", -+ "Discarding LEAVE message during flush, nodeid=" CS_PRI_NODE_ID, - memb_join->failed_list_entries > 0 ? failed_list[memb_join->failed_list_entries - 1 ].nodeid : LEAVE_DUMMY_NODEID); - if (memb_join->failed_list_entries > 0) { - my_leave_memb_set(instance, failed_list[memb_join->failed_list_entries - 1 ].nodeid); - } - } else { - log_printf (instance->totemsrp_log_level_warning, -- "Discarding JOIN message during flush, nodeid=%d", memb_join->header.nodeid); -+ "Discarding JOIN message during flush, nodeid=" CS_PRI_NODE_ID, memb_join->header.nodeid); - } - return; - } else { - if (memb_join->header.nodeid == LEAVE_DUMMY_NODEID) { - log_printf (instance->totemsrp_log_level_debug, -- "Received LEAVE message from %u", memb_join->failed_list_entries > 0 ? failed_list[memb_join->failed_list_entries - 1 ].nodeid : LEAVE_DUMMY_NODEID); -+ "Received LEAVE message from " CS_PRI_NODE_ID, memb_join->failed_list_entries > 0 ? failed_list[memb_join->failed_list_entries - 1 ].nodeid : LEAVE_DUMMY_NODEID); - if (memb_join->failed_list_entries > 0) { - my_leave_memb_set(instance, failed_list[memb_join->failed_list_entries - 1 ].nodeid); - } -@@ -5064,9 +5063,9 @@ void main_iface_change_fn ( - instance->token_ring_id_seq = instance->my_ring_id.seq; - log_printf ( - instance->totemsrp_log_level_debug, -- "Created or loaded sequence id %llx.%u for this ring.", -- instance->my_ring_id.seq, -- instance->my_ring_id.rep); -+ "Created or loaded sequence id " CS_PRI_RING_ID " for this ring.", -+ instance->my_ring_id.rep, -+ (uint64_t)instance->my_ring_id.seq); - - if (instance->totemsrp_service_ready_fn) { - instance->totemsrp_service_ready_fn (); -diff --git a/exec/votequorum.c b/exec/votequorum.c -index 6c6e3b12..400c5180 100644 ---- a/exec/votequorum.c -+++ b/exec/votequorum.c -@@ -475,7 +475,7 @@ static struct cluster_node *allocate_node(unsigned int nodeid) - * this should never happen - */ - if (!cl) { -- log_printf(LOGSYS_LEVEL_CRIT, "Unable to find memory for node %u data!!", nodeid); -+ log_printf(LOGSYS_LEVEL_CRIT, "Unable to find memory for node " CS_PRI_NODE_ID " data!!", nodeid); - goto out; - } - qb_list_del(tmp); -@@ -538,7 +538,7 @@ static void get_lowest_node_id(void) - lowest_node_id = node->node_id; - } - } -- log_printf(LOGSYS_LEVEL_DEBUG, "lowest node id: %d us: %d", lowest_node_id, us->node_id); -+ log_printf(LOGSYS_LEVEL_DEBUG, "lowest node id: " CS_PRI_NODE_ID " us: " CS_PRI_NODE_ID, lowest_node_id, us->node_id); - icmap_set_uint32("runtime.votequorum.lowest_node_id", lowest_node_id); - - LEAVE(); -@@ -560,7 +560,7 @@ static void get_highest_node_id(void) - highest_node_id = node->node_id; - } - } -- log_printf(LOGSYS_LEVEL_DEBUG, "highest node id: %d us: %d", highest_node_id, us->node_id); -+ log_printf(LOGSYS_LEVEL_DEBUG, "highest node id: " CS_PRI_NODE_ID " us: " CS_PRI_NODE_ID, highest_node_id, us->node_id); - icmap_set_uint32("runtime.votequorum.highest_node_id", highest_node_id); - - LEAVE(); -@@ -664,7 +664,7 @@ static int check_auto_tie_breaker(void) - */ - for (j=0; jnode_id, node->state, node->votes, node->expected_votes); - - if (node->state == NODESTATE_MEMBER) { -@@ -1819,7 +1819,7 @@ static int votequorum_exec_send_nodelist_notification(void *conn, uint64_t conte - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "Sending nodelist callback. ring_id = %d/%lld", quorum_ringid.nodeid, quorum_ringid.seq); -+ log_printf(LOGSYS_LEVEL_DEBUG, "Sending nodelist callback. ring_id = " CS_PRI_RING_ID, quorum_ringid.nodeid, quorum_ringid.seq); - - size = sizeof(struct res_lib_votequorum_nodelist_notification) + sizeof(uint32_t) * quorum_members_entries; - -@@ -1897,7 +1897,7 @@ static void message_handler_req_exec_votequorum_qdevice_reconfigure ( - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "Received qdevice name change req from node %u [from: %s to: %s]", -+ log_printf(LOGSYS_LEVEL_DEBUG, "Received qdevice name change req from node " CS_PRI_NODE_ID " [from: %s to: %s]", - nodeid, - req_exec_quorum_qdevice_reconfigure->oldname, - req_exec_quorum_qdevice_reconfigure->newname); -@@ -1940,7 +1940,7 @@ static void message_handler_req_exec_votequorum_qdevice_reg ( - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "Received qdevice op %u req from node %u [%s]", -+ log_printf(LOGSYS_LEVEL_DEBUG, "Received qdevice op %u req from node " CS_PRI_NODE_ID " [%s]", - req_exec_quorum_qdevice_reg->operation, - nodeid, req_exec_quorum_qdevice_reg->qdevice_name); - -@@ -2052,8 +2052,8 @@ static void message_handler_req_exec_votequorum_nodeinfo ( - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "got nodeinfo message from cluster node %u", sender_nodeid); -- log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message[%u]: votes: %d, expected: %d flags: %d", -+ log_printf(LOGSYS_LEVEL_DEBUG, "got nodeinfo message from cluster node " CS_PRI_NODE_ID, sender_nodeid); -+ log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message[" CS_PRI_NODE_ID "]: votes: %d, expected: %d flags: %d", - nodeid, - req_exec_quorum_nodeinfo->votes, - req_exec_quorum_nodeinfo->expected_votes, -@@ -2174,7 +2174,7 @@ static void message_handler_req_exec_votequorum_reconfigure ( - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "got reconfigure message from cluster node %u for %u", -+ log_printf(LOGSYS_LEVEL_DEBUG, "got reconfigure message from cluster node " CS_PRI_NODE_ID " for " CS_PRI_NODE_ID, - nodeid, req_exec_quorum_reconfigure->nodeid); - - switch(req_exec_quorum_reconfigure->param) -@@ -2201,7 +2201,7 @@ static void message_handler_req_exec_votequorum_reconfigure ( - - case VOTEQUORUM_RECONFIG_PARAM_CANCEL_WFA: - update_wait_for_all_status(0); -- log_printf(LOGSYS_LEVEL_INFO, "wait_for_all_status reset by user on node %d.", -+ log_printf(LOGSYS_LEVEL_INFO, "wait_for_all_status reset by user on node " CS_PRI_NODE_ID ".", - req_exec_quorum_reconfigure->nodeid); - recalculate_quorum(0, 0); - -@@ -2551,7 +2551,7 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void * - - ENTER(); - -- log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node %u", conn, req_lib_votequorum_getinfo->nodeid); -+ log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node " CS_PRI_NODE_ID, conn, req_lib_votequorum_getinfo->nodeid); - - if (nodeid == VOTEQUORUM_QDEVICE_NODEID) { - nodeid = us->node_id; -@@ -2953,8 +2953,8 @@ static void message_handler_req_lib_votequorum_qdevice_poll (void *conn, - if (us->flags & NODE_FLAGS_QDEVICE_REGISTERED) { - if (!(req_lib_votequorum_qdevice_poll->ring_id.nodeid == quorum_ringid.nodeid && - req_lib_votequorum_qdevice_poll->ring_id.seq == quorum_ringid.seq)) { -- log_printf(LOGSYS_LEVEL_DEBUG, "Received poll ring id (%u.%"PRIu64") != last sync " -- "ring id (%u.%"PRIu64"). Ignoring poll call.", -+ log_printf(LOGSYS_LEVEL_DEBUG, "Received poll ring id (" CS_PRI_RING_ID ") != last sync " -+ "ring id (" CS_PRI_RING_ID "). Ignoring poll call.", - req_lib_votequorum_qdevice_poll->ring_id.nodeid, req_lib_votequorum_qdevice_poll->ring_id.seq, - quorum_ringid.nodeid, quorum_ringid.seq); - error = CS_ERR_MESSAGE_ERROR; -diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c -index f93eaf5b..f62ffa81 100644 ---- a/exec/vsf_quorum.c -+++ b/exec/vsf_quorum.c -@@ -122,7 +122,7 @@ static void log_view_list(const unsigned int *view_list, size_t view_list_entrie - memset(view_buf, 0, len); - - for (; i < total; i++) { -- ret = snprintf(view_buf + pos, len - pos, " %u", view_list[i]); -+ ret = snprintf(view_buf + pos, len - pos, " " CS_PRI_NODE_ID, view_list[i]); - if (ret >= len - pos) - break; - pos += ret; -diff --git a/include/corosync/corotypes.h b/include/corosync/corotypes.h -index c8ef1d43..12b61eb8 100644 ---- a/include/corosync/corotypes.h -+++ b/include/corosync/corotypes.h -@@ -56,6 +56,9 @@ typedef int64_t cs_time_t; - #define CS_TIME_END ((cs_time_t)0x7FFFFFFFFFFFFFFFULL) - #define CS_MAX(x, y) (((x) > (y)) ? (x) : (y)) - -+#define CS_PRI_NODE_ID "%" PRIu32 -+#define CS_PRI_RING_ID_SEQ "%" PRIx64 -+#define CS_PRI_RING_ID "%" PRIx32 ".%" PRIx64 - /** - * @brief The cs_name_t struct - */ -diff --git a/test/cpghum.c b/test/cpghum.c -index 3cc2119d..7c007d0c 100644 ---- a/test/cpghum.c -+++ b/test/cpghum.c -@@ -44,6 +44,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -249,7 +250,7 @@ static void cpg_bm_deliver_fn ( - unsigned int datalen; - - if (nodeid > MAX_NODEID) { -- cpgh_log_printf(CPGH_LOG_ERR, "Got message from invalid nodeid %d (too high for us). Quitting\n", nodeid); -+ cpgh_log_printf(CPGH_LOG_ERR, "Got message from invalid nodeid " CS_PRI_NODE_ID " (too high for us). Quitting\n", nodeid); - exit(1); - } - -@@ -280,7 +281,7 @@ static void cpg_bm_deliver_fn ( - // Basic check, packets should all be the right size - if (msg_len != header->size) { - length_errors++; -- cpgh_log_printf(CPGH_LOG_ERR, "%s: message sizes don't match. got %zu, expected %u from node %d\n", group_name->value, msg_len, header->size, nodeid); -+ cpgh_log_printf(CPGH_LOG_ERR, "%s: message sizes don't match. got %zu, expected %u from node " CS_PRI_NODE_ID "\n", group_name->value, msg_len, header->size, nodeid); - - if (abort_on_error) { - exit(2); -@@ -294,7 +295,7 @@ static void cpg_bm_deliver_fn ( - /* Don't report the first mismatch or a newly restarted sender, we're just catching up */ - if (g_recv_counter[nodeid] && header->counter) { - sequence_errors++; -- cpgh_log_printf(CPGH_LOG_ERR, "%s: counters don't match. got %d, expected %d from node %d\n", group_name->value, header->counter, g_recv_counter[nodeid], nodeid); -+ cpgh_log_printf(CPGH_LOG_ERR, "%s: counters don't match. got %d, expected %d from node " CS_PRI_NODE_ID "\n", group_name->value, header->counter, g_recv_counter[nodeid], nodeid); - - if (abort_on_error) { - exit(2); -@@ -316,7 +317,7 @@ static void cpg_bm_deliver_fn ( - crc = crc32(crc, (Bytef *)dataint, datalen) & 0xFFFFFFFF; - if (crc != recv_crc) { - crc_errors++; -- cpgh_log_printf(CPGH_LOG_ERR, "%s: CRCs don't match. got %lx, expected %lx from nodeid %d\n", group_name->value, recv_crc, crc, nodeid); -+ cpgh_log_printf(CPGH_LOG_ERR, "%s: CRCs don't match. got %lx, expected %lx from nodeid " CS_PRI_NODE_ID "\n", group_name->value, recv_crc, crc, nodeid); - - if (abort_on_error) { - exit(2); -@@ -750,7 +751,7 @@ int main (int argc, char *argv[]) { - if (!machine_readable) { - for (i=1; i - #include - #include -+#include - #include - #include - #include -@@ -52,7 +53,7 @@ static void deliver( - void *msg, - size_t msg_len) - { -- printf("self delivered nodeid: %x\n", nodeid); -+ printf("self delivered nodeid: " CS_PRI_NODE_ID "\n", nodeid); - } - - static void confch( -@@ -62,7 +63,7 @@ static void confch( - const struct cpg_address *left_list, size_t left_list_entries, - const struct cpg_address *joined_list, size_t joined_list_entries) - { -- printf("confchg nodeid %x\n", member_list[0].nodeid); -+ printf("confchg nodeid " CS_PRI_NODE_ID "\n", member_list[0].nodeid); - } - - int main(int argc, char** argv) { -@@ -78,7 +79,7 @@ int main(int argc, char** argv) { - printf ("All of the nodeids should match on a single node configuration\n for the test to pass."); - assert(CS_OK==cpg_initialize(&handle, &cb)); - assert(CS_OK==cpg_local_get(handle,&nodeid)); -- printf("local_get: %x\n", nodeid); -+ printf("local_get: " CS_PRI_NODE_ID "\n", nodeid); - assert(CS_OK==cpg_join(handle, &group)); - assert(CS_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1)); - cpg_fd_get (handle, &fd); -diff --git a/test/testcpgzc.c b/test/testcpgzc.c -index 2a6a9a81..6da36a1c 100644 ---- a/test/testcpgzc.c -+++ b/test/testcpgzc.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -80,7 +81,7 @@ static void DeliverCallback ( - inet_ntoa(saddr), pid, (const char *)msg); - } - else { -- printf("DeliverCallback: message (len=%lu)from node/pid %d/%d: '%s'\n", -+ printf("DeliverCallback: message (len=%lu)from node/pid " CS_PRI_NODE_ID "/%d: '%s'\n", - (unsigned long int) msg_len, nodeid, pid, - (const char *)msg); - } -@@ -107,7 +108,7 @@ static void ConfchgCallback ( - joined_list[i].reason); - } - else { -- printf("joined node/pid: %d/%d reason: %d\n", -+ printf("joined node/pid: " CS_PRI_NODE_ID "/%d reason: %d\n", - joined_list[i].nodeid, joined_list[i].pid, - joined_list[i].reason); - } -@@ -121,7 +122,7 @@ static void ConfchgCallback ( - left_list[i].reason); - } - else { -- printf("left node/pid: %d/%d reason: %d\n", -+ printf("left node/pid: " CS_PRI_NODE_ID "/%d reason: %d\n", - left_list[i].nodeid, left_list[i].pid, - left_list[i].reason); - } -@@ -136,7 +137,7 @@ static void ConfchgCallback ( - inet_ntoa (saddr), member_list[i].pid); - } - else { -- printf("node/pid: %d/%d\n", -+ printf("node/pid: " CS_PRI_NODE_ID "/%d\n", - member_list[i].nodeid, member_list[i].pid); - } - } -@@ -204,7 +205,7 @@ int main (int argc, char *argv[]) { - exit (1); - } - -- printf ("Local node id is %x\n", nodeid); -+ printf ("Local node id is " CS_PRI_NODE_ID "\n", nodeid); - result = cpg_join(handle, &group_name); - if (result != CS_OK) { - printf ("Could not join process group, error %d\n", result); -diff --git a/test/testquorum.c b/test/testquorum.c -index 52ae562e..ebcbf07c 100644 ---- a/test/testquorum.c -+++ b/test/testquorum.c -@@ -2,6 +2,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -21,11 +22,11 @@ static void quorum_notification_fn( - - printf("quorum notification called \n"); - printf(" quorate = %lu\n", (long unsigned int) quorate); -- printf(" ring id = %llu\n", (long long unsigned int) ring_id); -+ printf(" ring id = " CS_PRI_RING_ID_SEQ "\n", ring_id); - printf(" num nodes = %lu ", (long unsigned int) view_list_entries); - - for (i=0; i - #include - #include -+#include - #include - #include - #include -@@ -77,7 +78,7 @@ static void DeliverCallback ( - inet_ntoa(saddr), pid, (const char *)msg); - } - else { -- printf("DeliverCallback: message (len=%lu)from node/pid %d/%d: '%s'\n", -+ printf("DeliverCallback: message (len=%lu)from node/pid " CS_PRI_NODE_ID "/%d: '%s'\n", - (unsigned long int) msg_len, nodeid, pid, - (const char *)msg); - } -@@ -104,7 +105,7 @@ static void ConfchgCallback ( - joined_list[i].reason); - } - else { -- printf("joined node/pid: %d/%d reason: %d\n", -+ printf("joined node/pid: " CS_PRI_NODE_ID "/%d reason: %d\n", - joined_list[i].nodeid, joined_list[i].pid, - joined_list[i].reason); - } -@@ -118,7 +119,7 @@ static void ConfchgCallback ( - left_list[i].reason); - } - else { -- printf("left node/pid: %d/%d reason: %d\n", -+ printf("left node/pid: " CS_PRI_NODE_ID "/%d reason: %d\n", - left_list[i].nodeid, left_list[i].pid, - left_list[i].reason); - } -@@ -133,7 +134,7 @@ static void ConfchgCallback ( - inet_ntoa (saddr), member_list[i].pid); - } - else { -- printf("node/pid: %d/%d\n", -+ printf("node/pid: " CS_PRI_NODE_ID "/%d\n", - member_list[i].nodeid, member_list[i].pid); - } - } -diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c -index f51b9d41..57c120fc 100644 ---- a/tools/corosync-cfgtool.c -+++ b/tools/corosync-cfgtool.c -@@ -153,7 +153,7 @@ linkstatusget_do (char *interface_name, int brief) - printf ("Could not get the local node id, the error is: %d\n", result); - } - else { -- printf ("Local node ID %u\n", nodeid); -+ printf ("Local node ID " CS_PRI_NODE_ID "\n", nodeid); - } - - result = corosync_cfg_ring_status_get (handle, -@@ -350,7 +350,7 @@ static void killnode_do(unsigned int nodeid) - cs_error_t result; - corosync_cfg_handle_t handle; - -- printf ("Killing node %d\n", nodeid); -+ printf ("Killing node " CS_PRI_NODE_ID "\n", nodeid); - result = corosync_cfg_initialize (&handle, NULL); - if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); -diff --git a/tools/corosync-notifyd.c b/tools/corosync-notifyd.c -index 6338fe04..dfc1c429 100644 ---- a/tools/corosync-notifyd.c -+++ b/tools/corosync-notifyd.c -@@ -249,7 +249,7 @@ static void _cs_cmap_members_key_changed ( - - res = snprintf(tmp_key, CMAP_KEYNAME_MAXLEN, "runtime.members.%u.ip", nodeid); - if (res <= 0 || res >= CMAP_KEYNAME_MAXLEN) { -- qb_log(LOG_ERR, "temp_key: failed, res: %d, nodeid: %u", res, nodeid); -+ qb_log(LOG_ERR, "temp_key: failed, res: %d, nodeid: " CS_PRI_NODE_ID, res, nodeid); - return ; - } - no_retries = 0; -@@ -965,16 +965,16 @@ _cs_snmp_init(void) - static void - _cs_syslog_node_membership_event(char *nodename, uint32_t nodeid, char *state, char* ip) - { -- qb_log(LOG_NOTICE, "%s[%d] ip:%s %s", nodename, nodeid, ip, state); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] ip:%s %s", nodename, nodeid, ip, state); - } - - static void - _cs_syslog_node_quorum_event(char *nodename, uint32_t nodeid, const char *state) - { - if (strcmp(state, "quorate") == 0) { -- qb_log(LOG_NOTICE, "%s[%d] is now %s", nodename, nodeid, state); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] is now %s", nodename, nodeid, state); - } else { -- qb_log(LOG_NOTICE, "%s[%d] has lost quorum", nodename, nodeid); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] has lost quorum", nodename, nodeid); - } - } - -@@ -982,16 +982,16 @@ static void - _cs_syslog_application_connection_event(char *nodename, uint32_t nodeid, char* app_name, const char *state) - { - if (strcmp(state, "connected") == 0) { -- qb_log(LOG_NOTICE, "%s[%d] %s is now %s to corosync", nodename, nodeid, app_name, state); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] %s is now %s to corosync", nodename, nodeid, app_name, state); - } else { -- qb_log(LOG_NOTICE, "%s[%d] %s is now %s from corosync", nodename, nodeid, app_name, state); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] %s is now %s from corosync", nodename, nodeid, app_name, state); - } - } - - static void - _cs_syslog_link_faulty_event(char *nodename, uint32_t our_nodeid, uint32_t nodeid, uint32_t iface_no, const char *state) - { -- qb_log(LOG_NOTICE, "%s[%d] link %u to node %u is now %s", nodename, our_nodeid, iface_no, nodeid, state); -+ qb_log(LOG_NOTICE, "%s[" CS_PRI_NODE_ID "] link %u to node " CS_PRI_NODE_ID " is now %s", nodename, our_nodeid, iface_no, nodeid, state); - } - - static void -diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c -index 48199519..baaa4472 100644 ---- a/tools/corosync-quorumtool.c -+++ b/tools/corosync-quorumtool.c -@@ -236,7 +236,7 @@ static int set_votes(uint32_t nodeid, int votes) - int err; - - if ((err=votequorum_setvotes(v_handle, nodeid, votes)) != CS_OK) { -- fprintf(stderr, "Unable to set votes %d for nodeid: %u: %s\n", -+ fprintf(stderr, "Unable to set votes %d for nodeid: " CS_PRI_NODE_ID ": %s\n", - votes, nodeid, cs_strerror(err)); - } - -@@ -340,7 +340,7 @@ static const char *node_name(uint32_t nodeid, name_format_t name_format) - - err = corosync_cfg_get_node_addrs(c_handle, nodeid, INTERFACE_MAX, &numaddrs, addrs); - if (err != CS_OK) { -- fprintf(stderr, "Unable to get node address for nodeid %u: %s\n", nodeid, cs_strerror(err)); -+ fprintf(stderr, "Unable to get node address for nodeid " CS_PRI_NODE_ID ": %s\n", nodeid, cs_strerror(err)); - return ""; - } - -@@ -473,7 +473,7 @@ static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name - if (v_handle) { - for (i=0; i < g_view_list_entries; i++) { - if (votequorum_getinfo(v_handle, g_view_list[i].node_id, &info[i]) != CS_OK) { -- printf("Unable to get node %u info\n", g_view_list[i].node_id); -+ printf("Unable to get node " CS_PRI_NODE_ID " info\n", g_view_list[i].node_id); - } - g_view_list[i].vq_info = &info[i]; - if (info[i].flags & VOTEQUORUM_INFO_QDEVICE_REGISTERED) { -@@ -600,16 +600,16 @@ static int display_quorum_data(int is_quorate, - printf("Quorum provider: %s\n", quorumtype); - printf("Nodes: %d\n", g_view_list_entries); - if (nodeid_format == NODEID_FORMAT_DECIMAL) { -- printf("Node ID: %u\n", our_nodeid); -+ printf("Node ID: " CS_PRI_NODE_ID "\n", our_nodeid); - } else { - printf("Node ID: 0x%08x\n", our_nodeid); - } - - if (v_handle) { -- printf("Ring ID: %d/%" PRIu64 "\n", g_ring_id_rep_node, g_ring_id); -+ printf("Ring ID: " CS_PRI_RING_ID "\n", g_ring_id_rep_node, g_ring_id); - } - else { -- printf("Ring ID: %" PRIu64 "\n", g_ring_id); -+ printf("Ring ID: " CS_PRI_RING_ID_SEQ "\n", g_ring_id); - } - printf("Quorate: %s\n", is_quorate?"Yes":"No"); - -diff --git a/vqsim/vqmain.c b/vqsim/vqmain.c -index 25d0fad5..e42ce9fd 100644 ---- a/vqsim/vqmain.c -+++ b/vqsim/vqmain.c -@@ -117,19 +117,19 @@ static void print_quorum_state(struct vq_node *node) - int i; - - if (node->last_quorate < 0) { -- fprintf(output_file, "%d:%02d: q=UNINITIALIZED\n", -+ fprintf(output_file, "%d:" CS_PRI_NODE_ID ": q=UNINITIALIZED\n", - node->partition->num, node->nodeid); - return; - } - -- fprintf(output_file, "%d:%02d: q=%d ring=[%d/%lld] ", node->partition->num, node->nodeid, node->last_quorate, -- node->last_ring_id.nodeid, node->last_ring_id.seq); -+ fprintf(output_file, "%d:" CS_PRI_NODE_ID ": q=%d ring=[" CS_PRI_RING_ID "] ", node->partition->num, node->nodeid, node->last_quorate, -+ node->last_ring_id.nodeid, (uint64_t)node->last_ring_id.seq); - fprintf(output_file, "nodes=["); - for (i = 0; i < node->last_view_list_entries; i++) { - if (i) { - fprintf(output_file, " "); - } -- fprintf(output_file, "%d", node->last_view_list[i]); -+ fprintf(output_file, CS_PRI_NODE_ID, node->last_view_list[i]); - } - fprintf(output_file, "]\n"); - -@@ -265,7 +265,7 @@ static int vq_parent_read_fn(int32_t fd, int32_t revents, void *data) - } - } - if (revents == POLLERR) { -- fprintf(stderr, "pollerr on %d\n", vqn->nodeid); -+ fprintf(stderr, "pollerr on " CS_PRI_NODE_ID "\n", vqn->nodeid); - } - return 0; - } -@@ -342,7 +342,7 @@ static int32_t sigchld_handler(int32_t sig, void *data) - sprintf(text, "(exit code %d)", WEXITSTATUS(status)); - break; - } -- printf("%d:%02d: Quit %s\n", vqn->partition->num, vqn->nodeid, exit_status); -+ printf("%d:" CS_PRI_NODE_ID ": Quit %s\n", vqn->partition->num, vqn->nodeid, exit_status); - - remove_node(vqn); - } -@@ -353,7 +353,7 @@ static int32_t sigchld_handler(int32_t sig, void *data) - if (WIFSIGNALED(status)) { - vqn = find_by_pid(pid); - if (vqn) { -- printf("%d:%02d exited on signal %d%s\n", vqn->partition->num, vqn->nodeid, WTERMSIG(status), WCOREDUMP(status)?" (core dumped)":""); -+ printf("%d:" CS_PRI_NODE_ID " exited on signal %d%s\n", vqn->partition->num, vqn->nodeid, WTERMSIG(status), WCOREDUMP(status)?" (core dumped)":""); - remove_node(vqn); - } - else { -@@ -411,7 +411,7 @@ static pid_t create_node(int nodeid, int partno) - newvq->instance = vq_create_instance(poll_loop, nodeid); - if (!newvq->instance) { - fprintf(stderr, -- "ERR: could not create vq instance nodeid %d\n", -+ "ERR: could not create vq instance nodeid " CS_PRI_NODE_ID "\n", - nodeid); - free(newvq); - return (pid_t) -1; -@@ -467,7 +467,7 @@ static size_t create_nodes_from_config(void) - pid = create_node(nodeid, 0); - if (pid == (pid_t) -1) { - fprintf(stderr, -- "ERR: nodeid %d could not be spawned\n", -+ "ERR: nodeid " CS_PRI_NODE_ID " could not be spawned\n", - nodeid); - exit(1); - } -@@ -537,7 +537,7 @@ int cmd_start_new_node(int nodeid, int partition) - - node = find_node(nodeid); - if (node) { -- fprintf(stderr, "ERR: nodeid %d already exists in partition %d\n", nodeid, node->partition->num); -+ fprintf(stderr, "ERR: nodeid " CS_PRI_NODE_ID " already exists in partition %d\n", nodeid, node->partition->num); - return -1; - } - if (create_node(nodeid, partition) == -1) { -@@ -577,7 +577,7 @@ int cmd_stop_node(int nodeid) - - node = find_node(nodeid); - if (!node) { -- fprintf(stderr, "ERR: nodeid %d is not up\n", nodeid); -+ fprintf(stderr, "ERR: nodeid " CS_PRI_NODE_ID " is not up\n", nodeid); - return -1; - } - -@@ -613,7 +613,7 @@ void cmd_move_nodes(int partition, int num_nodes, int *nodelist) - node->partition = &partitions[partition]; - } - else { -- printf("ERR: node %d does not exist\n", nodelist[i]); -+ printf("ERR: node " CS_PRI_NODE_ID " does not exist\n", nodelist[i]); - } - } - } -diff --git a/vqsim/vqsim_vq_engine.c b/vqsim/vqsim_vq_engine.c -index b8460f39..e0bb0bd8 100644 ---- a/vqsim/vqsim_vq_engine.c -+++ b/vqsim/vqsim_vq_engine.c -@@ -313,7 +313,7 @@ static int poll_qdevice(int onoff) - - res = send_lib_msg(MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL, &pollmsg); - if (res != CS_OK) { -- fprintf(stderr, "%d: qdevice poll failed: %d\n", our_nodeid, res); -+ fprintf(stderr, CS_PRI_NODE_ID ": qdevice poll failed: %d\n", our_nodeid, res); - } - return res; - } -@@ -362,7 +362,7 @@ static void do_qdevice(int onoff) - start_qdevice_poll(1); - } - else { -- fprintf(stderr, "%d: qdevice registration failed: %d\n", our_nodeid, res); -+ fprintf(stderr, CS_PRI_NODE_ID ": qdevice registration failed: %d\n", our_nodeid, res); - } - } - else { diff --git a/debian/patches/0011-totemknet-Add-locking-for-log-call.patch b/debian/patches/0011-totemknet-Add-locking-for-log-call.patch deleted file mode 100644 index 0d29c8e..0000000 --- a/debian/patches/0011-totemknet-Add-locking-for-log-call.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Mon, 9 Sep 2019 17:47:24 +0200 -Subject: [PATCH] totemknet: Add locking for log call - -Knet callbacks may be called from different thread than main thread. If -this happens, log messages may be lost. Most prominent example is when -link goes up (logged by main thread) and host_change_callback_fn is -called. - -Implemented solution is adding mutex for every log call in totemknet. - -Signed-off-by: Jan Friesse -Reviewed-by: Fabio M. Di Nitto -(cherry picked from commit 1cf1558fe745de0f81147ca33ea1f27ac152308d) -Signed-off-by: Thomas Lamprecht ---- - exec/totemknet.c | 30 +++++++++++++++++++++++++++--- - 1 file changed, 27 insertions(+), 3 deletions(-) - -diff --git a/exec/totemknet.c b/exec/totemknet.c -index 38b69e7b..a372ea75 100644 ---- a/exec/totemknet.c -+++ b/exec/totemknet.c -@@ -51,6 +51,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -171,6 +172,8 @@ struct totemknet_instance { - - int logpipes[2]; - int knet_fd; -+ -+ pthread_mutex_t log_mutex; - #ifdef HAVE_LIBNOZZLE - char *nozzle_name; - char *nozzle_ipaddr; -@@ -203,20 +206,36 @@ static void log_flush_messages ( - - static void totemknet_instance_initialize (struct totemknet_instance *instance) - { -+ int res; -+ - memset (instance, 0, sizeof (struct totemknet_instance)); -+ res = pthread_mutex_init(&instance->log_mutex, NULL); -+ /* -+ * There is not too much else what can be done. -+ */ -+ assert(res == 0); - } - -+#define knet_log_printf_lock(level, subsys, function, file, line, format, args...) \ -+do { \ -+ (void)pthread_mutex_lock(&instance->log_mutex); \ -+ instance->totemknet_log_printf ( \ -+ level, subsys, function, file, line, \ -+ (const char *)format, ##args); \ -+ (void)pthread_mutex_unlock(&instance->log_mutex); \ -+} while (0); -+ - #define knet_log_printf(level, format, args...) \ - do { \ -- instance->totemknet_log_printf ( \ -+ knet_log_printf_lock ( \ - level, instance->totemknet_subsys_id, \ - __FUNCTION__, __FILE__, __LINE__, \ - (const char *)format, ##args); \ - } while (0); - --#define libknet_log_printf(level, format, args...) \ -+#define libknet_log_printf(level, format, args...) \ - do { \ -- instance->totemknet_log_printf ( \ -+ knet_log_printf_lock ( \ - level, instance->knet_subsys_id, \ - __FUNCTION__, "libknet.h", __LINE__, \ - (const char *)format, ##args); \ -@@ -603,6 +622,11 @@ finalise_error: - - log_flush_messages(instance); - -+ /* -+ * Error is deliberately ignored -+ */ -+ (void)pthread_mutex_destroy(&instance->log_mutex); -+ - return (res); - } - diff --git a/debian/patches/0012-totempg-Check-sanity-length-of-received-message.patch b/debian/patches/0012-totempg-Check-sanity-length-of-received-message.patch deleted file mode 100644 index 8ba9f03..0000000 --- a/debian/patches/0012-totempg-Check-sanity-length-of-received-message.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Thu, 3 Oct 2019 11:35:37 +0200 -Subject: [PATCH] totempg: Check sanity (length) of received message - -Signed-off-by: Jan Friesse -Signed-off-by: Thomas Lamprecht ---- - exec/totempg.c | 32 ++++++++++++++++++++++++++++++-- - 1 file changed, 30 insertions(+), 2 deletions(-) - -diff --git a/exec/totempg.c b/exec/totempg.c -index 6b3c590d..e251c236 100644 ---- a/exec/totempg.c -+++ b/exec/totempg.c -@@ -603,10 +603,18 @@ static void totempg_deliver_fn ( - const char *data; - int datasize; - struct iovec iov_delv; -+ size_t expected_msg_len; - - assembly = assembly_ref (nodeid); - assert (assembly); - -+ if (msg_len < sizeof(struct totempg_mcast)) { -+ log_printf(LOG_WARNING, -+ "Message (totempg_mcast) received from node " CS_PRI_NODE_ID " is too short... Ignoring.", nodeid); -+ -+ return ; -+ } -+ - /* - * Assemble the header into one block of data and - * assemble the packet contents into one block of data to simplify delivery -@@ -621,14 +629,34 @@ static void totempg_deliver_fn ( - datasize = sizeof (struct totempg_mcast) + - msg_count * sizeof (unsigned short); - -+ if (msg_len < datasize) { -+ log_printf(LOG_WARNING, -+ "Message (totempg_mcast datasize) received from node " CS_PRI_NODE_ID -+ " is too short... Ignoring.", nodeid); -+ -+ return ; -+ } -+ - memcpy (header, msg, datasize); - data = msg; - - msg_lens = (unsigned short *) (header + sizeof (struct totempg_mcast)); -- if (endian_conversion_required) { -- for (i = 0; i < mcast->msg_count; i++) { -+ expected_msg_len = datasize; -+ for (i = 0; i < mcast->msg_count; i++) { -+ if (endian_conversion_required) { - msg_lens[i] = swab16 (msg_lens[i]); - } -+ -+ expected_msg_len += msg_lens[i]; -+ } -+ -+ if (msg_len != expected_msg_len) { -+ log_printf(LOG_WARNING, -+ "Message (totempg_mcast) received from node " CS_PRI_NODE_ID -+ " doesn't have expected length of %zu (has %u) bytes... Ignoring.", -+ nodeid, expected_msg_len, msg_len); -+ -+ return ; - } - - assert((assembly->index+msg_len) < sizeof(assembly->data)); diff --git a/debian/patches/0013-totemsrp-Reduce-MTU-to-left-room-second-mcast.patch b/debian/patches/0013-totemsrp-Reduce-MTU-to-left-room-second-mcast.patch deleted file mode 100644 index eecc2d3..0000000 --- a/debian/patches/0013-totemsrp-Reduce-MTU-to-left-room-second-mcast.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Mon, 7 Oct 2019 15:26:22 +0200 -Subject: [PATCH] totemsrp: Reduce MTU to left room second mcast - -Messages sent during recovery phase are encapsulated so such message has -extra size of mcast structure. This is not so big problem for UDPU, -because most of the switches are able to fragment and defragment packet -but it is problem for knet, because totempg is using maximum packet size -(65536 bytes) and when another header is added during retransmition, -then packet is too large. - -Solution is to reduce mtu by 2 * sizeof (struct mcast). - -Signed-off-by: Jan Friesse -Reviewed-by: Fabio M. Di Nitto -(cherry picked from commit ee8b8993d98b3f6af9c058194228fc534fcd0796) -Signed-off-by: Thomas Lamprecht ---- - exec/totemsrp.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/exec/totemsrp.c b/exec/totemsrp.c -index e988c531..9ea3d689 100644 ---- a/exec/totemsrp.c -+++ b/exec/totemsrp.c -@@ -805,7 +805,7 @@ static void totempg_mtu_changed(void *context, int net_mtu) - { - struct totemsrp_instance *instance = context; - -- instance->totem_config->net_mtu = net_mtu - sizeof (struct mcast); -+ instance->totem_config->net_mtu = net_mtu - 2 * sizeof (struct mcast); - - log_printf (instance->totemsrp_log_level_debug, - "Net MTU changed to %d, new value is %d", -@@ -5092,7 +5092,7 @@ void main_iface_change_fn ( - } - - void totemsrp_net_mtu_adjust (struct totem_config *totem_config) { -- totem_config->net_mtu -= sizeof (struct mcast); -+ totem_config->net_mtu -= 2 * sizeof (struct mcast); - } - - void totemsrp_service_ready_register ( diff --git a/debian/patches/series b/debian/patches/series index 67eb942..fd3a2f0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,13 +1,2 @@ 0001-Enable-PrivateTmp-in-the-systemd-service-files.patch 0002-only-start-corosync.service-if-conf-exists.patch -0003-cpg-notify_lib_joinlist-drop-conn-parameter.patch -0004-cpg-send-single-confchg-event-per-group-on-joinlist.patch -0005-cpg-Add-more-comments-to-notify_lib_joinlist.patch -0006-cpg-Move-filling-of-member_list-to-subfunction.patch -0007-totem-fix-check-if-all-nodes-have-name-attrs-in-mult.patch -0008-totem-fix-check-if-all-nodes-have-same-number-of-lin.patch -0009-totemknet-Disable-forwarding-on-shutdown.patch -0010-logging-Add-CS_PRI_NODE_ID-and-CS_PRI_RING_ID.patch -0011-totemknet-Add-locking-for-log-call.patch -0012-totempg-Check-sanity-length-of-received-message.patch -0013-totemsrp-Reduce-MTU-to-left-room-second-mcast.patch diff --git a/upstream b/upstream index 0390200..1ba03a3 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 0390200dd427d1d3e75bba8584dbfbb794b52b49 +Subproject commit 1ba03a3816212aa7c74196dc1b9b530c7184f5e1