forked from pool/ocfs2-tools
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
This commit is contained in:
parent
6f2583e888
commit
3e4aa7393f
@ -1,648 +0,0 @@
|
||||
From 6754fec432e3a2a758af9308fd7447f6e20e4cea Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
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 <openais/saAis.h>])
|
||||
-
|
||||
-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;
|
@ -1,315 +0,0 @@
|
||||
From 1a7b9a35228cd5ef9d6ad96ec35f6fc812ee821c Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
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 <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <syslog.h>
|
||||
+
|
||||
+#include "ocfs2_controld.h"
|
||||
+#include <corosync/corotypes.h>
|
||||
+#include <corosync/cfg.h>
|
||||
+#include <corosync/cmap.h>
|
||||
+
|
||||
+
|
||||
+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);
|
@ -1,188 +0,0 @@
|
||||
From f49e6a0dd32f1b891a9281584a6c2516afe3d200 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <goldwyn@localhost.localdomain>
|
||||
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><space><2-char-hex-minor><null>
|
||||
- *
|
||||
- * 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);
|
||||
|
@ -1,31 +0,0 @@
|
||||
From af06444bea1bcc8006c295a5a2663e0372814df5 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
|
||||
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");
|
@ -1,206 +0,0 @@
|
||||
From 4c80d4b994e99443ae403f22d3e65fd5e2c3edb7 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
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 <string.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
+#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 <o2cb/o2cb_err.h>
|
||||
+errcode_t setup_stack(char *stack_name);
|
||||
--
|
||||
1.8.1.4
|
||||
|
176
0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch
Normal file
176
0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From 5d0bffdbbadd38173a9bfbf4ffb8d455b5f0b990 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
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 <sys/ioctl.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@@ -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
|
||||
|
5
o2cb.ocf
5
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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user