From 086555113f6bb336e76aefbf3250dd4e19c904b7 Mon Sep 17 00:00:00 2001 From: Yan Gao Date: Mon, 22 Jul 2013 10:57:08 +0000 Subject: [PATCH 01/11] - ocfs2_controld: ocfs2_controld-pacemaker.diff * Replace use of send_ais_text() with send_cluster_text() * Replace use of ais_dispatch() with plugin_dispatch() OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=59 --- ocfs2-tools.changes | 7 +++++++ ocfs2_controld-pacemaker.diff | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 798dc46..0bb3036 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jul 22 10:57:44 UTC 2013 - ygao@suse.com + +- ocfs2_controld: ocfs2_controld-pacemaker.diff + * Replace use of send_ais_text() with send_cluster_text() + * Replace use of ais_dispatch() with plugin_dispatch() + ------------------------------------------------------------------- Wed Jul 3 07:40:31 CDT 2013 - rgoldwyn@suse.com - ocfs2console-libraries-include-aio.patch: Include aio diff --git a/ocfs2_controld-pacemaker.diff b/ocfs2_controld-pacemaker.diff index 4701ba7..f6f5e8d 100644 --- a/ocfs2_controld-pacemaker.diff +++ b/ocfs2_controld-pacemaker.diff @@ -1,7 +1,7 @@ Index: ocfs2-tools/ocfs2_controld/pacemaker.c =================================================================== ---- ocfs2-tools.orig/ocfs2_controld/pacemaker.c 2012-08-24 10:02:19.000000000 -0500 -+++ ocfs2-tools/ocfs2_controld/pacemaker.c 2012-11-26 16:16:38.000000000 -0600 +--- ocfs2-tools.orig/ocfs2_controld/pacemaker.c ++++ ocfs2-tools/ocfs2_controld/pacemaker.c @@ -28,9 +28,8 @@ #define SUPPORT_HEARTBEAT 0 @@ -22,7 +22,7 @@ Index: ocfs2-tools/ocfs2_controld/pacemaker.c extern int ais_fd_async; char *local_node_uname = NULL; -@@ -138,28 +138,29 @@ static void dead_pcmk(int ci) +@@ -138,33 +138,34 @@ static void dead_pcmk(int ci) connection_dead(ci); } @@ -38,7 +38,7 @@ Index: ocfs2-tools/ocfs2_controld/pacemaker.c static void process_pcmk(int ci) { - ais_dispatch(ais_fd_async, NULL); -+ ais_dispatch(NULL); ++ plugin_dispatch(&crm_cluster); } int setup_stack(void) @@ -56,5 +56,12 @@ Index: ocfs2-tools/ocfs2_controld/pacemaker.c + our_nodeid = crm_cluster.nodeid; + /* Sign up for membership updates */ - send_ais_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais); +- send_ais_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais); ++ send_cluster_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais); + + /* Requesting the current list of known nodes */ +- send_ais_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais); ++ send_cluster_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais); + + log_debug("Cluster connection established. Local node id: %d", our_nodeid); From 4633b6be45ad33c4f5f20ee9f6c66b98b2466561 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Wed, 31 Jul 2013 14:13:16 +0000 Subject: [PATCH 02/11] Accepting request 185215 from home:goldwynr:branches:network:ha-clustering:Factory update to be compatible with corosync 2.3.x OBS-URL: https://build.opensuse.org/request/show/185215 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=60 --- 0001-Remove-pacemaker-ais-stuff.patch | 648 ++++++++++++++++++ ...cfg-to-get-configuration-information.patch | 315 +++++++++ 0003-Hard-code-protocol-versions.patch | 30 + 0005-Add-cluster_name-and-stack-name.patch | 31 + ocfs2-tools.changes | 9 + ocfs2-tools.spec | 14 +- ocfs2_controld-pacemaker.diff | 67 -- 7 files changed, 1042 insertions(+), 72 deletions(-) create mode 100644 0001-Remove-pacemaker-ais-stuff.patch create mode 100644 0002-Add-corosync-cfg-to-get-configuration-information.patch create mode 100644 0003-Hard-code-protocol-versions.patch create mode 100644 0005-Add-cluster_name-and-stack-name.patch delete mode 100644 ocfs2_controld-pacemaker.diff diff --git a/0001-Remove-pacemaker-ais-stuff.patch b/0001-Remove-pacemaker-ais-stuff.patch new file mode 100644 index 0000000..7a8b56f --- /dev/null +++ b/0001-Remove-pacemaker-ais-stuff.patch @@ -0,0 +1,648 @@ +From 6754fec432e3a2a758af9308fd7447f6e20e4cea Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Tue, 23 Jul 2013 09:06:23 -0500 +Subject: [PATCH 1/5] Remove pacemaker/ais stuff + +--- + configure.in | 58 +---------- + ocfs2_controld/Makefile | 27 +++-- + ocfs2_controld/cpg.c | 56 +++++----- + ocfs2_controld/main.c | 270 ------------------------------------------------ + 4 files changed, 42 insertions(+), 369 deletions(-) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/configure.in +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/configure.in 2013-07-31 08:15:10.269877099 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/configure.in 2013-07-31 08:16:54.137970542 -0500 +@@ -219,12 +219,6 @@ LIBS="$ocfs_tools_save_LIBS" + + AC_SUBST(BUILD_DEBUGOCFS2) + +-pcmk_found= +-AC_CHECK_LIB(crmcluster, crm_get_peer, +- [AC_CHECK_HEADER(pacemaker/crm_config.h, pcmk_found=yes, +- [AC_MSG_WARN([Pacemaker headers not found, pacemaker support will not be built])])], +- [AC_MSG_WARN([libcrmcluster not found, pacemaker support will not be built])]) +- + # We use cman_replyto_shutdown to insure a new enough libcman + cman_found= + AC_CHECK_LIB(cman, cman_replyto_shutdown, +@@ -298,53 +292,6 @@ else + fi + AC_SUBST(CPG_LDFLAGS) + +-ckpt_found= +-AC_CHECK_HEADER(openais/saCkpt.h, ckpt_found=yes, +- [AC_MSG_WARN([openais/saCkpt.h not found, ocfs2_controld will not be built])], +- [#include ]) +- +-AIS_LDFLAGS= +-if test "x$ckpt_found" = "xyes"; then +- ckpt_found= +- TRY_PATH="$AIS_TRY_PATH" +- AC_MSG_CHECKING([for saCkptInitialize in -lSaCkpt]) +- while test "x$TRY_PATH" != "x"; do +- TRY="`echo $TRY_PATH | cut -f1 -d:`" +- NEW_TRY_PATH="`echo $TRY_PATH | cut -f2- -d:`" +- if test "x$NEW_TRY_PATH" != "x$TRY_PATH"; then +- TRY_PATH="$NEW_TRY_PATH" +- else +- TRY_PATH="" +- fi +- +- if test "x$TRY" != "x"; then +- TRY="-L${TRY}/openais" +- fi +- # TRY="$TRY" +- +- saved_LDFLAGS="$LDFLAGS" +- saved_LIBS="$LIBS" +- LDFLAGS="$LDFLAGS $TRY" +- LIBS="-lSaCkpt" +- AC_LINK_IFELSE([AC_LANG_CALL([], [saCkptInitialize])], +- ckpt_found=yes) +- LIBS="$saved_LIBS" +- LDFLAGS="$saved_LDFLAGS" +- +- if test "x$ckpt_found" = "xyes"; then +- AIS_LDFLAGS="$TRY" +- break +- fi +- done +-fi +-if test "x$ckpt_found" = "xyes"; then +- AC_MSG_RESULT(yes) +-else +- AC_MSG_RESULT(no) +- AC_MSG_WARN([libSaCkpt not found, ocfs2_controld will not be built]) +-fi +-AC_SUBST(AIS_LDFLAGS) +- + libdlmcontrol_found= + AC_CHECK_LIB(dlmcontrol, dlmc_fs_connect, + [AC_CHECK_HEADER(libdlmcontrol.h, libdlmcontrol_found=yes, +@@ -379,7 +326,7 @@ AC_SUBST(BUILD_FSDLM_SUPPORT) + AC_SUBST(DL_LIBS) + + BUILD_OCFS2_CONTROLD= +-if test "x$cpg_found" = "xyes" -a "x$ckpt_found" = "xyes" -a "x$libdlmcontrol_found" = "xyes"; then ++if test "x$cpg_found" = "xyes" -a "x$libdlmcontrol_found" = "xyes"; then + if test "x$fsdlm_found" = "xyes"; then + BUILD_OCFS2_CONTROLD=yes + else +@@ -388,12 +335,6 @@ if test "x$cpg_found" = "xyes" -a "x$ckp + fi + AC_SUBST(BUILD_OCFS2_CONTROLD) + +-BUILD_PCMK_SUPPORT= +-if test "x$pcmk_found" = "xyes" -a "x$BUILD_OCFS2_CONTROLD" = "xyes"; then +- BUILD_PCMK_SUPPORT=yes +-fi +-AC_SUBST(BUILD_PCMK_SUPPORT) +- + BUILD_CMAN_SUPPORT= + if test "x$cman_found" = "xyes" -a "x$BUILD_OCFS2_CONTROLD" = "xyes"; then + BUILD_CMAN_SUPPORT=yes +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/Makefile 2013-07-31 08:15:39.324743014 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile 2013-07-31 08:15:50.516076420 -0500 +@@ -14,18 +14,17 @@ endif + ifneq ($(BUILD_PCMK_SUPPORT),) + SBIN_PROGRAMS += ocfs2_controld.pcmk + # Some pacemaker headers which pacemaker.c includes want this. +-PCMK_INCLUDES = -I/usr/include/pacemaker -I/usr/include/heartbeat/ $(GLIB_CFLAGS) ++#PCMK_INCLUDES = -I/usr/include/pacemaker -I/usr/include/heartbeat/ $(GLIB_CFLAGS) + endif + +-INCLUDES = -I$(TOPDIR)/include -I. $(PCMK_INCLUDES) ++ ++INCLUDES = -I$(TOPDIR)/include -I. + LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a +-COROSYNC_LIBS = $(CPG_LDFLAGS) -lcpg +-OPENAIS_LIBS = $(AIS_LDFLAGS) -lSaCkpt ++COROSYNC_LIBS = $(CPG_LDFLAGS) -lcpg -lcmap -lcfg -lquorum + DLMCONTROL_LIBS = -ldlmcontrol +-CRM_LIBS = -lcrmcluster -lstonithd -lcrmcommon + + ifdef OCFS2_DEBUG + OPTS += -ggdb +@@ -44,15 +43,16 @@ UNINST_HFILES = ocfs2_controld.h + ifneq ($(HAVE_COROSYNC),) + DEFINES += -DHAVE_COROSYNC=1 + endif +-DAEMON_CFILES = main.c cpg.c mount.c ckpt.c dlmcontrol.c ++DAEMON_CFILES = main.c cpg.c mount.c dlmcontrol.c + + CMAN_CFILES = cman.c + CMAN_DAEMON_CFILES = $(DAEMON_CFILES) $(CMAN_CFILES) + CMAN_DAEMON_OBJS = $(subst .c,.o,$(CMAN_DAEMON_CFILES)) + +-PCMK_CFILES = pacemaker.c +-PCMK_DAEMON_CFILES = $(DAEMON_CFILES) $(PCMK_CFILES) +-PCMK_DAEMON_OBJS = $(subst .c,.o,$(PCMK_DAEMON_CFILES)) ++COROSYNC_CFILES = ++COROSYNC_DAEMON_CFILES = $(DAEMON_CFILES) $(COROSYNC_CFILES) ++COROSYNC_DAEMON_OBJS = $(subst .c,.o,$(COROSYNC_DAEMON_CFILES)) ++ + + TEST_CFILES = test_client.c + TEST_OBJS = $(subst .c,.o,$(TEST_CFILES) $(PROTO_CFILES)) +@@ -60,18 +60,17 @@ MANS = + + DIST_FILES = \ + $(DAEMON_CFILES) \ +- $(PCMK_CFILES) \ + $(CMAN_CFILES) \ + $(TEST_CFILES) \ + $(UNINST_HFILES) \ + $(addsuffix .in,$(MANS)) +-ocfs2_controld.pcmk: $(PCMK_DAEMON_OBJS) $(LIBO2CB_DEPS) ++ocfs2_controld.pcmk: $(COROSYNC_DAEMON_OBJS) $(LIBO2CB_DEPS) + $(LINK) $(GLIB_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) \ +- $(OPENAIS_LIBS) $(COROSYNC_LIBS) \ +- $(DLMCONTROL_LIBS) $(CRM_LIBS) ++ $(COROSYNC_LIBS) \ ++ $(DLMCONTROL_LIBS) + + ocfs2_controld.cman: $(CMAN_DAEMON_OBJS) $(LIBO2CB_DEPS) +- $(LINK) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) $(OPENAIS_LIBS) \ ++ $(LINK) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) \ + $(COROSYNC_LIBS) $(DLMCONTROL_LIBS) -lcman + + test_client: $(TEST_OBJS) $(LIBO2CB_DEPS) $(LIBOCFS2_DEPS) +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/cpg.c 2013-07-31 08:15:39.325743044 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c 2013-07-31 08:15:50.516076420 -0500 +@@ -474,20 +474,20 @@ static struct cgroup *handle_to_group(cp + return NULL; + } + +-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name, ++static void deliver_cb(cpg_handle_t handle, const struct cpg_name *group_name, + uint32_t nodeid, uint32_t pid, +- void *data, int data_len) ++ void *data, size_t data_len) + { + log_debug("deliver called"); + } + +-static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, +- struct cpg_address *member_list, +- int member_list_entries, +- struct cpg_address *left_list, +- int left_list_entries, +- struct cpg_address *joined_list, +- int joined_list_entries) ++static void confchg_cb(cpg_handle_t handle, const struct cpg_name *group_name, ++ const struct cpg_address *member_list, ++ size_t member_list_entries, ++ const struct cpg_address *left_list, ++ size_t left_list_entries, ++ const struct cpg_address *joined_list, ++ size_t joined_list_entries) + { + int i; + struct cgroup *cg; +@@ -499,13 +499,13 @@ static void confchg_cb(cpg_handle_t hand + return; + + if (left_list_entries > CPG_MEMBERS_MAX) { +- log_debug("left_list_entries %d", left_list_entries); ++ log_debug("left_list_entries %d", (int) left_list_entries); + left_list_entries = CPG_MEMBERS_MAX; + } else if (joined_list_entries > CPG_MEMBERS_MAX) { +- log_debug("joined_list_entries %d", joined_list_entries); ++ log_debug("joined_list_entries %d", (int) joined_list_entries); + joined_list_entries = CPG_MEMBERS_MAX; + } else if (member_list_entries > CPG_MEMBERS_MAX) { +- log_debug("member_list_entries %d", member_list_entries); ++ log_debug("member_list_entries %d", (int) member_list_entries); + member_list_entries = CPG_MEMBERS_MAX; + } + +@@ -530,7 +530,7 @@ static cpg_callbacks_t callbacks = { + + static void process_cpg(int ci) + { +- cpg_error_t error; ++ cs_error_t error; + cpg_flow_control_state_t flow_control_state; + struct cgroup *cg; + +@@ -539,15 +539,15 @@ static void process_cpg(int ci) + return; + + cg->cg_got_confchg = 0; +- error = cpg_dispatch(cg->cg_handle, CPG_DISPATCH_ONE); +- if (error != CPG_OK) { ++ error = cpg_dispatch(cg->cg_handle, CS_DISPATCH_ONE); ++ if (error != CS_OK) { + log_error("cpg_dispatch error %d", error); + return; + } + + error = cpg_flow_control_state_get(cg->cg_handle, + &flow_control_state); +- if (error != CPG_OK) ++ if (error != CS_OK) + log_error("cpg_flow_control_state_get %d", error); + else if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) { + message_flow_control_on = 1; +@@ -582,21 +582,21 @@ static void dead_cpg(int ci) + + static int start_join(struct cgroup *cg) + { +- cpg_error_t error; ++ cs_error_t error; + + log_debug("Starting join for group \"%.*s\"", + cg->cg_name.length, cg->cg_name.value); + do { + error = cpg_join(cg->cg_handle, &cg->cg_name); +- if (error == CPG_OK) { ++ if (error == CS_OK) { + log_debug("cpg_join succeeded"); + error = 0; +- } else if (error == CPG_ERR_TRY_AGAIN) { ++ } else if (error == CS_ERR_TRY_AGAIN) { + log_debug("cpg_join retry"); + sleep(1); + } else + log_error("cpg_join error %d", error); +- } while (error == CPG_ERR_TRY_AGAIN); ++ } while (error == CS_ERR_TRY_AGAIN); + + return error; + } +@@ -604,7 +604,7 @@ static int start_join(struct cgroup *cg) + static int start_leave(struct cgroup *cg) + { + int i; +- cpg_error_t error; ++ cs_error_t error; + + if (!cg->cg_handle) + return -EINVAL; +@@ -615,14 +615,14 @@ static int start_leave(struct cgroup *cg + for (i = 0; i < 10; i++) { + error = cpg_leave(cg->cg_handle, + &cg->cg_name); +- if (error == CPG_ERR_TRY_AGAIN) { ++ if (error == CS_ERR_TRY_AGAIN) { + if (!i) + log_debug("cpg_leave retry"); + sleep(1); + continue; + } + +- if (error == CPG_OK) ++ if (error == CS_OK) + log_debug("cpg_leave succeeded"); + else + log_error("cpg_leave error %d", error); +@@ -630,9 +630,9 @@ static int start_leave(struct cgroup *cg + break; + } + +- if (error == CPG_OK) ++ if (error == CS_OK) + return 0; +- else if (error == CPG_ERR_TRY_AGAIN) ++ else if (error == CS_ERR_TRY_AGAIN) + return -EAGAIN; + else + return -EIO; +@@ -641,7 +641,7 @@ static int start_leave(struct cgroup *cg + + static int init_group(struct cgroup *cg, const char *name) + { +- cpg_error_t error; ++ cs_error_t error; + + cg->cg_name.length = snprintf(cg->cg_name.value, + CPG_MAX_NAME_LENGTH, +@@ -653,7 +653,7 @@ static int init_group(struct cgroup *cg, + } + + error = cpg_initialize(&cg->cg_handle, &callbacks); +- if (error != CPG_OK) { ++ if (error != CS_OK) { + log_error("cpg_initialize error %d", error); + goto out; + } +@@ -740,7 +740,7 @@ static void daemon_set_cgroup(struct cgr + + int setup_cpg(void (*daemon_joined)(int first)) + { +- cpg_error_t error; ++ cs_error_t error; + + INIT_LIST_HEAD(&group_list); + daemon_group.cg_set_cgroup = daemon_set_cgroup; +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:15:10.359879781 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:15:50.517076450 -0500 +@@ -651,255 +651,6 @@ static int proto_version_to_checkpoint(s + return 0; + } + +-static int checkpoint_to_proto_version(char *data, size_t data_len, +- struct ocfs2_protocol_version *proto) +-{ +- long major, minor; +- char *ptr; +- struct proto_version_str { +- char major[2]; +- char space; +- char minor[2]; +- char null; +- } str; +- +- if (data_len != sizeof(struct proto_version_str)) { +- log_error("Protocol version string \"%.*s\" has incorrect " +- "length", +- (int)data_len, data); +- return -EINVAL; +- } +- memcpy((char *)&str, data, data_len); +- +- if ((str.space != ' ') || (str.null != '\0')) { +- log_error("Protocol version string \"%.*s\" has invalid " +- "separators", +- (int)data_len, data); +- return -EINVAL; +- } +- str.space = '\0'; +- +- major = strtol(str.major, &ptr, 16); +- if (!ptr || *ptr) { +- log_error("Protocol request has bad version 0x%s 0x%s", +- str.major, str.minor); +- return -EINVAL; +- } +- minor = strtol(str.minor, &ptr, 16); +- if (!ptr || *ptr) { +- log_error("Protocol version string has bad version 0x%s 0x%s", +- str.major, str.minor); +- return -EINVAL; +- } +- +- /* The major and minor must be between 0 and 255, inclusive. */ +- if ((major == LONG_MIN) || (major == LONG_MAX) || +- (minor == LONG_MIN) || (minor == LONG_MAX) || +- (major > (uint8_t)-1) || (major < 0) || +- (minor > (uint8_t)-1) || (minor < 0)) { +- log_error("Protocol version string has bad version 0x%s 0x%s", +- str.major, str.minor); +- return -ERANGE; +- } +- +- proto->pv_major = major; +- proto->pv_minor = minor; +- +- return 0; +-} +- +-static int install_node_checkpoint(void) +-{ +- int rc; +- char *buf; +- errcode_t err; +- +- err = o2cb_get_max_locking_protocol(&fs_max_proto); +- if (err) { +- log_error("Error querying maximum filesystem locking " +- "protocol: %s", +- error_message(err)); +- rc = -EIO; +- goto out; +- } +- +- rc = ckpt_open_this_node(&node_handle); +- if (rc) +- goto out; +- +- rc = proto_version_to_checkpoint(&daemon_max_proto, &buf); +- if (rc) +- goto out; +- +- rc = ckpt_section_store(node_handle, DAEMON_MAX_PROTOCOL_SECTION, +- buf, strlen(buf) + 1); +- free(buf); +- if (rc) +- goto out; +- +- rc = proto_version_to_checkpoint(&fs_max_proto, &buf); +- if (rc) +- goto out; +- +- rc = ckpt_section_store(node_handle, FS_MAX_PROTOCOL_SECTION, +- buf, strlen(buf) + 1); +- free(buf); +- +-out: +- return rc; +-} +- +-static void drop_node_checkpoint(void) +-{ +- if (node_handle) +- ckpt_close(node_handle); +-} +- +-/* +- * If we're the only daemon running, install our maximum protocols +- * as the running values. +- */ +-static int install_global_checkpoint(void) +-{ +- int rc; +- char *buf; +- +- daemon_running_proto = daemon_max_proto; +- fs_running_proto = fs_max_proto; +- +- rc = ckpt_open_global(1); +- if (rc) +- goto out; +- +- rc = proto_version_to_checkpoint(&daemon_running_proto, &buf); +- if (rc) +- goto out; +- +- rc = ckpt_global_store(DAEMON_PROTOCOL_SECTION, buf, +- strlen(buf) + 1); +- free(buf); +- if (rc) +- goto out; +- +- rc = proto_version_to_checkpoint(&fs_running_proto, &buf); +- if (rc) +- goto out; +- +- rc = ckpt_global_store(FS_PROTOCOL_SECTION, buf, strlen(buf) + 1); +- free(buf); +- +-out: +- return rc; +-} +- +-/* +- * Compare the cluster's locking protocol version against our maximum. +- * +- * If the major numbers are different, they are incompatible. +- * If the cluster's minor is greater than our maximum minor, they are +- * incompatible. +- */ +-static int protocol_compatible(struct ocfs2_protocol_version *cluster, +- struct ocfs2_protocol_version *our_max) +-{ +- if (cluster->pv_major != our_max->pv_major) +- return 0; +- +- if (cluster->pv_minor > our_max->pv_minor) +- return 0; +- +- return 1; +-} +- +-static int read_global_checkpoint(void) +-{ +- int rc, seen = 0, opened = 0, retrycount = 0; +- char *buf; +- size_t len; +- +-retry: +- rc = ckpt_open_global(0); +- if (rc) +- goto out; +- seen = 1; +- opened = 1; +- +- rc = ckpt_global_get(DAEMON_PROTOCOL_SECTION, &buf, &len); +- if (rc) +- goto out; +- +- rc = checkpoint_to_proto_version(buf, len, &daemon_running_proto); +- free(buf); +- if (rc) +- goto out; +- if (!protocol_compatible(&daemon_running_proto, +- &daemon_max_proto)) { +- log_error("Our maximum daemon protocol (%d.%d) is not " +- "compatible with the cluster's protocol (%d.%d)", +- daemon_max_proto.pv_major, +- daemon_max_proto.pv_minor, +- daemon_running_proto.pv_major, +- daemon_running_proto.pv_minor); +- rc = -EPROTONOSUPPORT; +- goto out; +- } +- +- rc = ckpt_global_get(FS_PROTOCOL_SECTION, &buf, &len); +- if (rc) +- goto out; +- +- rc = checkpoint_to_proto_version(buf, len, &fs_running_proto); +- free(buf); +- if (rc) +- goto out; +- +- if (!protocol_compatible(&fs_running_proto, +- &fs_max_proto)) { +- log_error("Our maximum fs protocol (%d.%d) is not " +- "compatible with the cluster's protocol (%d.%d)", +- fs_max_proto.pv_major, +- fs_max_proto.pv_minor, +- fs_running_proto.pv_major, +- fs_running_proto.pv_minor); +- rc = -EPROTONOSUPPORT; +- } +- +-out: +- if (rc == -ENOENT) { +- /* +- * -ENOENT means the first daemon hasn't gotten the +- * global checkpoint fully installed yet. Either the +- * checkpoint or one of its sections is missing. +- * +- * If we saw the checkpoint once, but now it's gone, it +- * means the first daemon died. We don't recover from +- * that. But if we haven't seen the checkpoint yet, or if +- * it's just a missing section, we can keep trying. +- */ +- +- if (opened) +- ckpt_close_global(); +- +- if (seen && !opened) { +- log_error("The global checkpoint disappeared out " +- "from underneath us. This shouldn't " +- "happen to a daemon that is not the " +- "first in the cluster"); +- } else { +- opened = 0; +- retry_warning(retrycount, +- "Attempted to read the cluster's " +- "protocol versions %d times, still " +- "trying", +- retrycount); +- sleep_ms(10); +- goto retry; +- } +- } +- +- return rc; +-} +- + static void cpg_joined(int first) + { + int rv; +@@ -908,16 +659,6 @@ static void cpg_joined(int first) + log_debug("CPG is live, we are %s first daemon", + first ? "the" : "not the"); + +- if (first) +- rv = install_global_checkpoint(); +- else +- rv = read_global_checkpoint(); +- +- if (rv) { +- shutdown_daemon(); +- return; +- } +- + log_debug("Daemon protocol is %d.%d", + daemon_running_proto.pv_major, + daemon_running_proto.pv_minor); +@@ -1018,14 +759,6 @@ static int loop(void) + if (rv < 0) + goto out; + +- rv = setup_stack(); +- if (rv < 0) +- goto out; +- +- rv = setup_ckpt(); +- if (rv < 0) +- goto out; +- + rv = install_node_checkpoint(); + if (rv < 0) + goto out; +@@ -1077,9 +810,6 @@ stop: + o2cb_control_close(); + exit_dlmcontrol(); + exit_cpg(); +- drop_node_checkpoint(); +- exit_ckpt(); +- exit_stack(); + + out: + return rv; diff --git a/0002-Add-corosync-cfg-to-get-configuration-information.patch b/0002-Add-corosync-cfg-to-get-configuration-information.patch new file mode 100644 index 0000000..24f2ab2 --- /dev/null +++ b/0002-Add-corosync-cfg-to-get-configuration-information.patch @@ -0,0 +1,315 @@ +From 1a7b9a35228cd5ef9d6ad96ec35f6fc812ee821c Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Tue, 23 Jul 2013 12:09:28 -0500 +Subject: [PATCH 2/5] Add corosync cfg to get configuration information + +--- + ocfs2_controld/Makefile | 2 +- + ocfs2_controld/cpg.c | 1 - + ocfs2_controld/main.c | 58 ++------------------- + ocfs2_controld/member.c | 111 ++++++++++++++++++++++++++++++++++++++++ + ocfs2_controld/ocfs2_controld.h | 20 ++------ + 5 files changed, 119 insertions(+), 73 deletions(-) + create mode 100644 ocfs2_controld/member.c + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/Makefile 2013-07-31 08:25:43.559675366 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile 2013-07-31 08:26:05.733331692 -0500 +@@ -49,7 +49,7 @@ CMAN_CFILES = cman.c + CMAN_DAEMON_CFILES = $(DAEMON_CFILES) $(CMAN_CFILES) + CMAN_DAEMON_OBJS = $(subst .c,.o,$(CMAN_DAEMON_CFILES)) + +-COROSYNC_CFILES = ++COROSYNC_CFILES = member.c + COROSYNC_DAEMON_CFILES = $(DAEMON_CFILES) $(COROSYNC_CFILES) + COROSYNC_DAEMON_OBJS = $(subst .c,.o,$(COROSYNC_DAEMON_CFILES)) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/cpg.c 2013-07-31 08:25:34.868418089 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c 2013-07-31 08:25:43.559675366 -0500 +@@ -339,7 +339,6 @@ static void handle_daemon_left(struct cp + if (1) { + log_error("kill node %d - ocfs2_controld PROCDOWN", + addr->nodeid); +- kill_stack_node(addr->nodeid); + } + + /* FALL THROUGH */ +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:25:34.837417171 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:25:43.560675395 -0500 +@@ -114,10 +114,8 @@ static struct ocfs2_protocol_version dae + .pv_major = CONTROLD_PROTOCOL_MAJOR, + .pv_minor = CONTROLD_PROTOCOL_MINOR, + }; +-static struct ocfs2_protocol_version fs_max_proto; + struct ocfs2_protocol_version daemon_running_proto; + struct ocfs2_protocol_version fs_running_proto; +-struct ckpt_handle *node_handle; + + void shutdown_daemon(void) + { +@@ -254,11 +252,6 @@ static int do_mount(int ci, int fd, cons + goto fail; + } + +- if (!validate_cluster(cluster)) { +- error_msg = "Invalid cluster name"; +- goto fail; +- } +- + return start_mount(ci, fd, uuid, device, service); + + fail: +@@ -456,11 +449,6 @@ static int send_filesystems(int ci, int + goto fail; + } + +- if (!validate_cluster(cluster)) { +- error_msg = "Invalid cluster name"; +- goto fail; +- } +- + return send_mountgroups(ci, fd); + + fail: +@@ -471,15 +459,6 @@ static int send_clustername(int ci, int + { + int rc = 0, rctmp; + char error_msg[100]; /* Arbitrary size smaller than a message */ +- const char *cluster; +- +- rc = get_clustername(&cluster); +- if (rc) { +- snprintf(error_msg, sizeof(error_msg), +- "Unable to query cluster name: %s", +- strerror(-rc)); +- goto out_status; +- } + + /* Cman only supports one cluster */ + rc = send_message(fd, CM_ITEMCOUNT, 1); +@@ -490,7 +469,7 @@ static int send_clustername(int ci, int + goto out_status; + } + +- rc = send_message(fd, CM_ITEM, cluster); ++ rc = send_message(fd, CM_ITEM, cluster_name); + if (rc) { + snprintf(error_msg, sizeof(error_msg), + "Unable to send ITEM: %s", +@@ -630,27 +609,6 @@ static int setup_listener(void) + return 0; + } + +-static int proto_version_to_checkpoint(struct ocfs2_protocol_version *proto, +- char **checkpoint_data) +-{ +- size_t len; +- char *buf; +- +- len = snprintf(NULL, 0, "%02x %02x", proto->pv_major, +- proto->pv_minor); +- buf = malloc(sizeof(char) * (len + 1)); +- if (!buf) { +- log_error("Unable to allocate memory for checkpoint data"); +- return -ENOMEM; +- } +- +- snprintf(buf, len + 1, "%02x %02x", proto->pv_major, +- proto->pv_minor); +- *checkpoint_data = buf; +- +- return 0; +-} +- + static void cpg_joined(int first) + { + int rv; +@@ -759,7 +717,7 @@ static int loop(void) + if (rv < 0) + goto out; + +- rv = install_node_checkpoint(); ++ rv = setup_cluster_cfg(); + if (rv < 0) + goto out; + +@@ -1032,17 +990,6 @@ int main(int argc, char **argv) + return 1; + } + +- err = o2cb_get_stack_name(&stack); +- if (err) { +- com_err(prog_name, err, "while determining the current cluster stack"); +- return 1; +- } +- if (strcmp(stack, stackname)) { +- log_error("%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use", +- prog_name, stackname, stack); +- return 1; +- } +- + if (!daemon_debug_opt) + daemonize(); + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c 2013-07-31 08:25:43.560675395 -0500 +@@ -0,0 +1,111 @@ ++#include ++#include ++#include ++#include ++ ++#include "ocfs2_controld.h" ++#include ++#include ++#include ++ ++ ++char cluster_name[65]; ++int our_nodeid; ++ ++static corosync_cfg_handle_t ch; ++ ++static int detect_cluster_name(void) ++{ ++ cmap_handle_t handle; ++ char *str = NULL; ++ int rv, err = -1; ++ ++ rv = cmap_initialize(&handle); ++ if (rv != CS_OK) { ++ log_error("cmap_initialize error %d", rv); ++ return -1; ++ } ++ ++ rv = cmap_get_string(handle, "totem.cluster_name", &str); ++ if (rv != CS_OK) { ++ log_error("cmap_get_string totem.cluster_name error %d", rv); ++ goto out; ++ } else ++ err = 0; ++ ++ log_debug("cmap totem.cluster_name = '%s'", str); ++ ++ strncpy(cluster_name, str, 64); ++out: ++ if (str) ++ free(str); ++ cmap_finalize(handle); ++ return err; ++} ++ ++static void shutdown_callback(corosync_cfg_handle_t h, ++ corosync_cfg_shutdown_flags_t flags) ++{ ++ if (flags & COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST) { ++ log_debug("shutdown request yes"); ++ corosync_cfg_replyto_shutdown(ch, COROSYNC_CFG_SHUTDOWN_FLAG_YES); ++ } ++} ++ ++static corosync_cfg_callbacks_t cfg_callbacks = ++{ ++ .corosync_cfg_shutdown_callback = shutdown_callback, ++}; ++ ++int setup_cluster_cfg(void) ++{ ++ cs_error_t err; ++ unsigned int nodeid; ++ int fd; ++ int retry = 1; ++ ++try_again: ++ err = corosync_cfg_initialize(&ch, &cfg_callbacks); ++ if (err != CS_OK) { ++ if ((err == CS_ERR_TRY_AGAIN) && (retry <= 10)) { ++ log_error("corosync has not completed initialization.. retry %d", retry); ++ sleep(1); ++ retry++; ++ goto try_again; ++ } ++ log_error("corosync cfg init error %d", err); ++ return -1; ++ } ++ ++ err = corosync_cfg_fd_get(ch, &fd); ++ if (err != CS_OK) { ++ log_error("corosync cfg fd_get error %d", err); ++ corosync_cfg_finalize(ch); ++ return -1; ++ } ++ ++ err = corosync_cfg_local_get(ch, &nodeid); ++ if (err != CS_OK) { ++ log_error("corosync cfg local_get error %d", err); ++ corosync_cfg_finalize(ch); ++ return -1; ++ } ++ ++ our_nodeid = nodeid; ++ log_debug("our_nodeid %d", our_nodeid); ++ ++ if (our_nodeid < 0) { ++ log_error("negative nodeid, set corosync totem.clear_node_high_bit"); ++ corosync_cfg_finalize(ch); ++ return -1; ++ } ++ ++ return fd; ++} ++ ++void close_cluster_cfg(void) ++{ ++ corosync_cfg_finalize(ch); ++} ++ ++ +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/ocfs2_controld.h +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/ocfs2_controld.h 2013-07-31 08:25:34.869418118 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/ocfs2_controld.h 2013-07-31 08:25:43.560675395 -0500 +@@ -39,6 +39,7 @@ extern int dump_point; + extern int dump_wrap; + extern int our_nodeid; + extern const char *stackname; ++extern char cluster_name[65]; + + extern void daemon_dump_save(void); + +@@ -70,25 +71,12 @@ int connection_add(int fd, void (*work)( + void connection_dead(int ci); + void shutdown_daemon(void); + +-/* ckpt.c */ +-int setup_ckpt(void); +-void exit_ckpt(void); +-int ckpt_open_global(int write); +-void ckpt_close_global(void); +-int ckpt_open_node(int nodeid, struct ckpt_handle **handle); +-int ckpt_open_this_node(struct ckpt_handle **handle); +-void ckpt_close(struct ckpt_handle *handle); +-int ckpt_global_store(const char *section, const char *data, size_t data_len); +-int ckpt_global_get(const char *section, char **data, size_t *data_len); +-int ckpt_section_store(struct ckpt_handle *handle, const char *section, +- const char *data, size_t data_len); +-int ckpt_section_get(struct ckpt_handle *handle, const char *section, +- char **data, size_t *data_len); +- ++/* member.c */ ++int setup_cluster_cfg(void); ++void close_cluster_cfg(void); + /* stack-specific interfaces (cman.c) */ + int setup_stack(void); + char *nodeid2name(int nodeid); +-int validate_cluster(const char *cluster); + int get_clustername(const char **cluster); + int kill_stack_node(int nodeid); + void exit_stack(void); diff --git a/0003-Hard-code-protocol-versions.patch b/0003-Hard-code-protocol-versions.patch new file mode 100644 index 0000000..685ca4b --- /dev/null +++ b/0003-Hard-code-protocol-versions.patch @@ -0,0 +1,30 @@ +From 1b81ab8b660db633aff609bfae4609efe24b9b93 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Sat, 27 Jul 2013 14:28:48 -0500 +Subject: [PATCH 3/5] Hard-code protocol versions. + +This is just a work around. Protocol detection needs some work. +--- + ocfs2_controld/main.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:21:50.088759215 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:22:27.023854129 -0500 +@@ -617,9 +617,15 @@ static void cpg_joined(int first) + log_debug("CPG is live, we are %s first daemon", + first ? "the" : "not the"); + ++ daemon_running_proto.pv_major = 1; ++ daemon_running_proto.pv_minor = 0; ++ + log_debug("Daemon protocol is %d.%d", + daemon_running_proto.pv_major, + daemon_running_proto.pv_minor); ++ ++ fs_running_proto.pv_major = 1; ++ fs_running_proto.pv_minor = 0; + log_debug("fs protocol is %d.%d", + fs_running_proto.pv_major, fs_running_proto.pv_minor); + diff --git a/0005-Add-cluster_name-and-stack-name.patch b/0005-Add-cluster_name-and-stack-name.patch new file mode 100644 index 0000000..c608f65 --- /dev/null +++ b/0005-Add-cluster_name-and-stack-name.patch @@ -0,0 +1,31 @@ +From af06444bea1bcc8006c295a5a2663e0372814df5 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Sun, 28 Jul 2013 17:49:21 -0500 +Subject: [PATCH 5/5] Add cluster_name and stack name + +--- + ocfs2_controld/member.c | 4 ++++ + 1 file changed, 4 insertions(+) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/member.c 2013-07-31 08:20:04.239619381 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c 2013-07-31 08:23:47.608241901 -0500 +@@ -11,6 +11,8 @@ + + char cluster_name[65]; + int our_nodeid; ++/* Using pcmk for legacy reasons */ ++const char *stackname = "pcmk"; + + static corosync_cfg_handle_t ch; + +@@ -93,6 +95,8 @@ try_again: + + our_nodeid = nodeid; + log_debug("our_nodeid %d", our_nodeid); ++ detect_cluster_name(); ++ log_debug("our cluster name %s", cluster_name); + + if (our_nodeid < 0) { + log_error("negative nodeid, set corosync totem.clear_node_high_bit"); diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 0bb3036..3fc7582 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Jul 31 08:01:02 CDT 2013 - rgoldwyn@suse.com +- Get ocfs2_controld up to speed with corosync 2.3.x + + 0001-Remove-pacemaker-ais-stuff.patch + + 0002-Add-corosync-cfg-to-get-configuration-information.patch + + 0003-Hard-code-protocol-versions.patch + + 0005-Add-cluster_name-and-stack-name.patch + - ocfs2_controld-pacemaker.diff + ------------------------------------------------------------------- Mon Jul 22 10:57:44 UTC 2013 - ygao@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index 7a59bcc..dcf66e3 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -29,7 +29,6 @@ Source2: reflink.tar.bz2 Patch101: force-debug.patch Patch102: extra-debug.patch Patch103: debug-ocfs2_hb_ctl.patch -Patch104: ocfs2_controld-pacemaker.diff Patch105: bug-470741-debug_start_failures.patch Patch106: ocfs2-devel.diff Patch107: reflink-no-syscall.patch @@ -46,14 +45,17 @@ Patch212: bug-805764-ocfs2-controld.patch Patch213: bnc804707-reduce-RR-priority.patch Patch214: use-symlink-in-udev-rules.patch Patch215: ocfs2console-libraries-include-aio.patch +Patch216: 0001-Remove-pacemaker-ais-stuff.patch +Patch217: 0002-Add-corosync-cfg-to-get-configuration-information.patch +Patch218: 0003-Hard-code-protocol-versions.patch +Patch219: 0005-Add-cluster_name-and-stack-name.patch + BuildRequires: autoconf BuildRequires: e2fsprogs-devel BuildRequires: libaio-devel BuildRequires: libbz2-devel BuildRequires: libcorosync-devel BuildRequires: libdlm-devel -BuildRequires: libopenais-devel -BuildRequires: libpacemaker-devel BuildRequires: libxslt-devel BuildRequires: libz1 BuildRequires: python-devel @@ -69,7 +71,6 @@ Requires: e2fsprogs Requires: glib2 >= 2.2.3 Requires: modutils Requires: net-tools -Requires: openais BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} < 1120 # There's no separate kmp for openSUSE 11.2 @@ -128,7 +129,6 @@ managing the file system. %patch101 -p1 %patch102 -p1 %patch103 -p1 -%patch104 -p1 %patch105 -p1 %patch106 -p1 %patch107 -p0 @@ -145,6 +145,10 @@ managing the file system. %patch213 -p1 %patch214 -p1 %patch215 -p1 +%patch216 -p1 +%patch217 -p1 +%patch218 -p1 +%patch219 -p1 %build export PROJECT="ocfs2-tools" diff --git a/ocfs2_controld-pacemaker.diff b/ocfs2_controld-pacemaker.diff deleted file mode 100644 index f6f5e8d..0000000 --- a/ocfs2_controld-pacemaker.diff +++ /dev/null @@ -1,67 +0,0 @@ -Index: ocfs2-tools/ocfs2_controld/pacemaker.c -=================================================================== ---- ocfs2-tools.orig/ocfs2_controld/pacemaker.c -+++ ocfs2-tools/ocfs2_controld/pacemaker.c -@@ -28,9 +28,8 @@ - #define SUPPORT_HEARTBEAT 0 - - #include --#include --#include --#include -+#include -+#include - #include - #include - -@@ -47,6 +46,7 @@ static char * clustername = "pacemaker" - extern struct list_head mounts; - const char *stackname = "pcmk"; - -+static crm_cluster_t crm_cluster; - extern int ais_fd_async; - char *local_node_uname = NULL; - -@@ -138,33 +138,34 @@ static void dead_pcmk(int ci) - connection_dead(ci); - } - --extern void terminate_ais_connection(void); -- - void exit_stack(void) - { - log_debug("closing pacemaker connection"); -- terminate_ais_connection(); -+ crm_cluster_disconnect(&crm_cluster); - } - - static void process_pcmk(int ci) - { -- ais_dispatch(ais_fd_async, NULL); -+ plugin_dispatch(&crm_cluster); - } - - int setup_stack(void) - { -- crm_log_init("ocfs2_controld", LOG_INFO, FALSE, TRUE, 0, NULL); -+ crm_log_init("ocfs2_controld", LOG_INFO, FALSE, TRUE, 0, NULL, FALSE); - -- if(init_ais_connection(NULL, NULL, NULL, &local_node_uname, &our_nodeid) == FALSE) { -+ if(crm_cluster_connect(&crm_cluster) == FALSE) { - log_error("Connection to our AIS plugin (CRM) failed"); - return -1; - } - -+ local_node_uname = crm_cluster.uname; -+ our_nodeid = crm_cluster.nodeid; -+ - /* Sign up for membership updates */ -- send_ais_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais); -+ send_cluster_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais); - - /* Requesting the current list of known nodes */ -- send_ais_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais); -+ send_cluster_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais); - - log_debug("Cluster connection established. Local node id: %d", our_nodeid); - From e8ad07eb47a440575f8fa0009cb8acf97df3d82c Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Mon, 5 Aug 2013 13:22:45 +0000 Subject: [PATCH 03/11] Accepting request 185942 from home:goldwynr:branches:network:ha-clustering:Factory Added libdlm and libcorosync in Requires OBS-URL: https://build.opensuse.org/request/show/185942 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=61 --- ocfs2-tools.changes | 6 ++++++ ocfs2-tools.spec | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 3fc7582..2a0b069 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,5 +1,11 @@ +------------------------------------------------------------------- +Mon Aug 5 07:40:31 CDT 2013 - rgoldwyn@suse.com + +- Add libcorosync4 and libdlm3 in Requires. + ------------------------------------------------------------------- Wed Jul 31 08:01:02 CDT 2013 - rgoldwyn@suse.com + - Get ocfs2_controld up to speed with corosync 2.3.x + 0001-Remove-pacemaker-ais-stuff.patch + 0002-Add-corosync-cfg-to-get-configuration-information.patch diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index dcf66e3..babd7d0 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -69,6 +69,8 @@ Requires(pre): %insserv_prereq Requires: /sbin/chkconfig Requires: e2fsprogs Requires: glib2 >= 2.2.3 +Requires: libcorosync4 +Requires: libdlm3 Requires: modutils Requires: net-tools BuildRoot: %{_tmppath}/%{name}-%{version}-build From 7cec29fa9054d61e5ad982ec44119ed0cc201793 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Thu, 8 Aug 2013 11:56:48 +0000 Subject: [PATCH 04/11] Accepting request 186141 from home:goldwynr:branches:network:ha-clustering:Factory Fix FS protocol versions: + 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch - 0003-Hard-code-protocol-versions.patch OBS-URL: https://build.opensuse.org/request/show/186141 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=62 --- 0003-Hard-code-protocol-versions.patch | 30 --- ...otocol-versions-and-consolidate-fs-v.patch | 188 ++++++++++++++++++ ocfs2-tools.changes | 7 + ocfs2-tools.spec | 2 +- 4 files changed, 196 insertions(+), 31 deletions(-) delete mode 100644 0003-Hard-code-protocol-versions.patch create mode 100644 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch diff --git a/0003-Hard-code-protocol-versions.patch b/0003-Hard-code-protocol-versions.patch deleted file mode 100644 index 685ca4b..0000000 --- a/0003-Hard-code-protocol-versions.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1b81ab8b660db633aff609bfae4609efe24b9b93 Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Sat, 27 Jul 2013 14:28:48 -0500 -Subject: [PATCH 3/5] Hard-code protocol versions. - -This is just a work around. Protocol detection needs some work. ---- - ocfs2_controld/main.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:21:50.088759215 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:22:27.023854129 -0500 -@@ -617,9 +617,15 @@ static void cpg_joined(int first) - log_debug("CPG is live, we are %s first daemon", - first ? "the" : "not the"); - -+ daemon_running_proto.pv_major = 1; -+ daemon_running_proto.pv_minor = 0; -+ - log_debug("Daemon protocol is %d.%d", - daemon_running_proto.pv_major, - daemon_running_proto.pv_minor); -+ -+ fs_running_proto.pv_major = 1; -+ fs_running_proto.pv_minor = 0; - log_debug("fs protocol is %d.%d", - fs_running_proto.pv_major, fs_running_proto.pv_minor); - diff --git a/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch b/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch new file mode 100644 index 0000000..a8aed70 --- /dev/null +++ b/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch @@ -0,0 +1,188 @@ +From f49e6a0dd32f1b891a9281584a6c2516afe3d200 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Sat, 27 Jul 2013 14:28:48 -0500 +Subject: [PATCH 3/5] Remove daemon protocol versions and consolidate fs + versions + +We don't need the daemon protocol version. If there is a need +you can think of, please let me know. +--- + ocfs2_controld/main.c | 124 +++++++++++++++++++++++++++----------------------- + 1 file changed, 67 insertions(+), 57 deletions(-) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-08-06 09:55:48.527750439 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-08-06 09:55:48.544750962 -0500 +@@ -47,12 +47,14 @@ + #define LOCKFILE_NAME "/var/run/ocfs2_controld.pid" + #define NALLOC 8 + +-#define CONTROLD_PROTOCOL_MAJOR 1 +-#define CONTROLD_PROTOCOL_MINOR 0 +-#define DAEMON_MAX_PROTOCOL_SECTION "daemon_max_protocol" +-#define DAEMON_PROTOCOL_SECTION "daemon_protocol" +-#define FS_MAX_PROTOCOL_SECTION "ocfs2_max_protocol" +-#define FS_PROTOCOL_SECTION "ocfs2_protocol" ++#define FS_PROTOCOL_MAJOR 1 ++#define FS_PROTOCOL_MINOR 0 ++ ++static struct ocfs2_protocol_version fs_max_proto = { ++ .pv_major = FS_PROTOCOL_MAJOR, ++ .pv_minor = FS_PROTOCOL_MINOR, ++}; ++ + + struct client { + int fd; +@@ -80,41 +82,6 @@ char dump_buf[DUMP_SIZE]; + int dump_point; + int dump_wrap; + +-/* +- * Protocol negotiation. +- * +- * This is the maximum protocol supported by the daemon for inter-daemon +- * communication. The negotiated value daemon_running_proto is what the +- * daemon uses at runtime. +- * +- * All daemons must support the initial protocol, which works as follows: +- * Prior to starting CPG, daemons store two values in the local node +- * checkpoint. The maximum daemon protocol is stored in the +- * "daemon_max_protocol" section, and the ocfs2 maximum protocol is stored +- * in the "ocfs2_max_protocol" section. The protocols are stored in the +- * format: +- * +- * <2-char-hex-major><2-char-hex-minor> +- * +- * These sections MUST be created before CPG is started. Other sections +- * MUST NOT be created at this time. +- * +- * Once CPG is started, the daemon reads the "daemon_protocol" and +- * "ocfs2_protocol" sections from the daemon's global checkpoint. The +- * values are stored as the running versions. All interaction takes place +- * based on the running versions. At this point, the daemon may add +- * other sections to the local node checkpoint that are part of the +- * running protocol. +- * +- * If the daemon is the first node to join the group, it sets the +- * "daemon_protocol" and "ocfs2_protocol" sections of the global checkpoint +- * to the maximum values this daemon supports. +- */ +-static struct ocfs2_protocol_version daemon_max_proto = { +- .pv_major = CONTROLD_PROTOCOL_MAJOR, +- .pv_minor = CONTROLD_PROTOCOL_MINOR, +-}; +-struct ocfs2_protocol_version daemon_running_proto; + struct ocfs2_protocol_version fs_running_proto; + + void shutdown_daemon(void) +@@ -609,6 +576,51 @@ static int setup_listener(void) + return 0; + } + ++/* ++ * Compare the cluster's locking protocol version against our maximum. ++ * ++ * If the major numbers are different, they are incompatible. ++ * If the cluster's minor is greater than our maximum minor, they are ++ * incompatible. ++ */ ++static int protocol_compatible(struct ocfs2_protocol_version *cluster, ++ struct ocfs2_protocol_version *our_max) ++{ ++ if (cluster->pv_major != our_max->pv_major) ++ return 0; ++ ++ if (cluster->pv_minor > our_max->pv_minor) ++ return 0; ++ ++ return 1; ++} ++ ++static int check_protocol_version(void) ++{ ++ int rc = 0; ++ ++ fs_running_proto.pv_major = 1; ++ fs_running_proto.pv_minor = 0; ++ ++ o2cb_get_max_locking_protocol(&fs_max_proto); ++ ++ if (!protocol_compatible(&fs_running_proto, ++ &fs_max_proto)) { ++ log_error("Our maximum fs protocol (%d.%d) is not " ++ "compatible with the cluster's protocol (%d.%d)", ++ fs_max_proto.pv_major, ++ fs_max_proto.pv_minor, ++ fs_running_proto.pv_major, ++ fs_running_proto.pv_minor); ++ rc = -EPROTONOSUPPORT; ++ } ++ ++ log_debug("fs protocol is %d.%d", ++ fs_running_proto.pv_major, fs_running_proto.pv_minor); ++ return rc; ++ ++} ++ + static void cpg_joined(int first) + { + int rv; +@@ -617,34 +629,33 @@ static void cpg_joined(int first) + log_debug("CPG is live, we are %s first daemon", + first ? "the" : "not the"); + +- log_debug("Daemon protocol is %d.%d", +- daemon_running_proto.pv_major, +- daemon_running_proto.pv_minor); +- log_debug("fs protocol is %d.%d", +- fs_running_proto.pv_major, fs_running_proto.pv_minor); ++ rv = check_protocol_version(); ++ if (rv) ++ goto error; + + log_debug("Connecting to dlm_controld"); + rv = setup_dlmcontrol(); +- if (rv) { +- shutdown_daemon(); +- return; +- } ++ if (rv) ++ goto error; + + log_debug("Opening control device"); + err = o2cb_control_open(our_nodeid, &fs_running_proto); + if (err) { + log_error("Error opening control device: %s", + error_message(err)); +- shutdown_daemon(); +- return; ++ goto error; + } + + log_debug("Starting to listen for mounters"); + rv = setup_listener(); +- if (rv < 0) { +- shutdown_daemon(); +- return; +- } ++ if (rv < 0) ++ goto error; ++ ++ return; ++error: ++ shutdown_daemon(); ++ return; ++ + } + + static int find_minors(void) +@@ -975,7 +986,6 @@ int main(int argc, char **argv) + { + errcode_t err; + prog_name = argv[0]; +- const char *stack = NULL; + + decode_arguments(argc, argv); + diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 2a0b069..5506567 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,4 +1,11 @@ ------------------------------------------------------------------- + +Tue Aug 6 09:21:41 CDT 2013 - rgoldwyn@suse.com +- Fix FS protocol versions: + + 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch + - 0003-Hard-code-protocol-versions.patch + +------------------------------------------------------------------- Mon Aug 5 07:40:31 CDT 2013 - rgoldwyn@suse.com - Add libcorosync4 and libdlm3 in Requires. diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index babd7d0..1e6706f 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -47,7 +47,7 @@ Patch214: use-symlink-in-udev-rules.patch Patch215: ocfs2console-libraries-include-aio.patch Patch216: 0001-Remove-pacemaker-ais-stuff.patch Patch217: 0002-Add-corosync-cfg-to-get-configuration-information.patch -Patch218: 0003-Hard-code-protocol-versions.patch +Patch218: 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch Patch219: 0005-Add-cluster_name-and-stack-name.patch BuildRequires: autoconf From 8031d741d2ed314ffc2555fda4a71329b3d41370 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Mon, 12 Aug 2013 20:16:37 +0000 Subject: [PATCH 05/11] Accepting request 186797 from home:goldwynr:branches:network:ha-clustering:Factory add libraries in devel OBS-URL: https://build.opensuse.org/request/show/186797 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=63 --- libocfs2-needs-libaio.patch | 11 +++++++++++ ocfs2-tools.changes | 12 +++++++----- ocfs2-tools.spec | 12 ++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 libocfs2-needs-libaio.patch diff --git a/libocfs2-needs-libaio.patch b/libocfs2-needs-libaio.patch new file mode 100644 index 0000000..e351024 --- /dev/null +++ b/libocfs2-needs-libaio.patch @@ -0,0 +1,11 @@ +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2.pc.in +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2.pc.in 2013-04-02 04:38:06.452732480 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2.pc.in 2013-08-09 16:51:54.933245397 -0500 +@@ -7,5 +7,5 @@ Name: ocfs2 + Description: Userspace ocfs2 library + Version: @VERSION@ + Requires: o2dlm o2cb com_err +-Libs: -L${libdir} -locfs2 ++Libs: -L${libdir} -locfs2 -laio + Cflags: -I${includedir} diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 5506567..e1ebb70 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,15 +1,17 @@ ------------------------------------------------------------------- +Fri Aug 9 13:55:01 CDT 2013 - rgoldwyn@suse.com +- Add libraries back in devel package. This is required for + ocfs2-test +- libocfs2-needs-libaio.patch: Add -laio to ocfs2.pc + +------------------------------------------------------------------- Tue Aug 6 09:21:41 CDT 2013 - rgoldwyn@suse.com + - Fix FS protocol versions: + 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch - 0003-Hard-code-protocol-versions.patch -------------------------------------------------------------------- -Mon Aug 5 07:40:31 CDT 2013 - rgoldwyn@suse.com - -- Add libcorosync4 and libdlm3 in Requires. - ------------------------------------------------------------------- Wed Jul 31 08:01:02 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index 1e6706f..c097c3e 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -49,6 +49,7 @@ Patch216: 0001-Remove-pacemaker-ais-stuff.patch Patch217: 0002-Add-corosync-cfg-to-get-configuration-information.patch Patch218: 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch Patch219: 0005-Add-cluster_name-and-stack-name.patch +Patch220: libocfs2-needs-libaio.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -69,8 +70,6 @@ Requires(pre): %insserv_prereq Requires: /sbin/chkconfig Requires: e2fsprogs Requires: glib2 >= 2.2.3 -Requires: libcorosync4 -Requires: libdlm3 Requires: modutils Requires: net-tools BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -151,6 +150,7 @@ managing the file system. %patch217 -p1 %patch218 -p1 %patch219 -p1 +%patch220 -p1 %build export PROJECT="ocfs2-tools" @@ -188,8 +188,9 @@ cd .. mv %{buildroot}/{,/usr}/sbin/o2image mv %{buildroot}/{,/usr}/sbin/debugfs.ocfs2 mv %{buildroot}/{,/usr}/sbin/ocfs2_controld.pcmk -find %{buildroot} -name '*.a' -type f -print0 | xargs -0 rm -f -find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f +chmod a-x %{buildroot}/%{_libdir}/libo2cb.a +chmod a-x %{buildroot}/%{_libdir}/libo2dlm.a +chmod a-x %{buildroot}/%{_libdir}/libocfs2.a python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir}/ocfs2interface', ddir='%{py_sitedir}/ocfs2interface')" %preun o2cb @@ -270,5 +271,8 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} %{_libdir}/pkgconfig/o2cb.pc %{_libdir}/pkgconfig/o2dlm.pc %{_libdir}/pkgconfig/ocfs2.pc +%{_libdir}/libo2cb.a +%{_libdir}/libo2dlm.a +%{_libdir}/libocfs2.a %changelog From ab40e465fce410aeef3c425f9073bbf10eb181c3 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Sat, 24 Aug 2013 04:21:23 +0000 Subject: [PATCH 06/11] Accepting request 196156 from home:goldwynr:branches:network:ha-clustering:Factory - Make mount.ocfs2 load modules and write cluster_stack: + 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch - Mark o2cb.ocf as obsolete. Anyone using o2cb.ocf will get an info message stating so. - The nocontrold effort (added nocontrold patches and disabled corosync-2.3 controld compatibility patches): + 0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch + 0002-libo2cb-Remove-rest-of-controld-functions.patch + 0003-Get-cluster-name-from-corosync-cmap.patch + 0004-Remove-controld-structures-from-debugfs.ocfs2.patch + 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch + 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch - 0001-Remove-pacemaker-ais-stuff.patch - 0002-Add-corosync-cfg-to-get-configuration-information.patch - 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch - 0005-Add-cluster_name-and-stack-name.patch - libocfs2-Change-asserts-to-error.patch: Return control to fsck.ocfs2 instead of erring OBS-URL: https://build.opensuse.org/request/show/196156 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=64 --- ...ontrold-actions-from-group-join-leav.patch | 181 +++++++ ...cb-Remove-rest-of-controld-functions.patch | 450 ++++++++++++++++++ ...-Get-cluster-name-from-corosync-cmap.patch | 62 +++ ...ntrold-structures-from-debugfs.ocfs2.patch | 64 +++ ...rnel-version-in-user_begin_group_joi.patch | 44 ++ ...-cmap-and-dlm-libraries-in-the-tools.patch | 121 +++++ ...orms-module-loading-cluster_stack-se.patch | 206 ++++++++ libocfs2-Change-asserts-to-error.patch | 23 + o2cb.ocf | 385 +-------------- ocfs2-tools.changes | 34 ++ ocfs2-tools.spec | 28 +- 11 files changed, 1215 insertions(+), 383 deletions(-) create mode 100644 0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch create mode 100644 0002-libo2cb-Remove-rest-of-controld-functions.patch create mode 100644 0003-Get-cluster-name-from-corosync-cmap.patch create mode 100644 0004-Remove-controld-structures-from-debugfs.ocfs2.patch create mode 100644 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch create mode 100644 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch create mode 100644 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch create mode 100644 libocfs2-Change-asserts-to-error.patch diff --git a/0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch b/0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch new file mode 100644 index 0000000..41b5d2b --- /dev/null +++ b/0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch @@ -0,0 +1,181 @@ +From 2d1b78517ff14633f4b1cf4adddf6308721f9722 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 08:20:32 -0500 +Subject: [PATCH 1/7] libo2cb: Remove controld actions from group join/leave + +--- + libo2cb/o2cb_abi.c | 152 +---------------------------------------------------- + 1 file changed, 2 insertions(+), 150 deletions(-) + +diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c +index ae03595..4e689cd 100644 +--- a/libo2cb/o2cb_abi.c ++++ b/libo2cb/o2cb_abi.c +@@ -1373,162 +1373,14 @@ static errcode_t user_parse_status(char **args, int *error, char **error_msg) + static errcode_t user_begin_group_join(struct o2cb_cluster_desc *cluster, + struct o2cb_region_desc *region) + { +- errcode_t err; +- int rc; +- int error; +- char *error_msg; +- client_message message; +- char *argv[OCFS2_CONTROLD_MAXARGS + 1]; +- char buf[OCFS2_CONTROLD_MAXLINE]; +- +- if (control_daemon_fd != -1) { +- /* fprintf(stderr, "Join already in progress!\n"); */ +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- } +- +- rc = ocfs2_client_connect(); +- if (rc < 0) { +- /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", +- strerror(-rc)); */ +- switch (rc) { +- case -EACCES: +- case -EPERM: +- err = O2CB_ET_PERMISSION_DENIED; +- break; +- +- default: +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- break; +- } +- goto out; +- } +- control_daemon_fd = rc; +- +- rc = send_message(control_daemon_fd, CM_MOUNT, OCFS2_FS_NAME, +- region->r_name, cluster->c_cluster, +- region->r_device_name, region->r_service); +- if (rc) { +- /* fprintf(stderr, "Unable to send MOUNT message: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- rc = receive_message(control_daemon_fd, buf, &message, argv); +- if (rc < 0) { +- /* fprintf(stderr, "Error reading from daemon: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- switch (message) { +- case CM_STATUS: +- err = user_parse_status(argv, &error, &error_msg); +- if (err) { +- /* fprintf(stderr, "Bad status message: %s\n", +- strerror(-rc)); */ +- goto out; +- } +- if (error && (error != EALREADY)) { +- /* fprintf(stderr, +- "Error %d from daemon: %s\n", +- error, error_msg); */ +- err = O2CB_ET_CONFIGURATION_ERROR; +- goto out; +- } +- break; +- +- default: +- /* fprintf(stderr, +- "Unexpected message %s from daemon\n", +- message_to_string(message)); */ +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- break; +- } +- +- err = 0; +- +-out: +- if (err && (control_daemon_fd != -1)) { +- close(control_daemon_fd); +- control_daemon_fd = -1; +- } +- +- return err; ++ return 0; + } + + static errcode_t user_complete_group_join(struct o2cb_cluster_desc *cluster, + struct o2cb_region_desc *region, + int result) + { +- errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; +- int rc; +- int error; +- char *error_msg; +- client_message message; +- char *argv[OCFS2_CONTROLD_MAXARGS + 1]; +- char buf[OCFS2_CONTROLD_MAXLINE]; +- +- if (control_daemon_fd == -1) { +- /* fprintf(stderr, "Join not started!\n"); */ +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- goto out; +- } +- +- rc = send_message(control_daemon_fd, CM_MRESULT, OCFS2_FS_NAME, +- region->r_name, result, region->r_service); +- if (rc) { +- /* fprintf(stderr, "Unable to send MRESULT message: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- rc = receive_message(control_daemon_fd, buf, &message, argv); +- if (rc < 0) { +- /* fprintf(stderr, "Error reading from daemon: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- switch (message) { +- case CM_STATUS: +- err = user_parse_status(argv, &error, &error_msg); +- if (err) { +- /* fprintf(stderr, "Bad status message: %s\n", +- strerror(-rc)); */ +- goto out; +- } +- if (error) { +- /* fprintf(stderr, +- "Error %d from daemon: %s\n", +- error, error_msg); */ +- err = O2CB_ET_CONFIGURATION_ERROR; +- } +- break; +- +- default: +- /* fprintf(stderr, +- "Unexpected message %s from daemon\n", +- message_to_string(message)); */ +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- break; +- } +- +- err = 0; +- +-out: +- if (control_daemon_fd != -1) { +- close(control_daemon_fd); +- control_daemon_fd = -1; +- } +- +- return err; ++ return 0; + } + + static errcode_t user_group_leave(struct o2cb_cluster_desc *cluster, +-- +1.8.1.4 + diff --git a/0002-libo2cb-Remove-rest-of-controld-functions.patch b/0002-libo2cb-Remove-rest-of-controld-functions.patch new file mode 100644 index 0000000..a586e83 --- /dev/null +++ b/0002-libo2cb-Remove-rest-of-controld-functions.patch @@ -0,0 +1,450 @@ +From 40b1211091b62a4884d1625fc04d476a07489ca3 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 08:38:59 -0500 +Subject: [PATCH 2/7] libo2cb: Remove rest of controld functions + +--- + libo2cb/o2cb_abi.c | 388 +---------------------------------------------------- + 1 file changed, 2 insertions(+), 386 deletions(-) + +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/libo2cb/o2cb_abi.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/libo2cb/o2cb_abi.c 2013-08-23 22:50:22.129878132 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/libo2cb/o2cb_abi.c 2013-08-23 22:52:20.143277130 -0500 +@@ -46,7 +46,6 @@ + #define CLUSTER_STACK_FILE "/sys/fs/ocfs2/cluster_stack" + #define LOCKING_PROTOCOL_FILE "/sys/fs/ocfs2/max_locking_protocol" + #define OCFS2_STACK_LABEL_LEN 4 +-#define CONTROL_DEVICE "/dev/misc/ocfs2_control" + + static errcode_t o2cb_validate_cluster_name(struct o2cb_cluster_desc *desc); + static errcode_t o2cb_validate_cluster_flags(struct o2cb_cluster_desc *desc, +@@ -106,8 +105,6 @@ static struct o2cb_stack user_stack = { + }; + + static struct o2cb_stack *current_stack; +-static int control_daemon_fd = -1; +-static int control_device_fd = -1; + + static char *configfs_path; + +@@ -1349,27 +1346,6 @@ static errcode_t classic_complete_group_ + return ret; + } + +-static errcode_t user_parse_status(char **args, int *error, char **error_msg) +-{ +- errcode_t err = O2CB_ET_IO; +- long result; +- char *ptr = NULL; +- +- result = strtol(args[0], &ptr, 10); +- if (ptr && *ptr != '\0') { +- /* fprintf(stderr, "Invalid error code string: %s", args[0]); */ +- } else if ((result == LONG_MIN) || (result == LONG_MAX) || +- (result < INT_MIN) || (result > INT_MAX)) { +- /* fprintf(stderr, "Error code %ld out of range", err); */ +- } else { +- *error_msg = args[1]; +- *error = result; +- err = 0; +- } +- +- return err; +-} +- + static errcode_t user_begin_group_join(struct o2cb_cluster_desc *cluster, + struct o2cb_region_desc *region) + { +@@ -1386,90 +1362,7 @@ static errcode_t user_complete_group_joi + static errcode_t user_group_leave(struct o2cb_cluster_desc *cluster, + struct o2cb_region_desc *region) + { +- errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; +- int rc; +- int error; +- char *error_msg; +- client_message message; +- char *argv[OCFS2_CONTROLD_MAXARGS + 1]; +- char buf[OCFS2_CONTROLD_MAXLINE]; +- +- if (control_daemon_fd != -1) { +- /* fprintf(stderr, "Join in progress!\n"); */ +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- } +- +- rc = ocfs2_client_connect(); +- if (rc < 0) { +- /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", +- strerror(-rc)); */ +- switch (rc) { +- case -EACCES: +- case -EPERM: +- err = O2CB_ET_PERMISSION_DENIED; +- break; +- +- default: +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- break; +- } +- goto out; +- } +- control_daemon_fd = rc; +- +- rc = send_message(control_daemon_fd, CM_UNMOUNT, OCFS2_FS_NAME, +- region->r_name, region->r_service); +- if (rc) { +- /* fprintf(stderr, "Unable to send UNMOUNT message: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- rc = receive_message(control_daemon_fd, buf, &message, argv); +- if (rc < 0) { +- /* fprintf(stderr, "Error reading from daemon: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- switch (message) { +- case CM_STATUS: +- err = user_parse_status(argv, &error, &error_msg); +- if (err) { +- /* fprintf(stderr, "Bad status message: %s\n", +- strerror(-rc)); */ +- goto out; +- } +- if (error) { +- /* fprintf(stderr, +- "Error %d from daemon: %s\n", +- error, error_msg); */ +- err = O2CB_ET_CONFIGURATION_ERROR; +- goto out; +- } +- break; +- +- default: +- /* fprintf(stderr, +- "Unexpected message %s from daemon\n", +- message_to_string(message)); */ +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- break; +- } +- +- err = 0; +- +-out: +- if (control_daemon_fd != -1) { +- close(control_daemon_fd); +- control_daemon_fd = -1; +- } +- +- return err; ++ return 0; + } + + static errcode_t o2cb_validate_cluster_flags(struct o2cb_cluster_desc *desc, +@@ -1818,52 +1711,7 @@ static errcode_t classic_list_clusters(c + + static errcode_t user_list_clusters(char ***clusters) + { +- errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; +- int rc, fd = -1; +- char buf[OCFS2_CONTROLD_MAXLINE]; +- +- rc = ocfs2_client_connect(); +- if (rc < 0) { +- /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", +- strerror(-rc)); */ +- switch (rc) { +- case -EACCES: +- case -EPERM: +- err = O2CB_ET_PERMISSION_DENIED; +- break; +- +- default: +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- break; +- } +- goto out; +- } +- fd = rc; +- +- rc = send_message(fd, CM_LISTCLUSTERS); +- if (rc) { +- /* fprintf(stderr, +- "Unable to send LISTCLUSTERS message: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- rc = receive_list(fd, buf, clusters); +- if (rc) { +- /* fprintf(stderr, "Error reading from daemon: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- err = 0; +- +-out: +- if (fd != -1) +- close(fd); +- +- return err; ++ return 0; + } + + errcode_t o2cb_list_clusters(char ***clusters) +@@ -1991,83 +1839,6 @@ errcode_t o2cb_set_heartbeat_mode(char * + return ret; + } + +-static errcode_t dump_list_to_string(char **dump_list, char **debug) +-{ +- int i; +- size_t len, count = 0; +- char *ptr; +- +- for (i = 0; dump_list[i]; i++) +- count += strlen(dump_list[i]); +- +- *debug = malloc(sizeof(char) * (count + 1)); +- if (!*debug) +- return O2CB_ET_NO_MEMORY; +- +- ptr = *debug; +- ptr[count] = '\0'; +- for (i = 0; dump_list[i]; i++) { +- len = strlen(dump_list[i]); +- memcpy(ptr, dump_list[i], len); +- ptr += len; +- } +- +- return 0; +-} +- +-errcode_t o2cb_control_daemon_debug(char **debug) +-{ +- errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; +- int rc, fd = -1; +- char buf[OCFS2_CONTROLD_MAXLINE]; +- char **dump_list = NULL; +- +- rc = ocfs2_client_connect(); +- if (rc < 0) { +- /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", +- strerror(-rc)); */ +- switch (rc) { +- case -EACCES: +- case -EPERM: +- err = O2CB_ET_PERMISSION_DENIED; +- break; +- +- default: +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- break; +- } +- goto out; +- } +- fd = rc; +- +- rc = send_message(fd, CM_DUMP); +- if (rc) { +- /* fprintf(stderr, +- "Unable to send DUMP message: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- rc = receive_list(fd, buf, &dump_list); +- if (rc) { +- /* fprintf(stderr, "Error reading from daemon: %s\n", +- strerror(-rc)); */ +- err = O2CB_ET_IO; +- goto out; +- } +- +- err = dump_list_to_string(dump_list, debug); +- o2cb_free_dir_list(dump_list); +- +-out: +- if (fd != -1) +- close(fd); +- +- return err; +-} +- +- + errcode_t o2cb_get_hb_thread_pid (const char *cluster_name, const char *region_name, + pid_t *pid) + { +@@ -2171,161 +1942,6 @@ errcode_t o2cb_get_node_local(const char + + return 0; + } +-/* +- * The handshake is pretty simple. We need to read all supported control +- * device protocols from the kernel. Once we've read them, we can write +- * the protocol we want to use. After that, we're good to go. +- * +- * Right now, we will just allow the T01 protocol and not write any +- * code to handle multiples. We'll add that later if and when it is +- * necessary. +- * +- * The versions read from the kernel are all 4 characers including the +- * newline. +- */ +-#define OCFS2_CONTROL_PROTO "T01\n" +-#define OCFS2_CONTROL_PROTO_LEN 4 +-#define OCFS2_CONTROL_MESSAGE_SETNODE_OP "SETN" +-#define OCFS2_CONTROL_MESSAGE_SETNODE_TOTAL_LEN 14 +-#define OCFS2_CONTROL_MESSAGE_SETVERSION_OP "SETV" +-#define OCFS2_CONTROL_MESSAGE_SETVERSION_TOTAL_LEN 11 +-#define OCFS2_CONTROL_MESSAGE_DOWN_OP "DOWN" +-#define OCFS2_CONTROL_MESSAGE_DOWN_TOTAL_LEN 47 +-#define OCFS2_CONTROL_MESSAGE_NODENUM_LEN 8 +-static errcode_t o2cb_control_handshake(unsigned int this_node, +- struct ocfs2_protocol_version *proto) +-{ +- errcode_t err = 0; +- int found = 0; +- size_t ret; +- char buf[OCFS2_CONTROL_MESSAGE_SETNODE_TOTAL_LEN + 1]; +- +- if (control_device_fd == -1) { +- err = O2CB_ET_INTERNAL_FAILURE; +- goto out; +- } +- +- buf[OCFS2_CONTROL_PROTO_LEN] = '\0'; +- while (1) +- { +- ret = read(control_device_fd, buf, OCFS2_CONTROL_PROTO_LEN); +- if (ret == OCFS2_CONTROL_PROTO_LEN) { +- if (!found && !strcmp(buf, +- OCFS2_CONTROL_PROTO)) +- found = 1; +- continue; +- } +- +- if (ret != 0) +- err = O2CB_ET_IO; +- else if (!found) +- err = O2CB_ET_SERVICE_HANDSHAKE_UNAVAILABLE; /* no match */ +- break; +- } +- +- if (err) +- goto out; +- +- ret = write(control_device_fd, OCFS2_CONTROL_PROTO, +- OCFS2_CONTROL_PROTO_LEN); +- if (ret != OCFS2_CONTROL_PROTO_LEN) { +- err = O2CB_ET_IO; +- goto out; +- } +- +- snprintf(buf, OCFS2_CONTROL_MESSAGE_SETNODE_TOTAL_LEN + 1, +- OCFS2_CONTROL_MESSAGE_SETNODE_OP " %08X\n", this_node); +- ret = write(control_device_fd, buf, +- OCFS2_CONTROL_MESSAGE_SETNODE_TOTAL_LEN); +- if (ret != OCFS2_CONTROL_MESSAGE_SETNODE_TOTAL_LEN) +- err = O2CB_ET_IO; +- +- snprintf(buf, OCFS2_CONTROL_MESSAGE_SETVERSION_TOTAL_LEN + 1, +- OCFS2_CONTROL_MESSAGE_SETVERSION_OP " %02X %02X\n", +- proto->pv_major, proto->pv_minor); +- ret = write(control_device_fd, buf, +- OCFS2_CONTROL_MESSAGE_SETVERSION_TOTAL_LEN); +- if (ret != OCFS2_CONTROL_MESSAGE_SETVERSION_TOTAL_LEN) +- err = O2CB_ET_IO; +- +-out: +- return err; +-} +- +-errcode_t o2cb_control_open(unsigned int this_node, +- struct ocfs2_protocol_version *proto) +-{ +- errcode_t err = 0; +- int rc; +- +- if (!current_stack) { +- err = O2CB_ET_SERVICE_UNAVAILABLE; +- goto out; +- } +- +- if (control_device_fd != -1) +- goto out; +- +- rc = open(CONTROL_DEVICE, O_RDWR); +- if (rc < 0) { +- switch (errno) { +- default: +- err = O2CB_ET_INTERNAL_FAILURE; +- break; +- +- case ENOTDIR: +- case ENOENT: +- case EISDIR: +- err = O2CB_ET_SERVICE_DEV_UNAVAILABLE; +- break; +- +- case EACCES: +- case EPERM: +- case EROFS: +- err = O2CB_ET_PERMISSION_DENIED; +- break; +- } +- goto out; +- } +- +- control_device_fd = rc; +- +- err = o2cb_control_handshake(this_node, proto); +- if (err) { +- close(control_device_fd); +- control_device_fd = -1; +- } +- +-out: +- return err; +-} +- +-void o2cb_control_close(void) +-{ +- if (control_device_fd != -1) { +- close(control_device_fd); +- control_device_fd = -1; +- } +-} +- +-errcode_t o2cb_control_node_down(const char *uuid, unsigned int nodeid) +-{ +- errcode_t err = 0; +- size_t ret; +- char buf[OCFS2_CONTROL_MESSAGE_DOWN_TOTAL_LEN + 1]; +- +- if (control_device_fd == -1) +- return O2CB_ET_INTERNAL_FAILURE; +- +- snprintf(buf, OCFS2_CONTROL_MESSAGE_DOWN_TOTAL_LEN + 1, +- "DOWN %.32s %08X\n", uuid, nodeid); +- ret = write(control_device_fd, buf, +- OCFS2_CONTROL_MESSAGE_DOWN_TOTAL_LEN); +- if (ret != OCFS2_CONTROL_MESSAGE_DOWN_TOTAL_LEN) +- err = O2CB_ET_IO; +- +- return err; +-} + + errcode_t o2cb_get_hb_ctl_path(char *buf, int count) + { diff --git a/0003-Get-cluster-name-from-corosync-cmap.patch b/0003-Get-cluster-name-from-corosync-cmap.patch new file mode 100644 index 0000000..4216d76 --- /dev/null +++ b/0003-Get-cluster-name-from-corosync-cmap.patch @@ -0,0 +1,62 @@ +From 3f2b73105c5e09e17744ec249eed93c60124bd2d Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 18:05:04 -0500 +Subject: [PATCH 3/7] Get cluster name from corosync cmap + +--- + libo2cb/o2cb_abi.c | 20 ++++++++++++++++++++ + o2cb.pc.in | 2 +- + 2 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c +index 8e5d6ce..d00dd46 100644 +--- a/libo2cb/o2cb_abi.c ++++ b/libo2cb/o2cb_abi.c +@@ -37,6 +37,7 @@ + #include + + #include ++#include + + #include "o2cb/o2cb.h" + #include "o2cb/o2cb_client_proto.h" +@@ -1711,6 +1712,25 @@ static errcode_t classic_list_clusters(char ***clusters) + + static errcode_t user_list_clusters(char ***clusters) + { ++ cmap_handle_t handle; ++ char **list; ++ int rv; ++ ++ rv = cmap_initialize(&handle); ++ if (rv != CS_OK) ++ return O2CB_ET_SERVICE_UNAVAILABLE; ++ ++ /* We supply only one cluster_name */ ++ list = (char **)malloc(sizeof(char *) * 2); ++ rv = cmap_get_string(handle, "totem.cluster_name", &list[0]); ++ if (rv != CS_OK) { ++ free(list); ++ return O2CB_ET_INTERNAL_FAILURE; ++ } ++ ++ list[1] = NULL; ++ *clusters = list; ++ + return 0; + } + +diff --git a/o2cb.pc.in b/o2cb.pc.in +index be94b8a..3a47c36 100644 +--- a/o2cb.pc.in ++++ b/o2cb.pc.in +@@ -7,5 +7,5 @@ Name: o2cb + Description: Library for accessing the ocfs2 cluster base (o2cb) + Version: @VERSION@ + Requires: com_err +-Libs: -L${libdir} -lo2cb ++Libs: -L${libdir} -lo2cb -lcmap + Cflags: -I${includedir} +-- +1.8.1.4 + diff --git a/0004-Remove-controld-structures-from-debugfs.ocfs2.patch b/0004-Remove-controld-structures-from-debugfs.ocfs2.patch new file mode 100644 index 0000000..425a797 --- /dev/null +++ b/0004-Remove-controld-structures-from-debugfs.ocfs2.patch @@ -0,0 +1,64 @@ +From 394a3e7d2758331ba8aa6fc38957611d2447a73d Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 19:15:53 -0500 +Subject: [PATCH 4/7] Remove controld structures from debugfs.ocfs2 + +--- + debugfs.ocfs2/commands.c | 34 ---------------------------------- + 1 file changed, 34 deletions(-) + +diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c +index e0b228a..c1c7589 100644 +--- a/debugfs.ocfs2/commands.c ++++ b/debugfs.ocfs2/commands.c +@@ -108,11 +108,6 @@ static struct command commands[] = { + "close", + "Close a device", + }, +- { "controld", +- do_controld, +- "controld dump", +- "Obtain information from ocfs2_controld", +- }, + { "curdev", + do_curdev, + "curdev", +@@ -894,35 +889,6 @@ static void do_lcd(char **args) + return ; + } + +-static void do_controld_dump(char **args) +-{ +- FILE *out; +- errcode_t ret; +- char *debug_buffer; +- +- ret = o2cb_control_daemon_debug(&debug_buffer); +- if (ret) { +- com_err(args[0], ret, "while obtaining the debug buffer"); +- return; +- } +- +- out = open_pager(gbls.interactive); +- fprintf(out, "%s", debug_buffer); +- close_pager(out); +- free(debug_buffer); +-} +- +-static void do_controld(char **args) +-{ +- if (!args[1]) +- fprintf(stderr, "%s: Operation required\n", args[0]); +- else if (!strcmp(args[1], "dump")) +- do_controld_dump(args); +- else +- fprintf(stderr, "%s: Invalid operation: \"%s\"\n", +- args[0], args[1]); +-} +- + static void do_curdev(char **args) + { + printf("%s\n", gbls.device ? gbls.device : "No device"); +-- +1.8.1.4 + diff --git a/0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch b/0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch new file mode 100644 index 0000000..de4424b --- /dev/null +++ b/0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch @@ -0,0 +1,44 @@ +From 8563d603b7af2a32ef1e19337eaeb9d7cace730c Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 19:18:40 -0500 +Subject: [PATCH 5/7] Check for DLM kernel version in user_begin_group_join + +Since we just have to check if the DLM daemon is running, we +just check the kernel version running. Checking the kernel version +ensures that the dlm daemon is running. +--- + libo2cb/o2cb_abi.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c +index d00dd46..26ed848 100644 +--- a/libo2cb/o2cb_abi.c ++++ b/libo2cb/o2cb_abi.c +@@ -38,6 +38,7 @@ + + #include + #include ++#include + + #include "o2cb/o2cb.h" + #include "o2cb/o2cb_client_proto.h" +@@ -1350,6 +1351,16 @@ static errcode_t classic_complete_group_join(struct o2cb_cluster_desc *cluster, + static errcode_t user_begin_group_join(struct o2cb_cluster_desc *cluster, + struct o2cb_region_desc *region) + { ++ uint32_t maj, min, pat; ++ int rv; ++ ++ rv = dlm_kernel_version(&maj, &min, &pat); ++ ++ if (rv < 0) ++ return O2CB_ET_SERVICE_UNAVAILABLE; ++ ++ if (maj < 6) ++ return O2CB_ET_INTERNAL_FAILURE; + return 0; + } + +-- +1.8.1.4 + diff --git a/0006-Add-cmap-and-dlm-libraries-in-the-tools.patch b/0006-Add-cmap-and-dlm-libraries-in-the-tools.patch new file mode 100644 index 0000000..284558a --- /dev/null +++ b/0006-Add-cmap-and-dlm-libraries-in-the-tools.patch @@ -0,0 +1,121 @@ +From 4adc4d242f3f69808e7e2bed71337ff7e7966846 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Mon, 19 Aug 2013 19:20:19 -0500 +Subject: [PATCH 6/7] Add cmap and dlm libraries in the tools + +--- + fsck.ocfs2/Makefile | 2 +- + mkfs.ocfs2/Makefile | 2 +- + mount.ocfs2/Makefile | 2 +- + mounted.ocfs2/Makefile | 2 +- + o2cb.pc.in | 2 +- + o2cb_ctl/Makefile | 2 +- + ocfs2_hb_ctl/Makefile | 2 +- + tunefs.ocfs2/Makefile | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/fsck.ocfs2/Makefile b/fsck.ocfs2/Makefile +index edc8dc5..d1c71f8 100644 +--- a/fsck.ocfs2/Makefile ++++ b/fsck.ocfs2/Makefile +@@ -12,7 +12,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal + LIBTOOLS_INTERNAL_DEPS = $(TOPDIR)/libtools-internal/libtools-internal.a +diff --git a/mkfs.ocfs2/Makefile b/mkfs.ocfs2/Makefile +index 5631e01..1fed073 100644 +--- a/mkfs.ocfs2/Makefile ++++ b/mkfs.ocfs2/Makefile +@@ -8,7 +8,7 @@ SBIN_PROGRAMS = mkfs.ocfs2 + LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) +diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile +index cf316bf..2736f5f 100644 +--- a/mount.ocfs2/Makefile ++++ b/mount.ocfs2/Makefile +@@ -10,7 +10,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + DEFINES = -DVERSION=\"$(VERSION)\" +diff --git a/mounted.ocfs2/Makefile b/mounted.ocfs2/Makefile +index 8a574fb..3e18895 100644 +--- a/mounted.ocfs2/Makefile ++++ b/mounted.ocfs2/Makefile +@@ -8,7 +8,7 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal +diff --git a/o2cb.pc.in b/o2cb.pc.in +index 3a47c36..3dd1f4e 100644 +--- a/o2cb.pc.in ++++ b/o2cb.pc.in +@@ -7,5 +7,5 @@ Name: o2cb + Description: Library for accessing the ocfs2 cluster base (o2cb) + Version: @VERSION@ + Requires: com_err +-Libs: -L${libdir} -lo2cb -lcmap ++Libs: -L${libdir} -lo2cb -lcmap -ldlm + Cflags: -I${includedir} +diff --git a/o2cb_ctl/Makefile b/o2cb_ctl/Makefile +index 5efcab4..0da22dc 100644 +--- a/o2cb_ctl/Makefile ++++ b/o2cb_ctl/Makefile +@@ -13,7 +13,7 @@ LIBTOOLS_INTERNAL_DEPS = $(TOPDIR)/libtools-internal/libtools-internal.a + LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) +diff --git a/ocfs2_hb_ctl/Makefile b/ocfs2_hb_ctl/Makefile +index 10fd8b1..d04e74e 100644 +--- a/ocfs2_hb_ctl/Makefile ++++ b/ocfs2_hb_ctl/Makefile +@@ -10,7 +10,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + ifndef OCFS2_DYNAMIC_CTL +diff --git a/tunefs.ocfs2/Makefile b/tunefs.ocfs2/Makefile +index 585a68c..4e40d7d 100644 +--- a/tunefs.ocfs2/Makefile ++++ b/tunefs.ocfs2/Makefile +@@ -11,7 +11,7 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + UNINST_LIBRARIES = libocfs2ne.a +-- +1.8.1.4 + diff --git a/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch b/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch new file mode 100644 index 0000000..1b3f5de --- /dev/null +++ b/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch @@ -0,0 +1,206 @@ +From 4c80d4b994e99443ae403f22d3e65fd5e2c3edb7 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Fri, 23 Aug 2013 22:39:54 -0500 +Subject: [PATCH 7/7] mount.ocfs2 performs module loading/cluster_stack setup + +--- + mount.ocfs2/Makefile | 2 +- + mount.ocfs2/mount.ocfs2.c | 6 +++ + mount.ocfs2/mount.ocfs2.h | 1 + + mount.ocfs2/stack.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ + mount.ocfs2/stack.h | 2 + + 5 files changed, 142 insertions(+), 1 deletion(-) + create mode 100644 mount.ocfs2/stack.c + create mode 100644 mount.ocfs2/stack.h + +diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile +index 2736f5f..8f80b62 100644 +--- a/mount.ocfs2/Makefile ++++ b/mount.ocfs2/Makefile +@@ -15,7 +15,7 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + DEFINES = -DVERSION=\"$(VERSION)\" + +-CORE_CFILES = fstab.c mntent.c realpath.c sundries.c xmalloc.c opts.c ++CORE_CFILES = fstab.c mntent.c realpath.c sundries.c xmalloc.c opts.c stack.c + MOUNT_CFILES = mount.ocfs2.c + + HFILES = $(subst .c,.h,$(MOUNT_CFILES) $(CORE_CFILES)) +diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c +index f2ca5cb..4b9ba1f 100644 +--- a/mount.ocfs2/mount.ocfs2.c ++++ b/mount.ocfs2/mount.ocfs2.c +@@ -357,6 +357,12 @@ int main(int argc, char **argv) + if (verbose) + printf("device=%s\n", mo.dev); + ++ ret = setup_stack((char *)OCFS2_RAW_SB(fs->fs_super)->s_cluster_info.ci_stack); ++ if (ret) { ++ com_err(progname, ret, "while setting up stack\n"); ++ goto bail; ++ } ++ + if (clustered) { + ret = o2cb_init(); + if (ret) { +diff --git a/mount.ocfs2/mount.ocfs2.h b/mount.ocfs2/mount.ocfs2.h +index 91d97d0..e76d8c3 100644 +--- a/mount.ocfs2/mount.ocfs2.h ++++ b/mount.ocfs2/mount.ocfs2.h +@@ -47,6 +47,7 @@ + #include "mntent.h" + #include "mount_constants.h" + #include "opts.h" ++#include "stack.h" + + #include "ocfs2/ocfs2.h" + #include "ocfs2/bitops.h" +diff --git a/mount.ocfs2/stack.c b/mount.ocfs2/stack.c +new file mode 100644 +index 0000000..8a9ea93 +--- /dev/null ++++ b/mount.ocfs2/stack.c +@@ -0,0 +1,132 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "stack.h" ++ ++#define CLUSTER_STACK_FILE "/sys/fs/ocfs2/cluster_stack" ++#define MODPROBE_COMMAND "/sbin/modprobe" ++#define USER_KERNEL_MODULE "ocfs2_stack_user" ++#define O2CB_KERNEL_MODULE "ocfs2_stack_o2cb" ++#define USER_STACK_NAME "pcmk" ++#define CLASSIC_STACK_NAME "o2cb" ++#define OCFS2_STACK_LABEL_LEN 4 ++ ++static int read_single_line_file(char *filename, char *line, size_t count) ++{ ++ ssize_t ret = 0; ++ FILE *f; ++ ++ f = fopen(filename, "r"); ++ if (f) { ++ if (fgets(line, count, f)) ++ ret = strlen(line); ++ fclose(f); ++ } else ++ ret = -errno; ++ ++ return ret; ++ ++} ++ ++static int write_single_line_file(char *filename, char *line, size_t count) ++{ ++ ssize_t ret = 0; ++ FILE *f; ++ ++ f = fopen(filename, "w"); ++ if (f) { ++ if (fputs(line, f)) ++ ret = strlen(line); ++ fclose(f); ++ } else ++ ret = -errno; ++ ++ return ret; ++} ++ ++static int perform_modprobe(char *module_name) ++{ ++ pid_t child; ++ int child_status; ++ ++ char *argv[3]; ++ ++ argv[0] = MODPROBE_COMMAND; ++ argv[1] = module_name; ++ argv[2] = NULL; ++ ++ child = fork(); ++ if (child == 0) { ++ execv(MODPROBE_COMMAND, argv); ++ /* If execv fails, we have a problem */ ++ return -EINVAL; ++ } else ++ wait(&child_status); ++ ++ return child_status; ++} ++ ++ ++static int modprobe_and_write_stack(char *stack_name) ++{ ++ perform_modprobe("ocfs2"); ++ if (!strncmp(stack_name, USER_STACK_NAME, OCFS2_STACK_LABEL_LEN)) ++ perform_modprobe(USER_KERNEL_MODULE); ++ else if (strncmp(stack_name, CLASSIC_STACK_NAME, OCFS2_STACK_LABEL_LEN)) ++ perform_modprobe(O2CB_KERNEL_MODULE); ++ else ++ return -EINVAL; ++ ++ write_single_line_file(CLUSTER_STACK_FILE, stack_name, ++ strlen(stack_name)); ++ return 0; ++} ++ ++errcode_t setup_stack(char *stack_name) ++{ ++ char line[64]; ++ int modprobe_performed = 0; ++ errcode_t err = 0; ++ int len; ++ ++redo: ++ len = read_single_line_file(CLUSTER_STACK_FILE, line, sizeof(line)); ++ ++ if (len > 0) { ++ if (line[len - 1] == '\n') { ++ line[len - 1] = '\0'; ++ len--; ++ } ++ ++ if (len != OCFS2_STACK_LABEL_LEN) { ++ err = O2CB_ET_INTERNAL_FAILURE; ++ goto out; ++ } ++ ++ if (strncmp(line, stack_name, OCFS2_STACK_LABEL_LEN)) { ++ err = O2CB_ET_SERVICE_UNAVAILABLE; ++ goto out; ++ } ++ ++ if (!strncmp(line, CLASSIC_STACK_NAME, OCFS2_STACK_LABEL_LEN) || ++ !strncmp(line, USER_STACK_NAME, OCFS2_STACK_LABEL_LEN)) ++ err = 0; ++ else ++ err = O2CB_ET_INTERNAL_FAILURE; ++ ++ } else if (len == -ENOENT) { ++ if (!modprobe_performed) { ++ modprobe_and_write_stack(stack_name); ++ err = O2CB_ET_INTERNAL_FAILURE; ++ modprobe_performed = 1; ++ goto redo; ++ } else ++ err = O2CB_ET_INTERNAL_FAILURE; ++ } ++out: ++ return err; ++} ++ +diff --git a/mount.ocfs2/stack.h b/mount.ocfs2/stack.h +new file mode 100644 +index 0000000..ec5f2de +--- /dev/null ++++ b/mount.ocfs2/stack.h +@@ -0,0 +1,2 @@ ++#include ++errcode_t setup_stack(char *stack_name); +-- +1.8.1.4 + diff --git a/libocfs2-Change-asserts-to-error.patch b/libocfs2-Change-asserts-to-error.patch new file mode 100644 index 0000000..8038a89 --- /dev/null +++ b/libocfs2-Change-asserts-to-error.patch @@ -0,0 +1,23 @@ +While running fsck.ocfs2, if an assert is met, fsck.ocfs2 terminates. +This error is still recoverable, because the index of the directory +can be rebuilt. Converting the asserts to an error would return +control to fsck. +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/libocfs2/dir_indexed.c +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/libocfs2/dir_indexed.c 2013-04-02 04:38:06.444732480 -0500 ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/libocfs2/dir_indexed.c 2013-08-13 09:37:35.120453200 -0500 +@@ -1436,9 +1436,11 @@ errcode_t ocfs2_dx_dir_search(ocfs2_file + entry_list = &dx_leaf->dl_list; + } + +- assert(entry_list->de_count > 0); +- assert(entry_list->de_num_used > 0); +- assert(dx_root->dr_num_entries > 0); ++ if ((entry_list->de_count == 0) || (entry_list->de_num_used == 0) || ++ (dx_root->dr_num_entries == 0)) { ++ ret = OCFS2_ET_DIR_CORRUPTED; ++ goto out; ++ } + + ret = ocfs2_malloc_block(fs->fs_io, &dir_buf); + if (ret) diff --git a/o2cb.ocf b/o2cb.ocf index 784ca3d..06e0f7b 100644 --- a/o2cb.ocf +++ b/o2cb.ocf @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2008 Andrew Beekhof +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify @@ -33,346 +34,18 @@ : ${OCF_RESKEY_configfs:="/sys/kernel/config"} : ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"} -# Common variables -DAEMON="/usr/sbin/ocfs2_controld.${OCF_RESKEY_stack}" -CLUSTER_STACK_FILE="${OCF_RESKEY_sysfs}/ocfs2/cluster_stack" -LOADED_PLUGINS_FILE="${OCF_RESKEY_sysfs}/ocfs2/loaded_cluster_plugins" - -# -# Check to see if a filesystem driver is loaded. -# 0 is loaded, 1 is not. -# -driver_filesystem() { - if [ -z "$1" ] - then - ocf_log err "driver_filesystem(): Missing an argument" - exit 1 - fi - FSNAME="$1" - - FSOUT="$(awk '(NF == 1 && $1 ~ /^'$FSNAME'$/) || $2 ~ /^'$FSNAME'$/{ - print $1;exit - }' /proc/filesystems 2>/dev/null)" - - test -n "$FSOUT" - return $? -} - -# -# Check to see if a filesystem of type $1 is mounted at $2. -# -# 0 is mounted, 1 is not. -# -check_filesystem() -{ - if [ "$#" != "2" -o -z "$1" -o -z "$2" ] - then - ocf_log err "check_filesystem(): Missing arguments" - exit 4 - fi - FSNAME="$1" - MOUNTPOINT="$2" - - FULL_MOUNTSEARCH="`echo "$MOUNTPOINT" | sed -e 's/\//\\\\\//g'`" - MOUNTOUT="`awk '$2 ~ /^'$FULL_MOUNTSEARCH'$/ && $3 ~ /^'$FSNAME'$/{print $2; exit}' < /proc/mounts 2>/dev/null`" - test -n "$MOUNTOUT" - return $? -} - -# -# Unload a filesystem driver. -# Be careful to notice if the driver is built-in and do nothing. -# -# 0 is success, 1 is error, 2 is already unloaded. -# -unload_filesystem() -{ - if [ "$#" != "1" -o -z "$1" ] - then - ocf_log err "unload_filesystem(): Missing an argument" - return 1 - fi - FSNAME="$1" - - driver_filesystem "$FSNAME" || return 2 - - MODOUT="`awk '$1 ~ /^'$FSNAME'$/{print $1,$3;exit}' < /proc/modules 2>/dev/null`" - if [ -z "$MODOUT" ]; then - # The driver is built in, we can't unload it. - return 0 - fi - - case "$MODOUT" in - $FSNAME\ 0) - ;; - $FSNAME\ *) - # The driver is busy, leave it alone - ocf_log err "Module $FSNAME is still in use" - return 1 - ;; - *) - ocf_log err "Invalid module parsing! " - return 1 - ;; - esac - - modprobe -rs "$FSNAME" - if [ "$?" != 0 ]; then - ocf_log err "Unable to unload module: $FSNAME" - return 1 - fi - - return 0 -} - -status_daemon() -{ - PID=`pidofproc "$DAEMON"` - if [ -n "$PID" ]; then - return $OCF_SUCCESS - fi - return $OCF_NOT_RUNNING -} - -bringup_daemon() -{ - if [ ! -e "$DAEMON" ]; then - ocf_log err "Required binary not found: $DAEMON" - return $OCF_ERR_INSTALLED - fi - - start_daemon "$DAEMON"; rc=$? - if [ $rc != 0 ]; then - ocf_log err "Could not start $DAEMON" - return $OCF_ERR_GENERIC - fi - - sleep 1 - COUNT=0 - rc=$OCF_NOT_RUNNING - - while [ $rc = $OCF_NOT_RUNNING ]; do - COUNT=`expr $COUNT + 1` - if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then - ocf_log err "`basename $DAEMON` did not come up" - ps axf | grep -C 3 $$ - return $OCF_ERR_GENERIC - fi - status_daemon; rc=$? - sleep 1 - done - - return $rc -} - -kill_daemon() -{ - status_daemon; rc=$? - if [ $rc == $OCF_NOT_RUNNING ]; then - return 0 - fi - - ocf_log info "Stopping `basename "$DAEMON"`" - killproc "$DAEMON" - - while [ $rc != $OCF_NOT_RUNNING ]; do - sleep 1 - status_daemon; rc=$? - done - return 0 -} - -# -# Unload a module -# 0 is success, 1 is error, 2 is not loaded -# -unload_module() -{ - if [ "$#" -lt "1" -o -z "$1" ] - then - ocf_log err "unload_module(): Requires an argument" - return 1 - fi - MODNAME="$1" - - MODOUT="`awk '$1 ~ /^'$MODNAME'$/{print $1,$3;exit}' < /proc/modules 2>/dev/null`" - if [ -z "$MODOUT" ] - then - return 2 - fi - - case "$MODOUT" in - $MODNAME\ 0) - ;; - $MODNAME\ *) - return 2 - ;; - *) - ocf_log err "Invalid module parsing!" - return 1 - ;; - esac - - modprobe -rs "$MODNAME" - if [ "$?" != 0 ]; then - ocf_log err "Unable to unload module \"$MODNAME\"" - return 1 - fi - - return 0 -} - o2cb_start() { - - o2cb_monitor; rc=$? - if [ $rc != $OCF_NOT_RUNNING ]; then - return $rc - fi - - ocf_log info "Starting $OCF_RESOURCE_INSTANCE" - - if [ ! -e "$CLUSTER_STACK_FILE" ]; then - modprobe -s ocfs2_stackglue - if [ $? != 0 ]; then - ocf_log err "Could not load ocfs2_stackglue" - return $OCF_ERR_INSTALLED - fi - fi - - SP_OUT="$(awk '/^'user'$/{print; exit}' "$LOADED_PLUGINS_FILE" 2>/dev/null)" - if [ -z "$SP_OUT" ] - then - modprobe -s ocfs2_stack_user - if [ $? != 0 ]; then - ocf_log err "Could not load ocfs2_stack_user" - return $OCF_ERR_INSTALLED - fi - fi - - SP_OUT="$(awk '/^'user'$/{print; exit}' "$LOADED_PLUGINS_FILE" 2>/dev/null)" - if [ -z "$SP_OUT" ]; then - ocf_log err "Switch to userspace stack unsuccessful" - return $OCF_ERR_INSTALLED - fi - - if [ -f "$CLUSTER_STACK_FILE" ]; then - echo "$OCF_RESKEY_stack" >"$CLUSTER_STACK_FILE" - if [ $? != 0 ]; then - ocf_log err "Userspace stack '$OCF_RESKEY_stack' not supported" - return $OCF_ERR_INSTALLED - fi - else - ocf_log err "Switch to userspace stack not supported" - return $OCF_ERR_INSTALLED - fi - - driver_filesystem ocfs2; rc=$? - if [ $rc != 0 ]; then - modprobe -s ocfs2 - if [ "$?" != 0 ]; then - ocf_log err "Unable to load ocfs2 module" - return $OCF_ERR_INSTALLED - fi - fi - - bringup_daemon - return $? + ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!" + return $OCF_SUCCESS } o2cb_stop() { - o2cb_monitor; rc=$? - case $rc in - $OCF_NOT_RUNNING) return $OCF_SUCCESS;; - esac - - ocf_log info "Stopping $OCF_RESOURCE_INSTANCE" - - kill_daemon - if [ $? != 0 ]; then - ocf_log err "Unable to unload modules: the cluster is still online" - return $OCF_ERR_GENERIC - fi - - unload_filesystem ocfs2 - if [ $? = 1 ]; then - ocf_log err "Unable to unload ocfs2 module" - return $OCF_ERR_GENERIC - fi - - # If we can't find the stack glue, we have nothing to do. - [ ! -e "$LOADED_PLUGINS_FILE" ] && return $OCF_SUCCESS - - while read plugin - do - unload_module "ocfs2_stack_${plugin}" - if [ $? = 1 ]; then - ocf_log err "Unable to unload ocfs2_stack_${plugin}" - return $OCF_ERR_GENERIC - fi - done <"$LOADED_PLUGINS_FILE" - - unload_module "ocfs2_stackglue" - if [ $? = 1 ]; then - ocf_log err "Unable to unload ocfs2_stackglue" - return $OCF_ERR_GENERIC - fi - - # Dont unmount configfs - its always in use by libdlm -} - -o2cb_monitor() { - o2cb_validate - - # Assume that ocfs2_controld will terminate if any of the conditions below are met - - driver_filesystem configfs; rc=$? - if [ $rc != 0 ]; then - ocf_log info "configfs not laoded" - return $OCF_NOT_RUNNING - fi - - check_filesystem configfs "${OCF_RESKEY_configfs}"; rc=$? - if [ $rc != 0 ]; then - ocf_log info "configfs not mounted" - return $OCF_NOT_RUNNING - fi - - if [ ! -e "$LOADED_PLUGINS_FILE" ]; then - ocf_log info "Stack glue driver not loaded" - return $OCF_NOT_RUNNING - fi - - grep user "$LOADED_PLUGINS_FILE" >/dev/null 2>&1; rc=$? - if [ $rc != 0 ]; then - ocf_log err "Wrong stack `cat $LOADED_PLUGINS_FILE`" - return $OCF_ERR_INSTALLED - fi - - driver_filesystem ocfs2; rc=$? - if [ $rc != 0 ]; then - ocf_log info "ocfs2 not loaded" - return $OCF_NOT_RUNNING - fi - - status_daemon - return $? + ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!" + return $OCF_SUCCESS } o2cb_usage() { - echo "usage: $0 {start|stop|monitor|validate-all|meta-data}" - echo " Expects to have a fully populated OCF RA-compliant environment set." - echo " In particualr, a value for OCF_ROOT" -} - -o2cb_validate() { - : TODO: check for gloablly_unique=true and return OCF_ERR_CONFIGURED - case ${OCF_RESKEY_CRM_meta_gloablly_unique} in - yes|Yes|true|True|1) - ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the gloablly_unique=false meta attribute" - exit $OCF_ERR_CONFIGURED - ;; - esac - + echo "usage: $0 {start|stop|meta-data}" return $OCF_SUCCESS } @@ -382,51 +55,13 @@ meta_data() { 1.0 - o2cb resource agent + OBSOLETE o2cb resource agent OBSOLETE -This is a o2cb Resource Agent. It runs o2cb daemon as a instance of anonymous clone. +This is a o2cb Resource Agent. This is now obsolete! - - - -Location where sysfs is mounted - - Sysfs location - - - - - -Location where configfs is mounted - - Configfs location - - - - - -Which userspace stack to use. Known values: pcmk, cman - - Userspace stack - - - - - -Number of seconds to allow the control daemon to come up - - Daemon Timeout - - - - - - - - END @@ -440,10 +75,6 @@ start) o2cb_start ;; stop) o2cb_stop ;; -monitor) o2cb_monitor - ;; -validate-all) o2cb_validate - ;; usage|help) o2cb_usage exit $OCF_SUCCESS ;; diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index e1ebb70..17f0cbc 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Fri Aug 23 12:44:09 CDT 2013 - rgoldwyn@suse.com + +- Make mount.ocfs2 load modules and write cluster_stack: + + 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch + +------------------------------------------------------------------- +Thu Aug 22 13:18:01 CDT 2013 - rgoldwyn@suse.com + +- Mark o2cb.ocf as obsolete. Anyone using o2cb.ocf will get an + info message stating so. + +------------------------------------------------------------------- +Tue Aug 20 08:02:13 CDT 2013 - rgoldwyn@suse.com + +- The nocontrold effort (added nocontrold patches and disabled + corosync-2.3 controld compatibility patches): + + 0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch + + 0002-libo2cb-Remove-rest-of-controld-functions.patch + + 0003-Get-cluster-name-from-corosync-cmap.patch + + 0004-Remove-controld-structures-from-debugfs.ocfs2.patch + + 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch + + 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch + - 0001-Remove-pacemaker-ais-stuff.patch + - 0002-Add-corosync-cfg-to-get-configuration-information.patch + - 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch + - 0005-Add-cluster_name-and-stack-name.patch + +------------------------------------------------------------------- +Sat Aug 17 09:26:19 CDT 2013 - rgoldwyn@suse.com + +- libocfs2-Change-asserts-to-error.patch: Return control to + fsck.ocfs2 instead of erring + ------------------------------------------------------------------- Fri Aug 9 13:55:01 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index c097c3e..6ba7df2 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -50,6 +50,14 @@ Patch217: 0002-Add-corosync-cfg-to-get-configuration-information.patch Patch218: 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch Patch219: 0005-Add-cluster_name-and-stack-name.patch Patch220: libocfs2-needs-libaio.patch +Patch221: libocfs2-Change-asserts-to-error.patch +Patch222: 0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch +Patch223: 0002-libo2cb-Remove-rest-of-controld-functions.patch +Patch224: 0003-Get-cluster-name-from-corosync-cmap.patch +Patch225: 0004-Remove-controld-structures-from-debugfs.ocfs2.patch +Patch226: 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch +Patch227: 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch +Patch228: 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -146,11 +154,19 @@ managing the file system. %patch213 -p1 %patch214 -p1 %patch215 -p1 -%patch216 -p1 -%patch217 -p1 -%patch218 -p1 -%patch219 -p1 +#%patch216 -p1 +#%patch217 -p1 +#%patch218 -p1 +#%patch219 -p1 %patch220 -p1 +%patch221 -p1 +%patch222 -p1 +%patch223 -p1 +%patch224 -p1 +%patch225 -p1 +%patch226 -p1 +%patch227 -p1 +%patch228 -p1 %build export PROJECT="ocfs2-tools" @@ -187,7 +203,7 @@ cd .. mv %{buildroot}/{,/usr}/sbin/o2image mv %{buildroot}/{,/usr}/sbin/debugfs.ocfs2 -mv %{buildroot}/{,/usr}/sbin/ocfs2_controld.pcmk +#mv %{buildroot}/{,/usr}/sbin/ocfs2_controld.pcmk chmod a-x %{buildroot}/%{_libdir}/libo2cb.a chmod a-x %{buildroot}/%{_libdir}/libo2dlm.a chmod a-x %{buildroot}/%{_libdir}/libocfs2.a @@ -217,7 +233,7 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} /sbin/o2cluster %{_sbindir}/o2image %{_sbindir}/debugfs.ocfs2 -%{_sbindir}/ocfs2_controld.pcmk +#%{_sbindir}/ocfs2_controld.pcmk %{_sbindir}/o2hbmonitor %{_bindir}/reflink %{_bindir}/o2info From 6f2583e888a729070a77b36ebb7516c65fed5836 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Mon, 26 Aug 2013 19:46:55 +0000 Subject: [PATCH 07/11] Accepting request 196481 from home:goldwynr:branches:network:ha-clustering:Factory cluster_stack setup in o2cb OBS-URL: https://build.opensuse.org/request/show/196481 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=65 --- o2cb.ocf | 14 ++++++++++++++ ocfs2-tools.changes | 4 ++-- ocfs2-tools.spec | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/o2cb.ocf b/o2cb.ocf index 06e0f7b..33cf172 100644 --- a/o2cb.ocf +++ b/o2cb.ocf @@ -35,6 +35,11 @@ : ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"} o2cb_start() { + /sbin/modprobe ocfs2_stackglue + /sbin/modprobe ocfs2_stack_user + /sbin/modprobe ocfs2 + echo "pcmk" > /sys/fs/ocfs2/cluster_stack + ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!" return $OCF_SUCCESS } @@ -49,6 +54,10 @@ o2cb_usage() { return $OCF_SUCCESS } +o2cb_monitor() { + return $OCF_SUCCESS +} + meta_data() { cat < @@ -62,6 +71,9 @@ This is a o2cb Resource Agent. This is now obsolete! + + + END @@ -75,6 +87,8 @@ start) o2cb_start ;; stop) o2cb_stop ;; +monitor) o2cb_monitor + ;; usage|help) o2cb_usage exit $OCF_SUCCESS ;; diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 17f0cbc..92f60e0 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,8 +1,8 @@ ------------------------------------------------------------------- Fri Aug 23 12:44:09 CDT 2013 - rgoldwyn@suse.com -- Make mount.ocfs2 load modules and write cluster_stack: - + 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch +- FIXME: Added temporary hack in o2cb until we find a solution to + remove o2cb activities of setting cluster stack. ------------------------------------------------------------------- Thu Aug 22 13:18:01 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index 6ba7df2..ae5c803 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -166,7 +166,7 @@ managing the file system. %patch225 -p1 %patch226 -p1 %patch227 -p1 -%patch228 -p1 +#%patch228 -p1 %build export PROJECT="ocfs2-tools" From 3e4aa7393fd380094a1d6ad58a9ee4ec27e920fb Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Wed, 4 Sep 2013 18:00:10 +0000 Subject: [PATCH 08/11] Accepting request 197408 from home:goldwynr:branches:network:ha-clustering:Factory mount sets up stack OBS-URL: https://build.opensuse.org/request/show/197408 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=66 --- 0001-Remove-pacemaker-ais-stuff.patch | 648 ------------------ ...cfg-to-get-configuration-information.patch | 315 --------- ...otocol-versions-and-consolidate-fs-v.patch | 188 ----- 0005-Add-cluster_name-and-stack-name.patch | 31 - ...orms-module-loading-cluster_stack-se.patch | 206 ------ ...-stack-from-device-and-setup-stack-i.patch | 176 +++++ o2cb.ocf | 5 - ocfs2-tools.changes | 7 +- ocfs2-tools.spec | 12 +- 9 files changed, 182 insertions(+), 1406 deletions(-) delete mode 100644 0001-Remove-pacemaker-ais-stuff.patch delete mode 100644 0002-Add-corosync-cfg-to-get-configuration-information.patch delete mode 100644 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch delete mode 100644 0005-Add-cluster_name-and-stack-name.patch delete mode 100644 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch create mode 100644 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch diff --git a/0001-Remove-pacemaker-ais-stuff.patch b/0001-Remove-pacemaker-ais-stuff.patch deleted file mode 100644 index 7a8b56f..0000000 --- a/0001-Remove-pacemaker-ais-stuff.patch +++ /dev/null @@ -1,648 +0,0 @@ -From 6754fec432e3a2a758af9308fd7447f6e20e4cea Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Tue, 23 Jul 2013 09:06:23 -0500 -Subject: [PATCH 1/5] Remove pacemaker/ais stuff - ---- - configure.in | 58 +---------- - ocfs2_controld/Makefile | 27 +++-- - ocfs2_controld/cpg.c | 56 +++++----- - ocfs2_controld/main.c | 270 ------------------------------------------------ - 4 files changed, 42 insertions(+), 369 deletions(-) - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/configure.in -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/configure.in 2013-07-31 08:15:10.269877099 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/configure.in 2013-07-31 08:16:54.137970542 -0500 -@@ -219,12 +219,6 @@ LIBS="$ocfs_tools_save_LIBS" - - AC_SUBST(BUILD_DEBUGOCFS2) - --pcmk_found= --AC_CHECK_LIB(crmcluster, crm_get_peer, -- [AC_CHECK_HEADER(pacemaker/crm_config.h, pcmk_found=yes, -- [AC_MSG_WARN([Pacemaker headers not found, pacemaker support will not be built])])], -- [AC_MSG_WARN([libcrmcluster not found, pacemaker support will not be built])]) -- - # We use cman_replyto_shutdown to insure a new enough libcman - cman_found= - AC_CHECK_LIB(cman, cman_replyto_shutdown, -@@ -298,53 +292,6 @@ else - fi - AC_SUBST(CPG_LDFLAGS) - --ckpt_found= --AC_CHECK_HEADER(openais/saCkpt.h, ckpt_found=yes, -- [AC_MSG_WARN([openais/saCkpt.h not found, ocfs2_controld will not be built])], -- [#include ]) -- --AIS_LDFLAGS= --if test "x$ckpt_found" = "xyes"; then -- ckpt_found= -- TRY_PATH="$AIS_TRY_PATH" -- AC_MSG_CHECKING([for saCkptInitialize in -lSaCkpt]) -- while test "x$TRY_PATH" != "x"; do -- TRY="`echo $TRY_PATH | cut -f1 -d:`" -- NEW_TRY_PATH="`echo $TRY_PATH | cut -f2- -d:`" -- if test "x$NEW_TRY_PATH" != "x$TRY_PATH"; then -- TRY_PATH="$NEW_TRY_PATH" -- else -- TRY_PATH="" -- fi -- -- if test "x$TRY" != "x"; then -- TRY="-L${TRY}/openais" -- fi -- # TRY="$TRY" -- -- saved_LDFLAGS="$LDFLAGS" -- saved_LIBS="$LIBS" -- LDFLAGS="$LDFLAGS $TRY" -- LIBS="-lSaCkpt" -- AC_LINK_IFELSE([AC_LANG_CALL([], [saCkptInitialize])], -- ckpt_found=yes) -- LIBS="$saved_LIBS" -- LDFLAGS="$saved_LDFLAGS" -- -- if test "x$ckpt_found" = "xyes"; then -- AIS_LDFLAGS="$TRY" -- break -- fi -- done --fi --if test "x$ckpt_found" = "xyes"; then -- AC_MSG_RESULT(yes) --else -- AC_MSG_RESULT(no) -- AC_MSG_WARN([libSaCkpt not found, ocfs2_controld will not be built]) --fi --AC_SUBST(AIS_LDFLAGS) -- - libdlmcontrol_found= - AC_CHECK_LIB(dlmcontrol, dlmc_fs_connect, - [AC_CHECK_HEADER(libdlmcontrol.h, libdlmcontrol_found=yes, -@@ -379,7 +326,7 @@ AC_SUBST(BUILD_FSDLM_SUPPORT) - AC_SUBST(DL_LIBS) - - BUILD_OCFS2_CONTROLD= --if test "x$cpg_found" = "xyes" -a "x$ckpt_found" = "xyes" -a "x$libdlmcontrol_found" = "xyes"; then -+if test "x$cpg_found" = "xyes" -a "x$libdlmcontrol_found" = "xyes"; then - if test "x$fsdlm_found" = "xyes"; then - BUILD_OCFS2_CONTROLD=yes - else -@@ -388,12 +335,6 @@ if test "x$cpg_found" = "xyes" -a "x$ckp - fi - AC_SUBST(BUILD_OCFS2_CONTROLD) - --BUILD_PCMK_SUPPORT= --if test "x$pcmk_found" = "xyes" -a "x$BUILD_OCFS2_CONTROLD" = "xyes"; then -- BUILD_PCMK_SUPPORT=yes --fi --AC_SUBST(BUILD_PCMK_SUPPORT) -- - BUILD_CMAN_SUPPORT= - if test "x$cman_found" = "xyes" -a "x$BUILD_OCFS2_CONTROLD" = "xyes"; then - BUILD_CMAN_SUPPORT=yes -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/Makefile 2013-07-31 08:15:39.324743014 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile 2013-07-31 08:15:50.516076420 -0500 -@@ -14,18 +14,17 @@ endif - ifneq ($(BUILD_PCMK_SUPPORT),) - SBIN_PROGRAMS += ocfs2_controld.pcmk - # Some pacemaker headers which pacemaker.c includes want this. --PCMK_INCLUDES = -I/usr/include/pacemaker -I/usr/include/heartbeat/ $(GLIB_CFLAGS) -+#PCMK_INCLUDES = -I/usr/include/pacemaker -I/usr/include/heartbeat/ $(GLIB_CFLAGS) - endif - --INCLUDES = -I$(TOPDIR)/include -I. $(PCMK_INCLUDES) -+ -+INCLUDES = -I$(TOPDIR)/include -I. - LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb - LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a - LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 - LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a --COROSYNC_LIBS = $(CPG_LDFLAGS) -lcpg --OPENAIS_LIBS = $(AIS_LDFLAGS) -lSaCkpt -+COROSYNC_LIBS = $(CPG_LDFLAGS) -lcpg -lcmap -lcfg -lquorum - DLMCONTROL_LIBS = -ldlmcontrol --CRM_LIBS = -lcrmcluster -lstonithd -lcrmcommon - - ifdef OCFS2_DEBUG - OPTS += -ggdb -@@ -44,15 +43,16 @@ UNINST_HFILES = ocfs2_controld.h - ifneq ($(HAVE_COROSYNC),) - DEFINES += -DHAVE_COROSYNC=1 - endif --DAEMON_CFILES = main.c cpg.c mount.c ckpt.c dlmcontrol.c -+DAEMON_CFILES = main.c cpg.c mount.c dlmcontrol.c - - CMAN_CFILES = cman.c - CMAN_DAEMON_CFILES = $(DAEMON_CFILES) $(CMAN_CFILES) - CMAN_DAEMON_OBJS = $(subst .c,.o,$(CMAN_DAEMON_CFILES)) - --PCMK_CFILES = pacemaker.c --PCMK_DAEMON_CFILES = $(DAEMON_CFILES) $(PCMK_CFILES) --PCMK_DAEMON_OBJS = $(subst .c,.o,$(PCMK_DAEMON_CFILES)) -+COROSYNC_CFILES = -+COROSYNC_DAEMON_CFILES = $(DAEMON_CFILES) $(COROSYNC_CFILES) -+COROSYNC_DAEMON_OBJS = $(subst .c,.o,$(COROSYNC_DAEMON_CFILES)) -+ - - TEST_CFILES = test_client.c - TEST_OBJS = $(subst .c,.o,$(TEST_CFILES) $(PROTO_CFILES)) -@@ -60,18 +60,17 @@ MANS = - - DIST_FILES = \ - $(DAEMON_CFILES) \ -- $(PCMK_CFILES) \ - $(CMAN_CFILES) \ - $(TEST_CFILES) \ - $(UNINST_HFILES) \ - $(addsuffix .in,$(MANS)) --ocfs2_controld.pcmk: $(PCMK_DAEMON_OBJS) $(LIBO2CB_DEPS) -+ocfs2_controld.pcmk: $(COROSYNC_DAEMON_OBJS) $(LIBO2CB_DEPS) - $(LINK) $(GLIB_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) \ -- $(OPENAIS_LIBS) $(COROSYNC_LIBS) \ -- $(DLMCONTROL_LIBS) $(CRM_LIBS) -+ $(COROSYNC_LIBS) \ -+ $(DLMCONTROL_LIBS) - - ocfs2_controld.cman: $(CMAN_DAEMON_OBJS) $(LIBO2CB_DEPS) -- $(LINK) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) $(OPENAIS_LIBS) \ -+ $(LINK) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) \ - $(COROSYNC_LIBS) $(DLMCONTROL_LIBS) -lcman - - test_client: $(TEST_OBJS) $(LIBO2CB_DEPS) $(LIBOCFS2_DEPS) -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/cpg.c 2013-07-31 08:15:39.325743044 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c 2013-07-31 08:15:50.516076420 -0500 -@@ -474,20 +474,20 @@ static struct cgroup *handle_to_group(cp - return NULL; - } - --static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name, -+static void deliver_cb(cpg_handle_t handle, const struct cpg_name *group_name, - uint32_t nodeid, uint32_t pid, -- void *data, int data_len) -+ void *data, size_t data_len) - { - log_debug("deliver called"); - } - --static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, -- struct cpg_address *member_list, -- int member_list_entries, -- struct cpg_address *left_list, -- int left_list_entries, -- struct cpg_address *joined_list, -- int joined_list_entries) -+static void confchg_cb(cpg_handle_t handle, const struct cpg_name *group_name, -+ const struct cpg_address *member_list, -+ size_t member_list_entries, -+ const struct cpg_address *left_list, -+ size_t left_list_entries, -+ const struct cpg_address *joined_list, -+ size_t joined_list_entries) - { - int i; - struct cgroup *cg; -@@ -499,13 +499,13 @@ static void confchg_cb(cpg_handle_t hand - return; - - if (left_list_entries > CPG_MEMBERS_MAX) { -- log_debug("left_list_entries %d", left_list_entries); -+ log_debug("left_list_entries %d", (int) left_list_entries); - left_list_entries = CPG_MEMBERS_MAX; - } else if (joined_list_entries > CPG_MEMBERS_MAX) { -- log_debug("joined_list_entries %d", joined_list_entries); -+ log_debug("joined_list_entries %d", (int) joined_list_entries); - joined_list_entries = CPG_MEMBERS_MAX; - } else if (member_list_entries > CPG_MEMBERS_MAX) { -- log_debug("member_list_entries %d", member_list_entries); -+ log_debug("member_list_entries %d", (int) member_list_entries); - member_list_entries = CPG_MEMBERS_MAX; - } - -@@ -530,7 +530,7 @@ static cpg_callbacks_t callbacks = { - - static void process_cpg(int ci) - { -- cpg_error_t error; -+ cs_error_t error; - cpg_flow_control_state_t flow_control_state; - struct cgroup *cg; - -@@ -539,15 +539,15 @@ static void process_cpg(int ci) - return; - - cg->cg_got_confchg = 0; -- error = cpg_dispatch(cg->cg_handle, CPG_DISPATCH_ONE); -- if (error != CPG_OK) { -+ error = cpg_dispatch(cg->cg_handle, CS_DISPATCH_ONE); -+ if (error != CS_OK) { - log_error("cpg_dispatch error %d", error); - return; - } - - error = cpg_flow_control_state_get(cg->cg_handle, - &flow_control_state); -- if (error != CPG_OK) -+ if (error != CS_OK) - log_error("cpg_flow_control_state_get %d", error); - else if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) { - message_flow_control_on = 1; -@@ -582,21 +582,21 @@ static void dead_cpg(int ci) - - static int start_join(struct cgroup *cg) - { -- cpg_error_t error; -+ cs_error_t error; - - log_debug("Starting join for group \"%.*s\"", - cg->cg_name.length, cg->cg_name.value); - do { - error = cpg_join(cg->cg_handle, &cg->cg_name); -- if (error == CPG_OK) { -+ if (error == CS_OK) { - log_debug("cpg_join succeeded"); - error = 0; -- } else if (error == CPG_ERR_TRY_AGAIN) { -+ } else if (error == CS_ERR_TRY_AGAIN) { - log_debug("cpg_join retry"); - sleep(1); - } else - log_error("cpg_join error %d", error); -- } while (error == CPG_ERR_TRY_AGAIN); -+ } while (error == CS_ERR_TRY_AGAIN); - - return error; - } -@@ -604,7 +604,7 @@ static int start_join(struct cgroup *cg) - static int start_leave(struct cgroup *cg) - { - int i; -- cpg_error_t error; -+ cs_error_t error; - - if (!cg->cg_handle) - return -EINVAL; -@@ -615,14 +615,14 @@ static int start_leave(struct cgroup *cg - for (i = 0; i < 10; i++) { - error = cpg_leave(cg->cg_handle, - &cg->cg_name); -- if (error == CPG_ERR_TRY_AGAIN) { -+ if (error == CS_ERR_TRY_AGAIN) { - if (!i) - log_debug("cpg_leave retry"); - sleep(1); - continue; - } - -- if (error == CPG_OK) -+ if (error == CS_OK) - log_debug("cpg_leave succeeded"); - else - log_error("cpg_leave error %d", error); -@@ -630,9 +630,9 @@ static int start_leave(struct cgroup *cg - break; - } - -- if (error == CPG_OK) -+ if (error == CS_OK) - return 0; -- else if (error == CPG_ERR_TRY_AGAIN) -+ else if (error == CS_ERR_TRY_AGAIN) - return -EAGAIN; - else - return -EIO; -@@ -641,7 +641,7 @@ static int start_leave(struct cgroup *cg - - static int init_group(struct cgroup *cg, const char *name) - { -- cpg_error_t error; -+ cs_error_t error; - - cg->cg_name.length = snprintf(cg->cg_name.value, - CPG_MAX_NAME_LENGTH, -@@ -653,7 +653,7 @@ static int init_group(struct cgroup *cg, - } - - error = cpg_initialize(&cg->cg_handle, &callbacks); -- if (error != CPG_OK) { -+ if (error != CS_OK) { - log_error("cpg_initialize error %d", error); - goto out; - } -@@ -740,7 +740,7 @@ static void daemon_set_cgroup(struct cgr - - int setup_cpg(void (*daemon_joined)(int first)) - { -- cpg_error_t error; -+ cs_error_t error; - - INIT_LIST_HEAD(&group_list); - daemon_group.cg_set_cgroup = daemon_set_cgroup; -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:15:10.359879781 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:15:50.517076450 -0500 -@@ -651,255 +651,6 @@ static int proto_version_to_checkpoint(s - return 0; - } - --static int checkpoint_to_proto_version(char *data, size_t data_len, -- struct ocfs2_protocol_version *proto) --{ -- long major, minor; -- char *ptr; -- struct proto_version_str { -- char major[2]; -- char space; -- char minor[2]; -- char null; -- } str; -- -- if (data_len != sizeof(struct proto_version_str)) { -- log_error("Protocol version string \"%.*s\" has incorrect " -- "length", -- (int)data_len, data); -- return -EINVAL; -- } -- memcpy((char *)&str, data, data_len); -- -- if ((str.space != ' ') || (str.null != '\0')) { -- log_error("Protocol version string \"%.*s\" has invalid " -- "separators", -- (int)data_len, data); -- return -EINVAL; -- } -- str.space = '\0'; -- -- major = strtol(str.major, &ptr, 16); -- if (!ptr || *ptr) { -- log_error("Protocol request has bad version 0x%s 0x%s", -- str.major, str.minor); -- return -EINVAL; -- } -- minor = strtol(str.minor, &ptr, 16); -- if (!ptr || *ptr) { -- log_error("Protocol version string has bad version 0x%s 0x%s", -- str.major, str.minor); -- return -EINVAL; -- } -- -- /* The major and minor must be between 0 and 255, inclusive. */ -- if ((major == LONG_MIN) || (major == LONG_MAX) || -- (minor == LONG_MIN) || (minor == LONG_MAX) || -- (major > (uint8_t)-1) || (major < 0) || -- (minor > (uint8_t)-1) || (minor < 0)) { -- log_error("Protocol version string has bad version 0x%s 0x%s", -- str.major, str.minor); -- return -ERANGE; -- } -- -- proto->pv_major = major; -- proto->pv_minor = minor; -- -- return 0; --} -- --static int install_node_checkpoint(void) --{ -- int rc; -- char *buf; -- errcode_t err; -- -- err = o2cb_get_max_locking_protocol(&fs_max_proto); -- if (err) { -- log_error("Error querying maximum filesystem locking " -- "protocol: %s", -- error_message(err)); -- rc = -EIO; -- goto out; -- } -- -- rc = ckpt_open_this_node(&node_handle); -- if (rc) -- goto out; -- -- rc = proto_version_to_checkpoint(&daemon_max_proto, &buf); -- if (rc) -- goto out; -- -- rc = ckpt_section_store(node_handle, DAEMON_MAX_PROTOCOL_SECTION, -- buf, strlen(buf) + 1); -- free(buf); -- if (rc) -- goto out; -- -- rc = proto_version_to_checkpoint(&fs_max_proto, &buf); -- if (rc) -- goto out; -- -- rc = ckpt_section_store(node_handle, FS_MAX_PROTOCOL_SECTION, -- buf, strlen(buf) + 1); -- free(buf); -- --out: -- return rc; --} -- --static void drop_node_checkpoint(void) --{ -- if (node_handle) -- ckpt_close(node_handle); --} -- --/* -- * If we're the only daemon running, install our maximum protocols -- * as the running values. -- */ --static int install_global_checkpoint(void) --{ -- int rc; -- char *buf; -- -- daemon_running_proto = daemon_max_proto; -- fs_running_proto = fs_max_proto; -- -- rc = ckpt_open_global(1); -- if (rc) -- goto out; -- -- rc = proto_version_to_checkpoint(&daemon_running_proto, &buf); -- if (rc) -- goto out; -- -- rc = ckpt_global_store(DAEMON_PROTOCOL_SECTION, buf, -- strlen(buf) + 1); -- free(buf); -- if (rc) -- goto out; -- -- rc = proto_version_to_checkpoint(&fs_running_proto, &buf); -- if (rc) -- goto out; -- -- rc = ckpt_global_store(FS_PROTOCOL_SECTION, buf, strlen(buf) + 1); -- free(buf); -- --out: -- return rc; --} -- --/* -- * Compare the cluster's locking protocol version against our maximum. -- * -- * If the major numbers are different, they are incompatible. -- * If the cluster's minor is greater than our maximum minor, they are -- * incompatible. -- */ --static int protocol_compatible(struct ocfs2_protocol_version *cluster, -- struct ocfs2_protocol_version *our_max) --{ -- if (cluster->pv_major != our_max->pv_major) -- return 0; -- -- if (cluster->pv_minor > our_max->pv_minor) -- return 0; -- -- return 1; --} -- --static int read_global_checkpoint(void) --{ -- int rc, seen = 0, opened = 0, retrycount = 0; -- char *buf; -- size_t len; -- --retry: -- rc = ckpt_open_global(0); -- if (rc) -- goto out; -- seen = 1; -- opened = 1; -- -- rc = ckpt_global_get(DAEMON_PROTOCOL_SECTION, &buf, &len); -- if (rc) -- goto out; -- -- rc = checkpoint_to_proto_version(buf, len, &daemon_running_proto); -- free(buf); -- if (rc) -- goto out; -- if (!protocol_compatible(&daemon_running_proto, -- &daemon_max_proto)) { -- log_error("Our maximum daemon protocol (%d.%d) is not " -- "compatible with the cluster's protocol (%d.%d)", -- daemon_max_proto.pv_major, -- daemon_max_proto.pv_minor, -- daemon_running_proto.pv_major, -- daemon_running_proto.pv_minor); -- rc = -EPROTONOSUPPORT; -- goto out; -- } -- -- rc = ckpt_global_get(FS_PROTOCOL_SECTION, &buf, &len); -- if (rc) -- goto out; -- -- rc = checkpoint_to_proto_version(buf, len, &fs_running_proto); -- free(buf); -- if (rc) -- goto out; -- -- if (!protocol_compatible(&fs_running_proto, -- &fs_max_proto)) { -- log_error("Our maximum fs protocol (%d.%d) is not " -- "compatible with the cluster's protocol (%d.%d)", -- fs_max_proto.pv_major, -- fs_max_proto.pv_minor, -- fs_running_proto.pv_major, -- fs_running_proto.pv_minor); -- rc = -EPROTONOSUPPORT; -- } -- --out: -- if (rc == -ENOENT) { -- /* -- * -ENOENT means the first daemon hasn't gotten the -- * global checkpoint fully installed yet. Either the -- * checkpoint or one of its sections is missing. -- * -- * If we saw the checkpoint once, but now it's gone, it -- * means the first daemon died. We don't recover from -- * that. But if we haven't seen the checkpoint yet, or if -- * it's just a missing section, we can keep trying. -- */ -- -- if (opened) -- ckpt_close_global(); -- -- if (seen && !opened) { -- log_error("The global checkpoint disappeared out " -- "from underneath us. This shouldn't " -- "happen to a daemon that is not the " -- "first in the cluster"); -- } else { -- opened = 0; -- retry_warning(retrycount, -- "Attempted to read the cluster's " -- "protocol versions %d times, still " -- "trying", -- retrycount); -- sleep_ms(10); -- goto retry; -- } -- } -- -- return rc; --} -- - static void cpg_joined(int first) - { - int rv; -@@ -908,16 +659,6 @@ static void cpg_joined(int first) - log_debug("CPG is live, we are %s first daemon", - first ? "the" : "not the"); - -- if (first) -- rv = install_global_checkpoint(); -- else -- rv = read_global_checkpoint(); -- -- if (rv) { -- shutdown_daemon(); -- return; -- } -- - log_debug("Daemon protocol is %d.%d", - daemon_running_proto.pv_major, - daemon_running_proto.pv_minor); -@@ -1018,14 +759,6 @@ static int loop(void) - if (rv < 0) - goto out; - -- rv = setup_stack(); -- if (rv < 0) -- goto out; -- -- rv = setup_ckpt(); -- if (rv < 0) -- goto out; -- - rv = install_node_checkpoint(); - if (rv < 0) - goto out; -@@ -1077,9 +810,6 @@ stop: - o2cb_control_close(); - exit_dlmcontrol(); - exit_cpg(); -- drop_node_checkpoint(); -- exit_ckpt(); -- exit_stack(); - - out: - return rv; diff --git a/0002-Add-corosync-cfg-to-get-configuration-information.patch b/0002-Add-corosync-cfg-to-get-configuration-information.patch deleted file mode 100644 index 24f2ab2..0000000 --- a/0002-Add-corosync-cfg-to-get-configuration-information.patch +++ /dev/null @@ -1,315 +0,0 @@ -From 1a7b9a35228cd5ef9d6ad96ec35f6fc812ee821c Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Tue, 23 Jul 2013 12:09:28 -0500 -Subject: [PATCH 2/5] Add corosync cfg to get configuration information - ---- - ocfs2_controld/Makefile | 2 +- - ocfs2_controld/cpg.c | 1 - - ocfs2_controld/main.c | 58 ++------------------- - ocfs2_controld/member.c | 111 ++++++++++++++++++++++++++++++++++++++++ - ocfs2_controld/ocfs2_controld.h | 20 ++------ - 5 files changed, 119 insertions(+), 73 deletions(-) - create mode 100644 ocfs2_controld/member.c - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/Makefile 2013-07-31 08:25:43.559675366 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/Makefile 2013-07-31 08:26:05.733331692 -0500 -@@ -49,7 +49,7 @@ CMAN_CFILES = cman.c - CMAN_DAEMON_CFILES = $(DAEMON_CFILES) $(CMAN_CFILES) - CMAN_DAEMON_OBJS = $(subst .c,.o,$(CMAN_DAEMON_CFILES)) - --COROSYNC_CFILES = -+COROSYNC_CFILES = member.c - COROSYNC_DAEMON_CFILES = $(DAEMON_CFILES) $(COROSYNC_CFILES) - COROSYNC_DAEMON_OBJS = $(subst .c,.o,$(COROSYNC_DAEMON_CFILES)) - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/cpg.c 2013-07-31 08:25:34.868418089 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/cpg.c 2013-07-31 08:25:43.559675366 -0500 -@@ -339,7 +339,6 @@ static void handle_daemon_left(struct cp - if (1) { - log_error("kill node %d - ocfs2_controld PROCDOWN", - addr->nodeid); -- kill_stack_node(addr->nodeid); - } - - /* FALL THROUGH */ -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-07-31 08:25:34.837417171 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-07-31 08:25:43.560675395 -0500 -@@ -114,10 +114,8 @@ static struct ocfs2_protocol_version dae - .pv_major = CONTROLD_PROTOCOL_MAJOR, - .pv_minor = CONTROLD_PROTOCOL_MINOR, - }; --static struct ocfs2_protocol_version fs_max_proto; - struct ocfs2_protocol_version daemon_running_proto; - struct ocfs2_protocol_version fs_running_proto; --struct ckpt_handle *node_handle; - - void shutdown_daemon(void) - { -@@ -254,11 +252,6 @@ static int do_mount(int ci, int fd, cons - goto fail; - } - -- if (!validate_cluster(cluster)) { -- error_msg = "Invalid cluster name"; -- goto fail; -- } -- - return start_mount(ci, fd, uuid, device, service); - - fail: -@@ -456,11 +449,6 @@ static int send_filesystems(int ci, int - goto fail; - } - -- if (!validate_cluster(cluster)) { -- error_msg = "Invalid cluster name"; -- goto fail; -- } -- - return send_mountgroups(ci, fd); - - fail: -@@ -471,15 +459,6 @@ static int send_clustername(int ci, int - { - int rc = 0, rctmp; - char error_msg[100]; /* Arbitrary size smaller than a message */ -- const char *cluster; -- -- rc = get_clustername(&cluster); -- if (rc) { -- snprintf(error_msg, sizeof(error_msg), -- "Unable to query cluster name: %s", -- strerror(-rc)); -- goto out_status; -- } - - /* Cman only supports one cluster */ - rc = send_message(fd, CM_ITEMCOUNT, 1); -@@ -490,7 +469,7 @@ static int send_clustername(int ci, int - goto out_status; - } - -- rc = send_message(fd, CM_ITEM, cluster); -+ rc = send_message(fd, CM_ITEM, cluster_name); - if (rc) { - snprintf(error_msg, sizeof(error_msg), - "Unable to send ITEM: %s", -@@ -630,27 +609,6 @@ static int setup_listener(void) - return 0; - } - --static int proto_version_to_checkpoint(struct ocfs2_protocol_version *proto, -- char **checkpoint_data) --{ -- size_t len; -- char *buf; -- -- len = snprintf(NULL, 0, "%02x %02x", proto->pv_major, -- proto->pv_minor); -- buf = malloc(sizeof(char) * (len + 1)); -- if (!buf) { -- log_error("Unable to allocate memory for checkpoint data"); -- return -ENOMEM; -- } -- -- snprintf(buf, len + 1, "%02x %02x", proto->pv_major, -- proto->pv_minor); -- *checkpoint_data = buf; -- -- return 0; --} -- - static void cpg_joined(int first) - { - int rv; -@@ -759,7 +717,7 @@ static int loop(void) - if (rv < 0) - goto out; - -- rv = install_node_checkpoint(); -+ rv = setup_cluster_cfg(); - if (rv < 0) - goto out; - -@@ -1032,17 +990,6 @@ int main(int argc, char **argv) - return 1; - } - -- err = o2cb_get_stack_name(&stack); -- if (err) { -- com_err(prog_name, err, "while determining the current cluster stack"); -- return 1; -- } -- if (strcmp(stack, stackname)) { -- log_error("%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use", -- prog_name, stackname, stack); -- return 1; -- } -- - if (!daemon_debug_opt) - daemonize(); - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c 2013-07-31 08:25:43.560675395 -0500 -@@ -0,0 +1,111 @@ -+#include -+#include -+#include -+#include -+ -+#include "ocfs2_controld.h" -+#include -+#include -+#include -+ -+ -+char cluster_name[65]; -+int our_nodeid; -+ -+static corosync_cfg_handle_t ch; -+ -+static int detect_cluster_name(void) -+{ -+ cmap_handle_t handle; -+ char *str = NULL; -+ int rv, err = -1; -+ -+ rv = cmap_initialize(&handle); -+ if (rv != CS_OK) { -+ log_error("cmap_initialize error %d", rv); -+ return -1; -+ } -+ -+ rv = cmap_get_string(handle, "totem.cluster_name", &str); -+ if (rv != CS_OK) { -+ log_error("cmap_get_string totem.cluster_name error %d", rv); -+ goto out; -+ } else -+ err = 0; -+ -+ log_debug("cmap totem.cluster_name = '%s'", str); -+ -+ strncpy(cluster_name, str, 64); -+out: -+ if (str) -+ free(str); -+ cmap_finalize(handle); -+ return err; -+} -+ -+static void shutdown_callback(corosync_cfg_handle_t h, -+ corosync_cfg_shutdown_flags_t flags) -+{ -+ if (flags & COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST) { -+ log_debug("shutdown request yes"); -+ corosync_cfg_replyto_shutdown(ch, COROSYNC_CFG_SHUTDOWN_FLAG_YES); -+ } -+} -+ -+static corosync_cfg_callbacks_t cfg_callbacks = -+{ -+ .corosync_cfg_shutdown_callback = shutdown_callback, -+}; -+ -+int setup_cluster_cfg(void) -+{ -+ cs_error_t err; -+ unsigned int nodeid; -+ int fd; -+ int retry = 1; -+ -+try_again: -+ err = corosync_cfg_initialize(&ch, &cfg_callbacks); -+ if (err != CS_OK) { -+ if ((err == CS_ERR_TRY_AGAIN) && (retry <= 10)) { -+ log_error("corosync has not completed initialization.. retry %d", retry); -+ sleep(1); -+ retry++; -+ goto try_again; -+ } -+ log_error("corosync cfg init error %d", err); -+ return -1; -+ } -+ -+ err = corosync_cfg_fd_get(ch, &fd); -+ if (err != CS_OK) { -+ log_error("corosync cfg fd_get error %d", err); -+ corosync_cfg_finalize(ch); -+ return -1; -+ } -+ -+ err = corosync_cfg_local_get(ch, &nodeid); -+ if (err != CS_OK) { -+ log_error("corosync cfg local_get error %d", err); -+ corosync_cfg_finalize(ch); -+ return -1; -+ } -+ -+ our_nodeid = nodeid; -+ log_debug("our_nodeid %d", our_nodeid); -+ -+ if (our_nodeid < 0) { -+ log_error("negative nodeid, set corosync totem.clear_node_high_bit"); -+ corosync_cfg_finalize(ch); -+ return -1; -+ } -+ -+ return fd; -+} -+ -+void close_cluster_cfg(void) -+{ -+ corosync_cfg_finalize(ch); -+} -+ -+ -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/ocfs2_controld.h -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/ocfs2_controld.h 2013-07-31 08:25:34.869418118 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/ocfs2_controld.h 2013-07-31 08:25:43.560675395 -0500 -@@ -39,6 +39,7 @@ extern int dump_point; - extern int dump_wrap; - extern int our_nodeid; - extern const char *stackname; -+extern char cluster_name[65]; - - extern void daemon_dump_save(void); - -@@ -70,25 +71,12 @@ int connection_add(int fd, void (*work)( - void connection_dead(int ci); - void shutdown_daemon(void); - --/* ckpt.c */ --int setup_ckpt(void); --void exit_ckpt(void); --int ckpt_open_global(int write); --void ckpt_close_global(void); --int ckpt_open_node(int nodeid, struct ckpt_handle **handle); --int ckpt_open_this_node(struct ckpt_handle **handle); --void ckpt_close(struct ckpt_handle *handle); --int ckpt_global_store(const char *section, const char *data, size_t data_len); --int ckpt_global_get(const char *section, char **data, size_t *data_len); --int ckpt_section_store(struct ckpt_handle *handle, const char *section, -- const char *data, size_t data_len); --int ckpt_section_get(struct ckpt_handle *handle, const char *section, -- char **data, size_t *data_len); -- -+/* member.c */ -+int setup_cluster_cfg(void); -+void close_cluster_cfg(void); - /* stack-specific interfaces (cman.c) */ - int setup_stack(void); - char *nodeid2name(int nodeid); --int validate_cluster(const char *cluster); - int get_clustername(const char **cluster); - int kill_stack_node(int nodeid); - void exit_stack(void); diff --git a/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch b/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch deleted file mode 100644 index a8aed70..0000000 --- a/0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch +++ /dev/null @@ -1,188 +0,0 @@ -From f49e6a0dd32f1b891a9281584a6c2516afe3d200 Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Sat, 27 Jul 2013 14:28:48 -0500 -Subject: [PATCH 3/5] Remove daemon protocol versions and consolidate fs - versions - -We don't need the daemon protocol version. If there is a need -you can think of, please let me know. ---- - ocfs2_controld/main.c | 124 +++++++++++++++++++++++++++----------------------- - 1 file changed, 67 insertions(+), 57 deletions(-) - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/main.c 2013-08-06 09:55:48.527750439 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/main.c 2013-08-06 09:55:48.544750962 -0500 -@@ -47,12 +47,14 @@ - #define LOCKFILE_NAME "/var/run/ocfs2_controld.pid" - #define NALLOC 8 - --#define CONTROLD_PROTOCOL_MAJOR 1 --#define CONTROLD_PROTOCOL_MINOR 0 --#define DAEMON_MAX_PROTOCOL_SECTION "daemon_max_protocol" --#define DAEMON_PROTOCOL_SECTION "daemon_protocol" --#define FS_MAX_PROTOCOL_SECTION "ocfs2_max_protocol" --#define FS_PROTOCOL_SECTION "ocfs2_protocol" -+#define FS_PROTOCOL_MAJOR 1 -+#define FS_PROTOCOL_MINOR 0 -+ -+static struct ocfs2_protocol_version fs_max_proto = { -+ .pv_major = FS_PROTOCOL_MAJOR, -+ .pv_minor = FS_PROTOCOL_MINOR, -+}; -+ - - struct client { - int fd; -@@ -80,41 +82,6 @@ char dump_buf[DUMP_SIZE]; - int dump_point; - int dump_wrap; - --/* -- * Protocol negotiation. -- * -- * This is the maximum protocol supported by the daemon for inter-daemon -- * communication. The negotiated value daemon_running_proto is what the -- * daemon uses at runtime. -- * -- * All daemons must support the initial protocol, which works as follows: -- * Prior to starting CPG, daemons store two values in the local node -- * checkpoint. The maximum daemon protocol is stored in the -- * "daemon_max_protocol" section, and the ocfs2 maximum protocol is stored -- * in the "ocfs2_max_protocol" section. The protocols are stored in the -- * format: -- * -- * <2-char-hex-major><2-char-hex-minor> -- * -- * These sections MUST be created before CPG is started. Other sections -- * MUST NOT be created at this time. -- * -- * Once CPG is started, the daemon reads the "daemon_protocol" and -- * "ocfs2_protocol" sections from the daemon's global checkpoint. The -- * values are stored as the running versions. All interaction takes place -- * based on the running versions. At this point, the daemon may add -- * other sections to the local node checkpoint that are part of the -- * running protocol. -- * -- * If the daemon is the first node to join the group, it sets the -- * "daemon_protocol" and "ocfs2_protocol" sections of the global checkpoint -- * to the maximum values this daemon supports. -- */ --static struct ocfs2_protocol_version daemon_max_proto = { -- .pv_major = CONTROLD_PROTOCOL_MAJOR, -- .pv_minor = CONTROLD_PROTOCOL_MINOR, --}; --struct ocfs2_protocol_version daemon_running_proto; - struct ocfs2_protocol_version fs_running_proto; - - void shutdown_daemon(void) -@@ -609,6 +576,51 @@ static int setup_listener(void) - return 0; - } - -+/* -+ * Compare the cluster's locking protocol version against our maximum. -+ * -+ * If the major numbers are different, they are incompatible. -+ * If the cluster's minor is greater than our maximum minor, they are -+ * incompatible. -+ */ -+static int protocol_compatible(struct ocfs2_protocol_version *cluster, -+ struct ocfs2_protocol_version *our_max) -+{ -+ if (cluster->pv_major != our_max->pv_major) -+ return 0; -+ -+ if (cluster->pv_minor > our_max->pv_minor) -+ return 0; -+ -+ return 1; -+} -+ -+static int check_protocol_version(void) -+{ -+ int rc = 0; -+ -+ fs_running_proto.pv_major = 1; -+ fs_running_proto.pv_minor = 0; -+ -+ o2cb_get_max_locking_protocol(&fs_max_proto); -+ -+ if (!protocol_compatible(&fs_running_proto, -+ &fs_max_proto)) { -+ log_error("Our maximum fs protocol (%d.%d) is not " -+ "compatible with the cluster's protocol (%d.%d)", -+ fs_max_proto.pv_major, -+ fs_max_proto.pv_minor, -+ fs_running_proto.pv_major, -+ fs_running_proto.pv_minor); -+ rc = -EPROTONOSUPPORT; -+ } -+ -+ log_debug("fs protocol is %d.%d", -+ fs_running_proto.pv_major, fs_running_proto.pv_minor); -+ return rc; -+ -+} -+ - static void cpg_joined(int first) - { - int rv; -@@ -617,34 +629,33 @@ static void cpg_joined(int first) - log_debug("CPG is live, we are %s first daemon", - first ? "the" : "not the"); - -- log_debug("Daemon protocol is %d.%d", -- daemon_running_proto.pv_major, -- daemon_running_proto.pv_minor); -- log_debug("fs protocol is %d.%d", -- fs_running_proto.pv_major, fs_running_proto.pv_minor); -+ rv = check_protocol_version(); -+ if (rv) -+ goto error; - - log_debug("Connecting to dlm_controld"); - rv = setup_dlmcontrol(); -- if (rv) { -- shutdown_daemon(); -- return; -- } -+ if (rv) -+ goto error; - - log_debug("Opening control device"); - err = o2cb_control_open(our_nodeid, &fs_running_proto); - if (err) { - log_error("Error opening control device: %s", - error_message(err)); -- shutdown_daemon(); -- return; -+ goto error; - } - - log_debug("Starting to listen for mounters"); - rv = setup_listener(); -- if (rv < 0) { -- shutdown_daemon(); -- return; -- } -+ if (rv < 0) -+ goto error; -+ -+ return; -+error: -+ shutdown_daemon(); -+ return; -+ - } - - static int find_minors(void) -@@ -975,7 +986,6 @@ int main(int argc, char **argv) - { - errcode_t err; - prog_name = argv[0]; -- const char *stack = NULL; - - decode_arguments(argc, argv); - diff --git a/0005-Add-cluster_name-and-stack-name.patch b/0005-Add-cluster_name-and-stack-name.patch deleted file mode 100644 index c608f65..0000000 --- a/0005-Add-cluster_name-and-stack-name.patch +++ /dev/null @@ -1,31 +0,0 @@ -From af06444bea1bcc8006c295a5a2663e0372814df5 Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Sun, 28 Jul 2013 17:49:21 -0500 -Subject: [PATCH 5/5] Add cluster_name and stack name - ---- - ocfs2_controld/member.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c -=================================================================== ---- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_controld/member.c 2013-07-31 08:20:04.239619381 -0500 -+++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_controld/member.c 2013-07-31 08:23:47.608241901 -0500 -@@ -11,6 +11,8 @@ - - char cluster_name[65]; - int our_nodeid; -+/* Using pcmk for legacy reasons */ -+const char *stackname = "pcmk"; - - static corosync_cfg_handle_t ch; - -@@ -93,6 +95,8 @@ try_again: - - our_nodeid = nodeid; - log_debug("our_nodeid %d", our_nodeid); -+ detect_cluster_name(); -+ log_debug("our cluster name %s", cluster_name); - - if (our_nodeid < 0) { - log_error("negative nodeid, set corosync totem.clear_node_high_bit"); diff --git a/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch b/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch deleted file mode 100644 index 1b3f5de..0000000 --- a/0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 4c80d4b994e99443ae403f22d3e65fd5e2c3edb7 Mon Sep 17 00:00:00 2001 -From: Goldwyn Rodrigues -Date: Fri, 23 Aug 2013 22:39:54 -0500 -Subject: [PATCH 7/7] mount.ocfs2 performs module loading/cluster_stack setup - ---- - mount.ocfs2/Makefile | 2 +- - mount.ocfs2/mount.ocfs2.c | 6 +++ - mount.ocfs2/mount.ocfs2.h | 1 + - mount.ocfs2/stack.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ - mount.ocfs2/stack.h | 2 + - 5 files changed, 142 insertions(+), 1 deletion(-) - create mode 100644 mount.ocfs2/stack.c - create mode 100644 mount.ocfs2/stack.h - -diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile -index 2736f5f..8f80b62 100644 ---- a/mount.ocfs2/Makefile -+++ b/mount.ocfs2/Makefile -@@ -15,7 +15,7 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a - - DEFINES = -DVERSION=\"$(VERSION)\" - --CORE_CFILES = fstab.c mntent.c realpath.c sundries.c xmalloc.c opts.c -+CORE_CFILES = fstab.c mntent.c realpath.c sundries.c xmalloc.c opts.c stack.c - MOUNT_CFILES = mount.ocfs2.c - - HFILES = $(subst .c,.h,$(MOUNT_CFILES) $(CORE_CFILES)) -diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c -index f2ca5cb..4b9ba1f 100644 ---- a/mount.ocfs2/mount.ocfs2.c -+++ b/mount.ocfs2/mount.ocfs2.c -@@ -357,6 +357,12 @@ int main(int argc, char **argv) - if (verbose) - printf("device=%s\n", mo.dev); - -+ ret = setup_stack((char *)OCFS2_RAW_SB(fs->fs_super)->s_cluster_info.ci_stack); -+ if (ret) { -+ com_err(progname, ret, "while setting up stack\n"); -+ goto bail; -+ } -+ - if (clustered) { - ret = o2cb_init(); - if (ret) { -diff --git a/mount.ocfs2/mount.ocfs2.h b/mount.ocfs2/mount.ocfs2.h -index 91d97d0..e76d8c3 100644 ---- a/mount.ocfs2/mount.ocfs2.h -+++ b/mount.ocfs2/mount.ocfs2.h -@@ -47,6 +47,7 @@ - #include "mntent.h" - #include "mount_constants.h" - #include "opts.h" -+#include "stack.h" - - #include "ocfs2/ocfs2.h" - #include "ocfs2/bitops.h" -diff --git a/mount.ocfs2/stack.c b/mount.ocfs2/stack.c -new file mode 100644 -index 0000000..8a9ea93 ---- /dev/null -+++ b/mount.ocfs2/stack.c -@@ -0,0 +1,132 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "stack.h" -+ -+#define CLUSTER_STACK_FILE "/sys/fs/ocfs2/cluster_stack" -+#define MODPROBE_COMMAND "/sbin/modprobe" -+#define USER_KERNEL_MODULE "ocfs2_stack_user" -+#define O2CB_KERNEL_MODULE "ocfs2_stack_o2cb" -+#define USER_STACK_NAME "pcmk" -+#define CLASSIC_STACK_NAME "o2cb" -+#define OCFS2_STACK_LABEL_LEN 4 -+ -+static int read_single_line_file(char *filename, char *line, size_t count) -+{ -+ ssize_t ret = 0; -+ FILE *f; -+ -+ f = fopen(filename, "r"); -+ if (f) { -+ if (fgets(line, count, f)) -+ ret = strlen(line); -+ fclose(f); -+ } else -+ ret = -errno; -+ -+ return ret; -+ -+} -+ -+static int write_single_line_file(char *filename, char *line, size_t count) -+{ -+ ssize_t ret = 0; -+ FILE *f; -+ -+ f = fopen(filename, "w"); -+ if (f) { -+ if (fputs(line, f)) -+ ret = strlen(line); -+ fclose(f); -+ } else -+ ret = -errno; -+ -+ return ret; -+} -+ -+static int perform_modprobe(char *module_name) -+{ -+ pid_t child; -+ int child_status; -+ -+ char *argv[3]; -+ -+ argv[0] = MODPROBE_COMMAND; -+ argv[1] = module_name; -+ argv[2] = NULL; -+ -+ child = fork(); -+ if (child == 0) { -+ execv(MODPROBE_COMMAND, argv); -+ /* If execv fails, we have a problem */ -+ return -EINVAL; -+ } else -+ wait(&child_status); -+ -+ return child_status; -+} -+ -+ -+static int modprobe_and_write_stack(char *stack_name) -+{ -+ perform_modprobe("ocfs2"); -+ if (!strncmp(stack_name, USER_STACK_NAME, OCFS2_STACK_LABEL_LEN)) -+ perform_modprobe(USER_KERNEL_MODULE); -+ else if (strncmp(stack_name, CLASSIC_STACK_NAME, OCFS2_STACK_LABEL_LEN)) -+ perform_modprobe(O2CB_KERNEL_MODULE); -+ else -+ return -EINVAL; -+ -+ write_single_line_file(CLUSTER_STACK_FILE, stack_name, -+ strlen(stack_name)); -+ return 0; -+} -+ -+errcode_t setup_stack(char *stack_name) -+{ -+ char line[64]; -+ int modprobe_performed = 0; -+ errcode_t err = 0; -+ int len; -+ -+redo: -+ len = read_single_line_file(CLUSTER_STACK_FILE, line, sizeof(line)); -+ -+ if (len > 0) { -+ if (line[len - 1] == '\n') { -+ line[len - 1] = '\0'; -+ len--; -+ } -+ -+ if (len != OCFS2_STACK_LABEL_LEN) { -+ err = O2CB_ET_INTERNAL_FAILURE; -+ goto out; -+ } -+ -+ if (strncmp(line, stack_name, OCFS2_STACK_LABEL_LEN)) { -+ err = O2CB_ET_SERVICE_UNAVAILABLE; -+ goto out; -+ } -+ -+ if (!strncmp(line, CLASSIC_STACK_NAME, OCFS2_STACK_LABEL_LEN) || -+ !strncmp(line, USER_STACK_NAME, OCFS2_STACK_LABEL_LEN)) -+ err = 0; -+ else -+ err = O2CB_ET_INTERNAL_FAILURE; -+ -+ } else if (len == -ENOENT) { -+ if (!modprobe_performed) { -+ modprobe_and_write_stack(stack_name); -+ err = O2CB_ET_INTERNAL_FAILURE; -+ modprobe_performed = 1; -+ goto redo; -+ } else -+ err = O2CB_ET_INTERNAL_FAILURE; -+ } -+out: -+ return err; -+} -+ -diff --git a/mount.ocfs2/stack.h b/mount.ocfs2/stack.h -new file mode 100644 -index 0000000..ec5f2de ---- /dev/null -+++ b/mount.ocfs2/stack.h -@@ -0,0 +1,2 @@ -+#include -+errcode_t setup_stack(char *stack_name); --- -1.8.1.4 - diff --git a/0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch b/0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch new file mode 100644 index 0000000..1d8aeb8 --- /dev/null +++ b/0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch @@ -0,0 +1,176 @@ +From 5d0bffdbbadd38173a9bfbf4ffb8d455b5f0b990 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Tue, 3 Sep 2013 07:40:39 -0500 +Subject: [PATCH 8/8] mount.ocfs2: Read stack from device and setup stack if + not present + +Note, this removes cman as the possible user stack. +--- + include/o2cb/o2cb.h | 1 + + libo2cb/o2cb_abi.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++ + mount.ocfs2/mount.ocfs2.c | 6 +++ + 3 files changed, 110 insertions(+) + +diff --git a/include/o2cb/o2cb.h b/include/o2cb/o2cb.h +index d512cf9..5ef9754 100644 +--- a/include/o2cb/o2cb.h ++++ b/include/o2cb/o2cb.h +@@ -208,5 +208,6 @@ void o2cb_control_close(void); + errcode_t o2cb_control_node_down(const char *uuid, unsigned int nodeid); + + errcode_t o2cb_get_hb_ctl_path(char *buf, int count); ++errcode_t o2cb_setup_stack(char *stack_name); + + #endif /* _O2CB_H */ +diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c +index 26ed848..6d1e41a 100644 +--- a/libo2cb/o2cb_abi.c ++++ b/libo2cb/o2cb_abi.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -103,6 +104,7 @@ static struct o2cb_stack_ops user_ops = { + .group_leave = user_group_leave, + }; + static struct o2cb_stack user_stack = { ++ .s_name = "pcmk", + .s_ops = &user_ops, + }; + +@@ -142,6 +144,22 @@ static ssize_t read_single_line_file(const char *file, char *line, + return ret; + } + ++static int write_single_line_file(char *filename, char *line, size_t count) ++{ ++ ssize_t ret = 0; ++ FILE *f; ++ ++ f = fopen(filename, "w"); ++ if (f) { ++ if (fputs(line, f)) ++ ret = strlen(line); ++ fclose(f); ++ } else ++ ret = -errno; ++ ++ return ret; ++} ++ + static ssize_t read_stack_file(char *line, size_t count) + { + return read_single_line_file(CLUSTER_STACK_FILE, line, count); +@@ -2017,3 +2035,88 @@ errcode_t o2cb_get_hb_ctl_path(char *buf, int count) + + return 0; + } ++ ++#define MODPROBE_COMMAND "/sbin/modprobe" ++#define USER_KERNEL_MODULE "ocfs2_stack_user" ++#define O2CB_KERNEL_MODULE "ocfs2_stack_o2cb" ++ ++static int perform_modprobe(char *module_name) ++{ ++ pid_t child; ++ int child_status; ++ ++ char *argv[3]; ++ ++ argv[0] = MODPROBE_COMMAND; ++ argv[1] = module_name; ++ argv[2] = NULL; ++ ++ child = fork(); ++ if (child == 0) { ++ execv(MODPROBE_COMMAND, argv); ++ /* If execv fails, we have a problem */ ++ return -EINVAL; ++ } else ++ wait(&child_status); ++ ++ return child_status; ++} ++ ++errcode_t o2cb_setup_stack(char *stack_name) ++{ ++ char line[64]; ++ int modprobe_performed = 0, write_performed = 0; ++ errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; ++ int len; ++ ++redo: ++ len = read_single_line_file(CLUSTER_STACK_FILE, line, sizeof(line)); ++ ++ if (len > 0) { ++ if (line[len - 1] == '\n') { ++ line[len - 1] = '\0'; ++ len--; ++ } ++ ++ if (len != OCFS2_STACK_LABEL_LEN) { ++ err = O2CB_ET_INTERNAL_FAILURE; ++ goto out; ++ } ++ ++ if (!strncmp(line, stack_name, OCFS2_STACK_LABEL_LEN)) { ++ err = 0; ++ goto out; ++ } ++ ++ if (!write_performed) { ++ write_single_line_file(CLUSTER_STACK_FILE, stack_name, ++ strlen(stack_name)); ++ write_performed = 1; ++ goto redo; ++ } ++ ++ } else if (len == -ENOENT) { ++ if (!modprobe_performed) { ++ perform_modprobe("ocfs2"); ++ if (!strncmp(stack_name, user_stack.s_name, ++ OCFS2_STACK_LABEL_LEN)) ++ perform_modprobe(USER_KERNEL_MODULE); ++ else if (!strncmp(stack_name, classic_stack.s_name, ++ OCFS2_STACK_LABEL_LEN)) ++ perform_modprobe(O2CB_KERNEL_MODULE); ++ ++ write_single_line_file(CLUSTER_STACK_FILE, stack_name, ++ strlen(stack_name)); ++ write_performed = 1; ++ goto redo; ++ } else ++ err = O2CB_ET_INTERNAL_FAILURE; ++ } else { ++ err = O2CB_ET_INTERNAL_FAILURE; ++ goto out; ++ } ++ ++ err = 0; ++out: ++ return err; ++} +diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c +index f2ca5cb..c009d82 100644 +--- a/mount.ocfs2/mount.ocfs2.c ++++ b/mount.ocfs2/mount.ocfs2.c +@@ -357,6 +357,12 @@ int main(int argc, char **argv) + if (verbose) + printf("device=%s\n", mo.dev); + ++ ret = o2cb_setup_stack((char *)OCFS2_RAW_SB(fs->fs_super)->s_cluster_info.ci_stack); ++ if (ret) { ++ com_err(progname, ret, "while setting up stack\n"); ++ goto bail; ++ } ++ + if (clustered) { + ret = o2cb_init(); + if (ret) { +-- +1.8.1.4 + diff --git a/o2cb.ocf b/o2cb.ocf index 33cf172..70f55bb 100644 --- a/o2cb.ocf +++ b/o2cb.ocf @@ -35,11 +35,6 @@ : ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"} o2cb_start() { - /sbin/modprobe ocfs2_stackglue - /sbin/modprobe ocfs2_stack_user - /sbin/modprobe ocfs2 - echo "pcmk" > /sys/fs/ocfs2/cluster_stack - ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!" return $OCF_SUCCESS } diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 92f60e0..8d80837 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,8 +1,9 @@ ------------------------------------------------------------------- -Fri Aug 23 12:44:09 CDT 2013 - rgoldwyn@suse.com +Tue Sep 3 09:14:16 CDT 2013 - rgoldwyn@suse.com -- FIXME: Added temporary hack in o2cb until we find a solution to - remove o2cb activities of setting cluster stack. +- Make mount.ocfs2 load ocfs2 kmp and setup cluster_stack if + not found + + 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch ------------------------------------------------------------------- Thu Aug 22 13:18:01 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index ae5c803..bfc4a48 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -45,10 +45,6 @@ Patch212: bug-805764-ocfs2-controld.patch Patch213: bnc804707-reduce-RR-priority.patch Patch214: use-symlink-in-udev-rules.patch Patch215: ocfs2console-libraries-include-aio.patch -Patch216: 0001-Remove-pacemaker-ais-stuff.patch -Patch217: 0002-Add-corosync-cfg-to-get-configuration-information.patch -Patch218: 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch -Patch219: 0005-Add-cluster_name-and-stack-name.patch Patch220: libocfs2-needs-libaio.patch Patch221: libocfs2-Change-asserts-to-error.patch Patch222: 0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch @@ -57,7 +53,7 @@ Patch224: 0003-Get-cluster-name-from-corosync-cmap.patch Patch225: 0004-Remove-controld-structures-from-debugfs.ocfs2.patch Patch226: 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch Patch227: 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch -Patch228: 0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch +Patch229: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -154,10 +150,6 @@ managing the file system. %patch213 -p1 %patch214 -p1 %patch215 -p1 -#%patch216 -p1 -#%patch217 -p1 -#%patch218 -p1 -#%patch219 -p1 %patch220 -p1 %patch221 -p1 %patch222 -p1 @@ -166,7 +158,7 @@ managing the file system. %patch225 -p1 %patch226 -p1 %patch227 -p1 -#%patch228 -p1 +%patch229 -p1 %build export PROJECT="ocfs2-tools" From a29982a563fb8408b528b7c5eb715346950a25bf Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Thu, 5 Sep 2013 13:39:21 +0000 Subject: [PATCH 09/11] Accepting request 197501 from home:goldwynr:branches:network:ha-clustering:Factory mkfs aborts if cluster information not found OBS-URL: https://build.opensuse.org/request/show/197501 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=67 --- ...-if-cluster-information-is-not-detec.patch | 86 +++++++++++++++++++ ocfs2-tools.changes | 6 ++ ocfs2-tools.spec | 4 +- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch diff --git a/0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch b/0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch new file mode 100644 index 0000000..a68edab --- /dev/null +++ b/0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch @@ -0,0 +1,86 @@ +From 14c5f3788b047024390c1a1ae40a0585417ed0d9 Mon Sep 17 00:00:00 2001 +From: Goldwyn Rodrigues +Date: Wed, 4 Sep 2013 23:56:39 -0500 +Subject: [PATCH 9/9] mkfs.ocfs2: Abort if cluster information is not detected + +--- + mkfs.ocfs2/check.c | 19 +++++++++++++++---- + mkfs.ocfs2/mkfs.h | 2 +- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c +index f05dc72..75f0e7b 100644 +--- a/mkfs.ocfs2/check.c ++++ b/mkfs.ocfs2/check.c +@@ -33,7 +33,7 @@ int is_classic_stack(char *stack_name) + } + + /* For ocfs2_fill_cluster_information(). Errors are to be ignored */ +-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags) ++errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags) + { + errcode_t err; + struct o2cb_cluster_desc cluster; +@@ -44,11 +44,11 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags) + + err = o2cb_init(); + if (err) +- return; ++ goto out; + + err = o2cb_running_cluster_desc(&cluster); + if (err) +- return; ++ goto out; + + if (cluster.c_stack) { + /* +@@ -59,6 +59,8 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags) + *cluster_name = cluster.c_cluster; + *stack_flags = cluster.c_flags; + } ++out: ++ return err; + } + + /* For ocfs2_fill_cluster_information(). Errors are to be ignored */ +@@ -132,6 +134,7 @@ int ocfs2_fill_cluster_information(State *s) + uint8_t user_stack_flags, o2cb_stack_flags, disk_stack_flags; + int clusterinfo = 0, userspace = 0; + int ret = -1; ++ errcode_t err; + + if (s->mount == MOUNT_LOCAL) + return 0; +@@ -139,7 +142,15 @@ int ocfs2_fill_cluster_information(State *s) + *user_value = *o2cb_value = *disk_value = '\0'; + + /* get currently active cluster stack */ +- cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags); ++ err = cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags); ++ if (err && !s->cluster_stack) { ++ com_err(s->progname, 0, "Could not determine cluster " ++ "information.\nEither load the correct kernel module" ++ ", set the cluster_stack and start cluster " ++ "services, or provide --cluster-stack and " ++ "--cluster-name command line arguments.\n"); ++ return -1; ++ } + + /* get cluster stack configured on disk */ + disk_fill(s->device_name, &disk_stack_name, &disk_cluster_name, +diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h +index 13b4fb5..ca2004c 100644 +--- a/mkfs.ocfs2/mkfs.h ++++ b/mkfs.ocfs2/mkfs.h +@@ -243,6 +243,6 @@ struct _State { + }; + + int is_classic_stack(char *stack_name); +-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags); ++errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags); + int ocfs2_fill_cluster_information(State *s); + int ocfs2_check_volume(State *s); +-- +1.8.1.4 + diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 8d80837..3051606 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 5 07:24:42 CDT 2013 - rgoldwyn@suse.com + +- mkfs.ocfs2 aborts if cluster information is not found/supplied + + 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch + ------------------------------------------------------------------- Tue Sep 3 09:14:16 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index bfc4a48..2f66d2c 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -53,7 +53,8 @@ Patch224: 0003-Get-cluster-name-from-corosync-cmap.patch Patch225: 0004-Remove-controld-structures-from-debugfs.ocfs2.patch Patch226: 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch Patch227: 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch -Patch229: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch +Patch228: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch +Patch229: 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -158,6 +159,7 @@ managing the file system. %patch225 -p1 %patch226 -p1 %patch227 -p1 +%patch228 -p1 %patch229 -p1 %build From f52787975b32ebbeb8b8e6c474868fab134e6f3d Mon Sep 17 00:00:00 2001 From: Kristoffer Gronlund Date: Thu, 12 Sep 2013 10:44:02 +0000 Subject: [PATCH 10/11] Accepting request 198636 from home:zhonglidong:branches:network:ha-clustering:Factory patch for bug838705 OBS-URL: https://build.opensuse.org/request/show/198636 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=68 --- bug-838705-change_dlm_lib.patch | 78 +++++++++++++++++++++++++++++++++ ocfs2-tools.changes | 6 +++ ocfs2-tools.spec | 2 + 3 files changed, 86 insertions(+) create mode 100644 bug-838705-change_dlm_lib.patch diff --git a/bug-838705-change_dlm_lib.patch b/bug-838705-change_dlm_lib.patch new file mode 100644 index 0000000..213ce4c --- /dev/null +++ b/bug-838705-change_dlm_lib.patch @@ -0,0 +1,78 @@ +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/fsck.ocfs2/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/fsck.ocfs2/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/fsck.ocfs2/Makefile +@@ -12,7 +12,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -lo + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm_lt + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal + LIBTOOLS_INTERNAL_DEPS = $(TOPDIR)/libtools-internal/libtools-internal.a +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mkfs.ocfs2/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/mkfs.ocfs2/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mkfs.ocfs2/Makefile +@@ -8,7 +8,7 @@ SBIN_PROGRAMS = mkfs.ocfs2 + LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2 + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -lcmap -ldlm_lt + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mount.ocfs2/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/mount.ocfs2/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mount.ocfs2/Makefile +@@ -10,7 +10,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -lo + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm_lt -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + DEFINES = -DVERSION=\"$(VERSION)\" +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mounted.ocfs2/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/mounted.ocfs2/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/mounted.ocfs2/Makefile +@@ -8,7 +8,7 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/liboc + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm_lt -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_hb_ctl/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/ocfs2_hb_ctl/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/ocfs2_hb_ctl/Makefile +@@ -10,7 +10,7 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -lo + LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm_lt -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + ifndef OCFS2_DYNAMIC_CTL +Index: ocfs2-tools-1.8.2+git.1361836695.ff84eb5/tunefs.ocfs2/Makefile +=================================================================== +--- ocfs2-tools-1.8.2+git.1361836695.ff84eb5.orig/tunefs.ocfs2/Makefile ++++ ocfs2-tools-1.8.2+git.1361836695.ff84eb5/tunefs.ocfs2/Makefile +@@ -11,7 +11,7 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/liboc + LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS) + LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a + +-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm -lcmap ++LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb -ldlm_lt -lcmap + LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a + + UNINST_LIBRARIES = libocfs2ne.a diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 3051606..c38a787 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 12 09:30:27 UTC 2013 - lzhong@suse.com + +- mkfs.ocfs2/tunefs.ocfs2 may hang there because of dlm_unlock + +bug-838705-change_dlm_lib.patch + ------------------------------------------------------------------- Thu Sep 5 07:24:42 CDT 2013 - rgoldwyn@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index 2f66d2c..f86a797 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -55,6 +55,7 @@ Patch226: 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch Patch227: 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch Patch228: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch Patch229: 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch +Patch230: bug-838705-change_dlm_lib.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -161,6 +162,7 @@ managing the file system. %patch227 -p1 %patch228 -p1 %patch229 -p1 +%patch230 -p1 %build export PROJECT="ocfs2-tools" From 392a2f99a9ac8a7d45984a898742cf484945e5f9 Mon Sep 17 00:00:00 2001 From: Lars Marowsky-Bree Date: Fri, 13 Sep 2013 08:34:38 +0000 Subject: [PATCH 11/11] - Move static libraries to devel-static subpackage. OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=69 --- ocfs2-tools.changes | 5 +++++ ocfs2-tools.spec | 27 +++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index c38a787..07bb70e 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 13 08:34:08 UTC 2013 - lmb@suse.com + +- Move static libraries to devel-static subpackage. + ------------------------------------------------------------------- Thu Sep 12 09:30:27 UTC 2013 - lzhong@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index f86a797..82ca703 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -85,7 +85,7 @@ Recommends: ocfs2-kmp %endif %description -OCFS is the Oracle Cluster File System. +OCFS2 is the Oracle Cluster File System. This package contains the core user-space tools needed for creating and managing the file system. @@ -103,7 +103,7 @@ Provides: ocfs2-support = %{version} Obsoletes: ocfs2-support < %{version} %description -n ocfs2console -OCFS is the Oracle Cluster Filesystem. +OCFS2 is the Oracle Cluster Filesystem. This package contains additional tools and a GUI (python-gtk). @@ -115,10 +115,23 @@ Requires: libcom_err-devel Requires: ocfs2-tools = %{version} %description devel -OCFS is the Oracle Cluster File System. +OCFS2 is the Oracle Cluster File System. -This package contains the header files and static libraries for -developing low-level OCFS2-aware applications. +This package contains the header files for developing low-level +OCFS2-aware applications. + +%package devel-static +Summary: Oracle Cluster File System 2 static libraries +Group: Development/Libraries/C and C++ +Requires: libcom_err +Requires: libcom_err-devel +Requires: ocfs2-tools = %{version} + +%description devel-static +OCFS2 is the Oracle Cluster File System. + +This package contains the static libraries for developing low-level +OCFS2-aware applications. %package o2cb Summary: Oracle Cluster File System 2 Core Tools @@ -229,7 +242,6 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} /sbin/o2cluster %{_sbindir}/o2image %{_sbindir}/debugfs.ocfs2 -#%{_sbindir}/ocfs2_controld.pcmk %{_sbindir}/o2hbmonitor %{_bindir}/reflink %{_bindir}/o2info @@ -283,6 +295,9 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} %{_libdir}/pkgconfig/o2cb.pc %{_libdir}/pkgconfig/o2dlm.pc %{_libdir}/pkgconfig/ocfs2.pc + +%files devel-static +%defattr(-,root,root) %{_libdir}/libo2cb.a %{_libdir}/libo2dlm.a %{_libdir}/libocfs2.a