From 7cec29fa9054d61e5ad982ec44119ed0cc201793 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues Date: Thu, 8 Aug 2013 11:56:48 +0000 Subject: [PATCH] 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