diff --git a/SOURCES/0005-dlm_tool-fix-status-printing-in-libdlmcontrol.patch b/SOURCES/0005-dlm_tool-fix-status-printing-in-libdlmcontrol.patch new file mode 100644 index 0000000..7af9ce1 --- /dev/null +++ b/SOURCES/0005-dlm_tool-fix-status-printing-in-libdlmcontrol.patch @@ -0,0 +1,143 @@ +From 090026f33031c1b46dfe3e2e077c6cb0aa149378 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 12 Feb 2014 12:09:10 -0600 +Subject: [PATCH 5/9] dlm_tool: fix status printing in libdlmcontrol + +When a node was both a startup node and a normal node, +then status would segfault. + +Signed-off-by: David Teigland +--- + dlm_controld/lib.c | 67 +++++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 54 insertions(+), 13 deletions(-) + +diff --git a/dlm_controld/lib.c b/dlm_controld/lib.c +index 961626f090ca..efb74e00638f 100644 +--- a/dlm_controld/lib.c ++++ b/dlm_controld/lib.c +@@ -337,12 +337,19 @@ int dlmc_print_status(uint32_t flags) + struct dlmc_state *st; + char maxstr[DLMC_STATE_MAXSTR]; + char maxbin[DLMC_STATE_MAXBIN]; +- char *str, *bin; +- int all_count, node_count, fence_count; +- int all_ids[MAX_SORT], node_ids[MAX_SORT], fence_ids[MAX_SORT]; +- char *node_lines[MAX_SORT], *fence_lines[MAX_SORT]; +- char *node_line, *fence_line; +- int fd, rv, off; ++ char *str; ++ char *bin; ++ int all_count, node_count, fence_count, startup_count; ++ int all_ids[MAX_SORT]; ++ int node_ids[MAX_SORT]; ++ int fence_ids[MAX_SORT]; ++ int startup_ids[MAX_SORT]; ++ char *node_lines[MAX_SORT]; ++ char *fence_lines[MAX_SORT]; ++ char *node_line; ++ char *fence_line; ++ int found_node; ++ int fd, rv; + int i, j; + + init_header(&h, DLMC_CMD_DUMP_STATUS, NULL, 0); +@@ -363,14 +370,15 @@ int dlmc_print_status(uint32_t flags) + st = &state; + str = maxstr; + bin = maxbin; +- off = 0; + + all_count = 0; + node_count = 0; + fence_count = 0; ++ startup_count = 0; + memset(&all_ids, 0, sizeof(all_ids)); + memset(&node_ids, 0, sizeof(node_ids)); + memset(&fence_ids, 0, sizeof(fence_ids)); ++ memset(&startup_ids, 0, sizeof(startup_ids)); + memset(node_lines, 0, sizeof(node_lines)); + memset(fence_lines, 0, sizeof(fence_lines)); + +@@ -402,9 +410,11 @@ int dlmc_print_status(uint32_t flags) + print_daemon(st, str, bin, flags); + break; + +- case DLMC_STATE_DAEMON_NODE: + case DLMC_STATE_STARTUP_NODE: ++ startup_ids[startup_count++] = st->nodeid; ++ break; + ++ case DLMC_STATE_DAEMON_NODE: + if (flags & DLMC_STATUS_VERBOSE) { + printf("nodeid %d\n", st->nodeid); + print_str(str, st->str_len); +@@ -426,7 +436,7 @@ int dlmc_print_status(uint32_t flags) + all_ids[all_count++] = st->nodeid; + + node_ids[node_count] = st->nodeid; +- node_lines[node_count++] = node_line; ++ node_lines[node_count] = node_line; + node_count++; + + if (!fence_line[0]) { +@@ -450,13 +460,39 @@ int dlmc_print_status(uint32_t flags) + if (all_count) + qsort(all_ids, all_count, sizeof(int), nodeid_compare); + ++ /* don't free any node_lines in this startup loop because we are just ++ borrowing them; they are needed in the real node loop below. */ ++ ++ if (startup_count) { ++ for (i = 0; i < startup_count; i++) { ++ found_node = 0; ++ for (j = 0; j < node_count; j++) { ++ if (startup_ids[i] != node_ids[j]) ++ continue; ++ found_node = 1; ++ if (!node_lines[j]) ++ printf("startup node %d\n", st->nodeid); ++ else ++ printf("startup %s", node_lines[j]); ++ break; ++ } ++ if (!found_node) ++ printf("startup node %d\n", st->nodeid); ++ } ++ } ++ + if (all_count && fence_count) { + for (i = 0; i < all_count; i++) { + for (j = 0; j < fence_count; j++) { + if (all_ids[i] != fence_ids[j]) + continue; +- printf("%s", fence_lines[j]); +- free(fence_lines[j]); ++ if (!fence_lines[j]) { ++ printf("fence %d no data\n", fence_ids[j]); ++ } else { ++ printf("%s", fence_lines[j]); ++ free(fence_lines[j]); ++ fence_lines[j] = NULL; ++ } + break; + } + } +@@ -467,8 +503,13 @@ int dlmc_print_status(uint32_t flags) + for (j = 0; j < node_count; j++) { + if (all_ids[i] != node_ids[j]) + continue; +- printf("%s", node_lines[j]); +- free(node_lines[j]); ++ if (!node_lines[j]) { ++ printf("node %d no data\n", node_ids[j]); ++ } else { ++ printf("%s", node_lines[j]); ++ free(node_lines[j]); ++ node_lines[j] = NULL; ++ } + break; + } + } +-- +1.8.3.1 + diff --git a/SOURCES/0008-dlm-clear-out-addrs-before-calling-into-corosync_cft.patch b/SOURCES/0008-dlm-clear-out-addrs-before-calling-into-corosync_cft.patch new file mode 100644 index 0000000..7b0b977 --- /dev/null +++ b/SOURCES/0008-dlm-clear-out-addrs-before-calling-into-corosync_cft.patch @@ -0,0 +1,40 @@ +From 54a5a6b7137c9f6e969bde8f0245a5bc3465536c Mon Sep 17 00:00:00 2001 +From: Christine Caulfield +Date: Tue, 9 Sep 2014 09:29:01 +0100 +Subject: [PATCH 8/8] dlm: clear out addrs before calling into + corosync_cft_get_node_addrs() + +The corosync_cfg_get_node_addrs() call does not fill the whole of the +addrs field passed in, specifically it only writes the the address +family and IP address, leaving the port number untouched. + +If the port number contains junk, then that can get passed into the +kernel by dlm_controld where it is subsequently used in the comparison +that checks for valid cluster nodes in a connection. If this happens +then an otherwise valid connection can be rejected and the dlm will +hang. + +I've seen this quite often on s390 but I don't see any reason why it +might not also be causing intermittent connection problems on other +archs. + +Signed-off-by: Christine Caulfield +--- + dlm_controld/member.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dlm_controld/member.c b/dlm_controld/member.c +index d4031ee7a948..10351ec41d6d 100644 +--- a/dlm_controld/member.c ++++ b/dlm_controld/member.c +@@ -132,6 +132,7 @@ static void quorum_callback(quorum_handle_t h, uint32_t quorate, + + quorum_node_count = 0; + memset(&quorum_nodes, 0, sizeof(quorum_nodes)); ++ memset(&addrs, 0, sizeof(addrs)); + + for (i = 0; i < node_list_entries; i++) + quorum_nodes[quorum_node_count++] = node_list[i]; +-- +1.8.3.1 + diff --git a/SPECS/dlm.spec b/SPECS/dlm.spec index aa7de20..4aab87d 100644 --- a/SPECS/dlm.spec +++ b/SPECS/dlm.spec @@ -1,6 +1,6 @@ Name: dlm Version: 4.0.2 -Release: 3%{?dist} +Release: 5%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ # For a breakdown of the licensing, see README.license Group: System Environment/Kernel @@ -17,9 +17,11 @@ Source0: http://git.fedorahosted.org/cgit/dlm.git/snapshot/%{name}-%{vers Patch0: 0001-dlm_stonith-add-man-page.patch Patch1: 0002-dlm_stonith-install-man-page.patch Patch2: 0003-libdlm-udev-dir-now-under-usr-lib.patch +Patch3: 0005-dlm_tool-fix-status-printing-in-libdlmcontrol.patch +Patch4: 0008-dlm-clear-out-addrs-before-calling-into-corosync_cft.patch %if 0%{?rhel} -ExclusiveArch: i686 x86_64 +ExclusiveArch: i686 x86_64 s390x %endif Requires: %{name}-lib = %{version}-%{release} @@ -39,6 +41,8 @@ The kernel dlm requires a user daemon to control membership. %patch0 -p1 -b .0001-dlm_stonith-add-man-page.patch %patch1 -p1 -b .0002-dlm_stonith-install-man-page.patch %patch2 -p1 -b .0003-libdlm-udev-dir-now-under-usr-lib.patch +%patch3 -p1 -b .0005-dlm_tool-fix-status-printing-in-libdlmcontrol.patch +%patch4 -p1 -b .0008-dlm-clear-out-addrs-before-calling-into-corosync_cft.patch %build # upstream does not require configure @@ -110,6 +114,12 @@ developing applications that use %{name}. %{_libdir}/pkgconfig/*.pc %changelog +* Mon Nov 17 2014 David Teigland - 4.0.2-5 +- dlm_tool: fix status printing in libdlmcontrol + +* Fri Sep 12 2014 David Teigland - 4.0.2-4 +- Enable s390x, fix non-zeroed addrs + * Fri Dec 27 2013 Daniel Mach - 4.0.2-3 - Mass rebuild 2013-12-27