From f46b0e608f55b4711d83ff7333b0d17229549c48 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:27:03 +0000 Subject: import sbd-1.3.0-3.el7 --- diff --git a/.gitignore b/.gitignore index 0ae94f4..3557e32 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/sbd-c511b0692784a7085df4b1ae35748fb318fa79ee.tar.gz +SOURCES/sbd-4968e9c8602fbb990bed63cc96ca18f62e2181db.tar.gz diff --git a/.sbd.metadata b/.sbd.metadata index 3092fb1..130a3ea 100644 --- a/.sbd.metadata +++ b/.sbd.metadata @@ -1 +1 @@ -17b4eb4eec962dddd7991d49f9977052032ccb40 SOURCES/sbd-c511b0692784a7085df4b1ae35748fb318fa79ee.tar.gz +426030d298980a22785f502439973ff86ea68019 SOURCES/sbd-4968e9c8602fbb990bed63cc96ca18f62e2181db.tar.gz diff --git a/SOURCES/01-Fix-sbd-inquisitor-Correctly-look-up-servant-by-devi.patch b/SOURCES/01-Fix-sbd-inquisitor-Correctly-look-up-servant-by-devi.patch new file mode 100644 index 0000000..b3255a7 --- /dev/null +++ b/SOURCES/01-Fix-sbd-inquisitor-Correctly-look-up-servant-by-devi.patch @@ -0,0 +1,25 @@ +From bd4e73b0da7d5567f7d0d3639a1b72af8190f022 Mon Sep 17 00:00:00 2001 +From: "Gao,Yan" +Date: Thu, 1 Jun 2017 13:42:36 +0200 +Subject: [PATCH] Fix: sbd-inquisitor: Correctly look up servant by device name + +--- + src/sbd-inquisitor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c +index 30be8b2..cd7d914 100644 +--- a/src/sbd-inquisitor.c ++++ b/src/sbd-inquisitor.c +@@ -104,7 +104,7 @@ struct servants_list_item *lookup_servant_by_dev(const char *devname) + struct servants_list_item *s; + + for (s = servants_leader; s; s = s->next) { +- if (strncasecmp(s->devname, devname, strlen(s->devname))) ++ if (strcasecmp(s->devname, devname) == 0) + break; + } + return s; +-- +1.8.3.1 + diff --git a/SOURCES/02-Fix-sbd-inquisitor-Do-not-create-duplicate-servants.patch b/SOURCES/02-Fix-sbd-inquisitor-Do-not-create-duplicate-servants.patch new file mode 100644 index 0000000..3256a06 --- /dev/null +++ b/SOURCES/02-Fix-sbd-inquisitor-Do-not-create-duplicate-servants.patch @@ -0,0 +1,28 @@ +From 35b4f310dedd95c5e24b1473b73de194a3fe3f3e Mon Sep 17 00:00:00 2001 +From: "Gao,Yan" +Date: Thu, 1 Jun 2017 14:26:10 +0200 +Subject: [PATCH] Fix: sbd-inquisitor: Do not create duplicate servants + +--- + src/sbd-inquisitor.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c +index cd7d914..b82e6e8 100644 +--- a/src/sbd-inquisitor.c ++++ b/src/sbd-inquisitor.c +@@ -50,6 +50,11 @@ void recruit_servant(const char *devname, pid_t pid) + struct servants_list_item *s = servants_leader; + struct servants_list_item *newbie; + ++ if (lookup_servant_by_dev(devname)) { ++ cl_log(LOG_DEBUG, "Servant %s already exists", devname); ++ return; ++ } ++ + newbie = malloc(sizeof(*newbie)); + if (!newbie) { + fprintf(stderr, "malloc failed in recruit_servant.\n"); +-- +1.8.3.1 + diff --git a/SOURCES/03-Fix-cluster-servant-check-for-corosync-2Node-mode.patch b/SOURCES/03-Fix-cluster-servant-check-for-corosync-2Node-mode.patch new file mode 100644 index 0000000..3b67bb6 --- /dev/null +++ b/SOURCES/03-Fix-cluster-servant-check-for-corosync-2Node-mode.patch @@ -0,0 +1,243 @@ +From b39f25de0d7d6eed8757ce1076125c8b32854c8d Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Wed, 7 Jun 2017 06:14:23 +0200 +Subject: [PATCH] Fix: cluster-servant: check for corosync 2Node mode + +--- + configure.ac | 7 ++- + src/sbd-cluster.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 153 insertions(+), 9 deletions(-) + +diff --git a/configure.ac b/configure.ac +index a7e3e70..5be16fe 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -32,6 +32,8 @@ AM_PROG_CC_C_O + PKG_CHECK_MODULES(glib, [glib-2.0]) + dnl PKG_CHECK_MODULES(libcoroipcc, [libcoroipcc]) + ++PKG_CHECK_MODULES(cmap, [libcmap], HAVE_cmap=1, HAVE_cmap=0) ++ + dnl pacemaker > 1.1.8 + PKG_CHECK_MODULES(pacemaker, [pacemaker, pacemaker-cib], HAVE_pacemaker=1, HAVE_pacemaker=0) + +@@ -42,8 +44,10 @@ PKG_CHECK_MODULES(libqb, [libqb]) + CPPFLAGS="$CPPFLAGS -Werror" + if test $HAVE_pacemaker = 0 -a $HAVE_pcmk = 0; then + AC_MSG_ERROR(No package 'pacemaker' found) ++elif test $HAVE_cmap = 0; then ++ AC_MSG_ERROR(No package 'cmap' found) + elif test $HAVE_pacemaker = 1; then +- CPPFLAGS="$CPPFLAGS $glib_CFLAGS $pacemaker_CFLAGS" ++ CPPFLAGS="$CPPFLAGS $glib_CFLAGS $pacemaker_CFLAGS $cmap_CFLAGS" + fi + + PKG_CHECK_MODULES(libxml, [libxml-2.0]) +@@ -58,6 +62,7 @@ AC_CHECK_LIB(pe_status, pe_find_node, , missing="yes") + AC_CHECK_LIB(pe_rules, test_rule, , missing="yes") + AC_CHECK_LIB(crmcluster, crm_peer_init, , missing="yes") + AC_CHECK_LIB(uuid, uuid_unparse, , missing="yes") ++AC_CHECK_LIB(cmap, cmap_initialize, , missing="yes") + + dnl pacemaker >= 1.1.8 + AC_CHECK_HEADERS(pacemaker/crm/cluster.h) +diff --git a/src/sbd-cluster.c b/src/sbd-cluster.c +index 0ed56e7..656f068 100644 +--- a/src/sbd-cluster.c ++++ b/src/sbd-cluster.c +@@ -33,6 +33,8 @@ + #include + #include + ++#include ++ + #include "sbd.h" + + //undef SUPPORT_PLUGIN +@@ -48,6 +50,7 @@ static gboolean sbd_remote_check(gpointer user_data); + static long unsigned int find_pacemaker_remote(void); + static void sbd_membership_destroy(gpointer user_data); + ++ + #if SUPPORT_PLUGIN + static void + sbd_plugin_membership_dispatch(cpg_handle_t handle, +@@ -67,6 +70,48 @@ sbd_plugin_membership_dispatch(cpg_handle_t handle, + #endif + + #if SUPPORT_COROSYNC ++#include ++ ++static bool two_node = false; ++static bool ever_seen_both = false; ++static cmap_handle_t cmap_handle = 0; ++static cmap_track_handle_t track_handle = 0; ++static int cpg_membership_entries = -1; ++static GSource *cmap_source = NULL; ++ ++void ++sbd_cpg_membership_health_update() ++{ ++ if(cpg_membership_entries > 0) { ++ if (!two_node || !ever_seen_both || cpg_membership_entries > 1) { ++ set_servant_health(pcmk_health_online, LOG_INFO, ++ "Connected to %s (%u members)", ++ name_for_cluster_type(get_cluster_type()), ++ cpg_membership_entries ++ ); ++ } else { ++ /* Alternative would be asking votequorum for number of votes. ++ * Using pacemaker's cpg as source for number of active nodes ++ * avoids binding to an additional library, is definitely ++ * less code to write and we wouldn't have to combina data ++ * from 3 sources (cmap, cpq & votequorum) in a potentially ++ * racy environment. ++ */ ++ set_servant_health(pcmk_health_noquorum, LOG_WARNING, ++ "Connected to %s but requires both nodes present", ++ name_for_cluster_type(get_cluster_type()) ++ ); ++ } ++ ++ if (cpg_membership_entries > 1) { ++ ever_seen_both = true; ++ } ++ } else { ++ set_servant_health(pcmk_health_unclean, LOG_WARNING, ++ "Empty %s membership", name_for_cluster_type(get_cluster_type())); ++ } ++} ++ + void + sbd_cpg_membership_dispatch(cpg_handle_t handle, + const struct cpg_name *groupName, +@@ -74,14 +119,100 @@ sbd_cpg_membership_dispatch(cpg_handle_t handle, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries) + { +- if(member_list_entries > 0) { +- set_servant_health(pcmk_health_online, LOG_INFO, +- "Connected to %s", name_for_cluster_type(get_cluster_type())); ++ cpg_membership_entries = member_list_entries; ++ sbd_cpg_membership_health_update(); ++ notify_parent(); ++} ++ ++static void sbd_cmap_notify_fn( ++ cmap_handle_t cmap_handle, ++ cmap_track_handle_t cmap_track_handle, ++ int32_t event, ++ const char *key_name, ++ struct cmap_notify_value new_val, ++ struct cmap_notify_value old_val, ++ void *user_data) ++{ ++ if (new_val.type == CMAP_VALUETYPE_UINT8) { ++ switch (event) { ++ case CMAP_TRACK_ADD: ++ case CMAP_TRACK_MODIFY: ++ two_node = *((uint8_t *) new_val.data); ++ break; ++ case CMAP_TRACK_DELETE: ++ two_node = false; ++ break; ++ default: ++ return; ++ } ++ sbd_cpg_membership_health_update(); ++ notify_parent(); ++ } ++} ++ ++static gboolean ++cmap_dispatch_callback (gpointer user_data) ++{ ++ cmap_dispatch(cmap_handle, CS_DISPATCH_ALL); ++ return TRUE; ++} ++ ++static gboolean ++sbd_get_two_node(void) ++{ ++ uint8_t two_node_u8 = 0; ++ int cmap_fd; ++ ++ if (!track_handle) { ++ if (cmap_initialize(&cmap_handle) != CS_OK) { ++ cl_log(LOG_WARNING, "Cannot initialize CMAP service\n"); ++ goto out; ++ } ++ ++ if (cmap_track_add(cmap_handle, "quorum.two_node", ++ CMAP_TRACK_DELETE|CMAP_TRACK_MODIFY|CMAP_TRACK_ADD, ++ sbd_cmap_notify_fn, NULL, &track_handle) != CS_OK) { ++ cl_log(LOG_WARNING, "Failed adding CMAP tracker for 2Node-mode\n"); ++ goto out; ++ } ++ ++ /* add the tracker to mainloop */ ++ if (cmap_fd_get(cmap_handle, &cmap_fd) != CS_OK) { ++ cl_log(LOG_WARNING, "Failed to get a file handle for cmap\n"); ++ goto out; ++ } ++ ++ if (!(cmap_source = g_unix_fd_source_new (cmap_fd, G_IO_IN))) { ++ cl_log(LOG_WARNING, "Couldn't create source for cmap\n"); ++ goto out; ++ } ++ g_source_set_callback(cmap_source, cmap_dispatch_callback, NULL, NULL); ++ g_source_attach(cmap_source, NULL); ++ } ++ ++ if (cmap_get_uint8(cmap_handle, "quorum.two_node", &two_node_u8) == CS_OK) { ++ cl_log(LOG_NOTICE, "Corosync is%s in 2Node-mode", two_node_u8?"":" not"); ++ two_node = two_node_u8; + } else { +- set_servant_health(pcmk_health_unclean, LOG_WARNING, +- "Empty %s membership", name_for_cluster_type(get_cluster_type())); ++ cl_log(LOG_NOTICE, "quorum.two_node present in cmap\n"); + } +- notify_parent(); ++ return TRUE; ++ ++out: ++ if (cmap_source) { ++ g_source_destroy(cmap_source); ++ cmap_source = NULL; ++ } ++ if (track_handle) { ++ cmap_track_delete(cmap_handle, track_handle); ++ track_handle = 0; ++ } ++ if (cmap_handle) { ++ cmap_finalize(cmap_handle); ++ cmap_handle = 0; ++ } ++ ++ return FALSE; + } + #endif + +@@ -143,9 +274,17 @@ sbd_membership_connect(void) + } else { + cl_log(LOG_INFO, "Attempting connection to %s", name_for_cluster_type(stack)); + +- if(crm_cluster_connect(&cluster)) { +- connected = true; ++#if SUPPORT_COROSYNC ++ if (sbd_get_two_node()) { ++#endif ++ ++ if(crm_cluster_connect(&cluster)) { ++ connected = true; ++ } ++ ++#if SUPPORT_COROSYNC + } ++#endif + } + + if(connected == false) { +-- +1.8.3.1 + diff --git a/SOURCES/04-Refactor-servant-type-helpers.patch b/SOURCES/04-Refactor-servant-type-helpers.patch new file mode 100644 index 0000000..225d1fd --- /dev/null +++ b/SOURCES/04-Refactor-servant-type-helpers.patch @@ -0,0 +1,149 @@ +From d1222864f4fcca63c7426272b0cdd22bdaa60b9e Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Tue, 6 Jun 2017 09:38:07 +0200 +Subject: [PATCH] Refactor servant type helpers + +--- + src/sbd-common.c | 33 +++++++++++++++++++++++++++++++++ + src/sbd-inquisitor.c | 35 +++++++++++------------------------ + src/sbd-md.c | 2 +- + src/sbd.h | 2 ++ + 4 files changed, 47 insertions(+), 25 deletions(-) + +diff --git a/src/sbd-common.c b/src/sbd-common.c +index 55e636b..964f422 100644 +--- a/src/sbd-common.c ++++ b/src/sbd-common.c +@@ -694,3 +694,36 @@ set_servant_health(enum pcmk_health state, int level, char const *format, ...) + free(string); + } + } ++ ++bool ++sbd_is_disk(struct servants_list_item *servant) ++{ ++ if ((servant != NULL) && ++ (servant->devname != NULL) && ++ (servant->devname[0] == '/')) { ++ return true; ++ } ++ return false; ++} ++ ++bool ++sbd_is_cluster(struct servants_list_item *servant) ++{ ++ if ((servant != NULL) && ++ (servant->devname != NULL) && ++ (strcmp("cluster", servant->devname) == 0)) { ++ return true; ++ } ++ return false; ++} ++ ++bool ++sbd_is_pcmk(struct servants_list_item *servant) ++{ ++ if ((servant != NULL) && ++ (servant->devname != NULL) && ++ (strcmp("pcmk", servant->devname) == 0)) { ++ return true; ++ } ++ return false; ++} +diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c +index 3c3a5a0..5a1f639 100644 +--- a/src/sbd-inquisitor.c ++++ b/src/sbd-inquisitor.c +@@ -34,17 +34,6 @@ char* pidfile = NULL; + + int parse_device_line(const char *line); + +-bool +-sbd_is_disk(struct servants_list_item *servant) +-{ +- if (servant == NULL +- || servant->devname == NULL +- || servant->devname[0] == '/') { +- return true; +- } +- return false; +-} +- + void recruit_servant(const char *devname, pid_t pid) + { + struct servants_list_item *s = servants_leader; +@@ -162,11 +151,11 @@ void servant_start(struct servants_list_item *s) + cl_log(LOG_ERR, "Shared disk functionality not supported"); + return; + #endif +- } else if(strcmp("pcmk", s->devname) == 0) { ++ } else if(sbd_is_pcmk(s)) { + DBGLOG(LOG_INFO, "Starting Pacemaker servant"); + s->pid = assign_servant(s->devname, servant_pcmk, start_mode, NULL); + +- } else if(strcmp("cluster", s->devname) == 0) { ++ } else if(sbd_is_cluster(s)) { + DBGLOG(LOG_INFO, "Starting Cluster servant"); + s->pid = assign_servant(s->devname, servant_cluster, start_mode, NULL); + +@@ -401,7 +390,7 @@ int cluster_alive(bool all) + } + + for (s = servants_leader; s; s = s->next) { +- if (sbd_is_disk(s) == false) { ++ if (sbd_is_cluster(s) || sbd_is_pcmk(s)) { + if(s->outdated) { + alive = 0; + } else if(all == false) { +@@ -490,16 +479,14 @@ void inquisitor_child(void) + } + } else if (sig == SIG_PCMK_UNHEALTHY) { + s = lookup_servant_by_pid(sinfo.si_pid); +- if (sbd_is_disk(s)) { +- cl_log(LOG_WARNING, "Ignoring SIG_PCMK_UNHEALTHY from unknown source"); +- +- } else { +- if(s->outdated == 0) { +- cl_log(LOG_WARNING, "%s health check: UNHEALTHY", s->devname); +- } +- s->t_last.tv_sec = 1; +- } +- ++ if (sbd_is_cluster(s) || sbd_is_pcmk(s)) { ++ if (s->outdated == 0) { ++ cl_log(LOG_WARNING, "%s health check: UNHEALTHY", s->devname); ++ } ++ s->t_last.tv_sec = 1; ++ } else { ++ cl_log(LOG_WARNING, "Ignoring SIG_PCMK_UNHEALTHY from unknown source"); ++ } + } else if (sig == SIG_IO_FAIL) { + s = lookup_servant_by_pid(sinfo.si_pid); + if (s) { +diff --git a/src/sbd-md.c b/src/sbd-md.c +index 10b1925..bbf9018 100644 +--- a/src/sbd-md.c ++++ b/src/sbd-md.c +@@ -833,7 +833,7 @@ int ping_via_slots(const char *name, struct servants_list_item *servants) + break; + } else { + s = lookup_servant_by_pid(pid); +- if (s && sbd_is_disk(s)) { ++ if (sbd_is_disk(s)) { + servants_finished++; + } + } +diff --git a/src/sbd.h b/src/sbd.h +index 07a476d..07d2706 100644 +--- a/src/sbd.h ++++ b/src/sbd.h +@@ -191,3 +191,5 @@ extern int servant_health; + void set_servant_health(enum pcmk_health state, int level, char const *format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); + + bool sbd_is_disk(struct servants_list_item *servant); ++bool sbd_is_pcmk(struct servants_list_item *servant); ++bool sbd_is_cluster(struct servants_list_item *servant); +-- +1.8.3.1 + diff --git a/SOURCES/05-Fix-disk-servant-signal-reset-request-via-exit-code.patch b/SOURCES/05-Fix-disk-servant-signal-reset-request-via-exit-code.patch new file mode 100644 index 0000000..975ba5e --- /dev/null +++ b/SOURCES/05-Fix-disk-servant-signal-reset-request-via-exit-code.patch @@ -0,0 +1,248 @@ +From 2f0a3822aae3ed0094b2c1c9d44671c885e811de Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Tue, 6 Jun 2017 10:27:57 +0200 +Subject: [PATCH] Fix: disk-servant: signal reset request via exit-code + +Instead of calling do_reset, do_off or do_crashdump directly +signal to sbd-inquisitor via exit-code. +Use exit-code as well for signalling io-errors as sequence +of RT-signals and SIGCHLD is undefined. +--- + src/sbd-inquisitor.c | 32 +++++++++++++++++++++++------- + src/sbd-md.c | 56 +++++++++++++++------------------------------------- + src/sbd.h | 6 ++++++ + 3 files changed, 47 insertions(+), 47 deletions(-) + +diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c +index 5a1f639..067e669 100644 +--- a/src/sbd-inquisitor.c ++++ b/src/sbd-inquisitor.c +@@ -474,6 +474,31 @@ void inquisitor_child(void) + if (pid == -1 && errno == ECHILD) { + break; + } else { ++ s = lookup_servant_by_pid(pid); ++ if (sbd_is_disk(s)) { ++ if (WIFEXITED(status)) { ++ switch(WEXITSTATUS(status)) { ++ case EXIT_MD_IO_FAIL: ++ DBGLOG(LOG_INFO, "Servant for %s requests to be disowned", ++ s->devname); ++ break; ++ case EXIT_MD_REQUEST_RESET: ++ cl_log(LOG_WARNING, "%s requested a reset", s->devname); ++ do_reset(); ++ break; ++ case EXIT_MD_REQUEST_SHUTOFF: ++ cl_log(LOG_WARNING, "%s requested a shutoff", s->devname); ++ do_off(); ++ break; ++ case EXIT_MD_REQUEST_CRASHDUMP: ++ cl_log(LOG_WARNING, "%s requested a crashdump", s->devname); ++ do_crashdump(); ++ break; ++ default: ++ break; ++ } ++ } ++ } + cleanup_servant_by_pid(pid); + } + } +@@ -487,13 +512,6 @@ void inquisitor_child(void) + } else { + cl_log(LOG_WARNING, "Ignoring SIG_PCMK_UNHEALTHY from unknown source"); + } +- } else if (sig == SIG_IO_FAIL) { +- s = lookup_servant_by_pid(sinfo.si_pid); +- if (s) { +- DBGLOG(LOG_INFO, "Servant for %s requests to be disowned", +- s->devname); +- cleanup_servant_by_pid(sinfo.si_pid); +- } + } else if (sig == SIG_LIVENESS) { + s = lookup_servant_by_pid(sinfo.si_pid); + if (s) { +diff --git a/src/sbd-md.c b/src/sbd-md.c +index bbf9018..54ac580 100644 +--- a/src/sbd-md.c ++++ b/src/sbd-md.c +@@ -29,7 +29,6 @@ + #define MBOX_TO_SECTOR(mbox) (2+mbox*2) + + extern int disk_count; +-static int servant_inform_parent = 0; + + /* These have to match the values in the header of the partition */ + static char sbd_magic[8] = "SBD_SBD_"; +@@ -1025,20 +1024,6 @@ static int servant_check_timeout_inconsistent(struct sector_header_s *hdr) + return 0; + } + +-/* This is a bit hackish, but the easiest way to rewire all process +- * exits to send the desired signal to the parent. */ +-void servant_exit(void) +-{ +- pid_t ppid; +- union sigval signal_value; +- +- ppid = getppid(); +- if (servant_inform_parent) { +- memset(&signal_value, 0, sizeof(signal_value)); +- sigqueue(ppid, SIG_IO_FAIL, signal_value); +- } +-} +- + int servant(const char *diskname, int mode, const void* argp) + { + struct sector_mbox_s *s_mbox = NULL; +@@ -1072,24 +1057,21 @@ int servant(const char *diskname, int mode, const void* argp) + /* FIXME: check error */ + sigprocmask(SIG_SETMASK, &servant_masks, NULL); + +- atexit(servant_exit); +- servant_inform_parent = 1; +- + st = open_device(diskname, LOG_WARNING); + if (!st) { +- return -1; ++ exit(EXIT_MD_IO_FAIL); + } + + s_header = header_get(st); + if (!s_header) { + cl_log(LOG_ERR, "Not a valid header on %s", diskname); +- return -1; ++ exit(EXIT_MD_IO_FAIL); + } + + if (servant_check_timeout_inconsistent(s_header) < 0) { + cl_log(LOG_ERR, "Timeouts on %s do not match first device", + diskname); +- return -1; ++ exit(EXIT_MD_IO_FAIL); + } + + if (s_header->minor_version > 0) { +@@ -1102,14 +1084,14 @@ int servant(const char *diskname, int mode, const void* argp) + cl_log(LOG_ERR, + "No slot allocated, and automatic allocation failed for disk %s.", + diskname); +- rc = -1; ++ rc = EXIT_MD_IO_FAIL; + goto out; + } + s_node = sector_alloc(); + if (slot_read(st, mbox, s_node) < 0) { + cl_log(LOG_ERR, "Unable to read node entry on %s", + diskname); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + + DBGLOG(LOG_INFO, "Monitoring slot %d on disk %s", mbox, diskname); +@@ -1125,7 +1107,7 @@ int servant(const char *diskname, int mode, const void* argp) + if (mode > 0) { + if (mbox_read(st, mbox, s_mbox) < 0) { + cl_log(LOG_ERR, "mbox read failed during start-up in servant."); +- rc = -1; ++ rc = EXIT_MD_IO_FAIL; + goto out; + } + if (s_mbox->cmd != SBD_MSG_EXIT && +@@ -1141,7 +1123,7 @@ int servant(const char *diskname, int mode, const void* argp) + DBGLOG(LOG_INFO, "First servant start - zeroing inbox"); + memset(s_mbox, 0, sizeof(*s_mbox)); + if (mbox_write(st, mbox, s_mbox) < 0) { +- rc = -1; ++ rc = EXIT_MD_IO_FAIL; + goto out; + } + } +@@ -1170,28 +1152,28 @@ int servant(const char *diskname, int mode, const void* argp) + s_header_retry = header_get(st); + if (!s_header_retry) { + cl_log(LOG_ERR, "No longer found a valid header on %s", diskname); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + if (memcmp(s_header, s_header_retry, sizeof(*s_header)) != 0) { + cl_log(LOG_ERR, "Header on %s changed since start-up!", diskname); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + free(s_header_retry); + + s_node_retry = sector_alloc(); + if (slot_read(st, mbox, s_node_retry) < 0) { + cl_log(LOG_ERR, "slot read failed in servant."); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + if (memcmp(s_node, s_node_retry, sizeof(*s_node)) != 0) { + cl_log(LOG_ERR, "Node entry on %s changed since start-up!", diskname); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + free(s_node_retry); + + if (mbox_read(st, mbox, s_mbox) < 0) { + cl_log(LOG_ERR, "mbox read failed in servant."); +- exit(1); ++ exit(EXIT_MD_IO_FAIL); + } + + if (s_mbox->cmd > 0) { +@@ -1206,17 +1188,14 @@ int servant(const char *diskname, int mode, const void* argp) + sigqueue(ppid, SIG_TEST, signal_value); + break; + case SBD_MSG_RESET: +- do_reset(); +- break; ++ exit(EXIT_MD_REQUEST_RESET); + case SBD_MSG_OFF: +- do_off(); +- break; ++ exit(EXIT_MD_REQUEST_SHUTOFF); + case SBD_MSG_EXIT: + sigqueue(ppid, SIG_EXITREQ, signal_value); + break; + case SBD_MSG_CRASHDUMP: +- do_crashdump(); +- break; ++ exit(EXIT_MD_REQUEST_CRASHDUMP); + default: + /* FIXME: + An "unknown" message might result +@@ -1247,10 +1226,7 @@ int servant(const char *diskname, int mode, const void* argp) + out: + free(s_mbox); + close_device(st); +- if (rc == 0) { +- servant_inform_parent = 0; +- } +- return rc; ++ exit(rc); + } + + +diff --git a/src/sbd.h b/src/sbd.h +index 07d2706..aa411b7 100644 +--- a/src/sbd.h ++++ b/src/sbd.h +@@ -54,6 +54,12 @@ + #define SIG_PCMK_UNHEALTHY (SIGRTMIN + 6) + /* FIXME: should add dynamic check of SIG_XX >= SIGRTMAX */ + ++/* exit status for disk-servant */ ++#define EXIT_MD_IO_FAIL 20 ++#define EXIT_MD_REQUEST_RESET 21 ++#define EXIT_MD_REQUEST_SHUTOFF 22 ++#define EXIT_MD_REQUEST_CRASHDUMP 23 ++ + #define HOG_CHAR 0xff + #define SECTOR_NAME_MAX 63 + +-- +1.8.3.1 + diff --git a/SOURCES/sbd-no-storage-option.patch b/SOURCES/sbd-no-storage-option.patch deleted file mode 100644 index 3665c1a..0000000 --- a/SOURCES/sbd-no-storage-option.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/sbd.sysconfig b/src/sbd.sysconfig -index 9ac2d15..f5b0b8c 100644 ---- a/src/sbd.sysconfig -+++ b/src/sbd.sysconfig -@@ -1,12 +1,3 @@ --## Type: string --## Default: "" --# --# SBD_DEVICE specifies the devices to use for exchanging sbd messages --# and to monitor. If specifying more than one path, use ";" as --# separator. --# --#SBD_DEVICE="" -- - ## Type: yesno - ## Default: yes - # diff --git a/SPECS/sbd.spec b/SPECS/sbd.spec index b560d94..954009c 100644 --- a/SPECS/sbd.spec +++ b/SPECS/sbd.spec @@ -15,20 +15,24 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%global commit c511b0692784a7085df4b1ae35748fb318fa79ee +%global commit 4968e9c8602fbb990bed63cc96ca18f62e2181db %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global github_owner Clusterlabs -%global buildnum 21 +%global buildnum 3 Name: sbd Summary: Storage-based death License: GPLv2+ Group: System Environment/Daemons -Version: 1.2.1 -#Release: 0.%{buildnum}.%{shortcommit}.git%{?dist} +Version: 1.3.0 Release: %{buildnum}%{?dist} Url: https://github.com/%{github_owner}/%{name} Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz +Patch0: 01-Fix-sbd-inquisitor-Correctly-look-up-servant-by-devi.patch +Patch1: 02-Fix-sbd-inquisitor-Do-not-create-duplicate-servants.patch +Patch2: 03-Fix-cluster-servant-check-for-corosync-2Node-mode.patch +Patch3: 04-Refactor-servant-type-helpers.patch +Patch4: 05-Fix-disk-servant-signal-reset-request-via-exit-code.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf BuildRequires: automake @@ -42,10 +46,9 @@ BuildRequires: libuuid-devel BuildRequires: libxml2-devel BuildRequires: pkgconfig BuildRequires: python-devel -Patch1: sbd-no-storage-option.patch %if 0%{?rhel} > 0 -ExclusiveArch: i686 x86_64 s390x +ExclusiveArch: i686 x86_64 s390x ppc64le %endif %if %{defined systemd_requires} @@ -55,7 +58,6 @@ ExclusiveArch: i686 x86_64 s390x %description This package contains the storage-based death functionality. -Currently it is limited to watchdog integration. ########################################################### @@ -67,7 +69,7 @@ Currently it is limited to watchdog integration. %build autoreconf -i export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror" -%configure --disable-shared-disk +%configure make %{?_smp_mflags} ########################################################### @@ -76,7 +78,6 @@ make %{?_smp_mflags} make DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} install rm -rf ${RPM_BUILD_ROOT}%{_libdir}/stonith -rm -rf ${RPM_BUILD_ROOT}%{_mandir}/man8/sbd* %if %{defined _unitdir} install -D -m 0644 src/sbd.service $RPM_BUILD_ROOT/%{_unitdir}/sbd.service @@ -111,7 +112,7 @@ rm -rf %{buildroot} %config(noreplace) %{_sysconfdir}/sysconfig/sbd %{_sbindir}/sbd #%{_datadir}/sbd -#doc %{_mandir}/man8/sbd* +%doc %{_mandir}/man8/sbd* %if %{defined _unitdir} %{_unitdir}/sbd.service %{_unitdir}/sbd_remote.service @@ -119,6 +120,30 @@ rm -rf %{buildroot} %doc COPYING %changelog +* Wed Jun 7 2017 - 1.3.0-3 +- prevent creation of duplicate servants +- check 2Node flag in corosync to support + 2-node-clusters with shared disk fencing +- move disk-triggered reboot/off/crashdump + to inquisitor to have sysrq observed by watchdog + + Resolves: rhbz#1413951 + +* Sun Mar 26 2017 - 1.3.0-1 +- rebase to upstream v1.3.0 +- remove watchdog-limitation from description + Resolves: rhbz#1413951 + +* Mon Feb 27 2017 - 1.2.1-23 +- if shared-storage enabled check for node-name <= 63 chars + Resolves: rhbz#1413951 + +* Tue Jan 31 2017 - 1.2.1-22 +- Rebuild with shared-storage enabled +- Package original manpage +- Added ppc64le target + Resolves: rhbz#1413951 + * Fri Apr 15 2016 - 1.2.1-21 - Rebuild for new pacemaker Resolves: rhbz#1320400 @@ -131,7 +156,7 @@ rm -rf %{buildroot} * Thu Jul 23 2015 - 1.2.1-5 - Rebuild for pacemaker -* Mon Jun 02 2015 - 1.2.1-4 +* Tue Jun 02 2015 - 1.2.1-4 - Include the dist tag in the release string - Rebuild for new pacemaker