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
This commit is contained in:
parent
8031d741d2
commit
ab40e465fc
181
0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch
Normal file
181
0001-libo2cb-Remove-controld-actions-from-group-join-leav.patch
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
From 2d1b78517ff14633f4b1cf4adddf6308721f9722 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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
|
||||||
|
|
450
0002-libo2cb-Remove-rest-of-controld-functions.patch
Normal file
450
0002-libo2cb-Remove-rest-of-controld-functions.patch
Normal file
@ -0,0 +1,450 @@
|
|||||||
|
From 40b1211091b62a4884d1625fc04d476a07489ca3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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)
|
||||||
|
{
|
62
0003-Get-cluster-name-from-corosync-cmap.patch
Normal file
62
0003-Get-cluster-name-from-corosync-cmap.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From 3f2b73105c5e09e17744ec249eed93c60124bd2d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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 <ctype.h>
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
+#include <corosync/cmap.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
64
0004-Remove-controld-structures-from-debugfs.ocfs2.patch
Normal file
64
0004-Remove-controld-structures-from-debugfs.ocfs2.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From 394a3e7d2758331ba8aa6fc38957611d2447a73d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 8563d603b7af2a32ef1e19337eaeb9d7cace730c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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 <linux/types.h>
|
||||||
|
#include <corosync/cmap.h>
|
||||||
|
+#include <libdlm.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
121
0006-Add-cmap-and-dlm-libraries-in-the-tools.patch
Normal file
121
0006-Add-cmap-and-dlm-libraries-in-the-tools.patch
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
From 4adc4d242f3f69808e7e2bed71337ff7e7966846 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||||
|
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
|
||||||
|
|
206
0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch
Normal file
206
0007-mount.ocfs2-performs-module-loading-cluster_stack-se.patch
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
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
|
||||||
|
|
23
libocfs2-Change-asserts-to-error.patch
Normal file
23
libocfs2-Change-asserts-to-error.patch
Normal file
@ -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)
|
385
o2cb.ocf
385
o2cb.ocf
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright (c) 2008 Andrew Beekhof
|
# Copyright (c) 2008 Andrew Beekhof
|
||||||
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -33,346 +34,18 @@
|
|||||||
: ${OCF_RESKEY_configfs:="/sys/kernel/config"}
|
: ${OCF_RESKEY_configfs:="/sys/kernel/config"}
|
||||||
: ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"}
|
: ${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_start() {
|
||||||
|
ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!"
|
||||||
o2cb_monitor; rc=$?
|
return $OCF_SUCCESS
|
||||||
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 $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
o2cb_stop() {
|
o2cb_stop() {
|
||||||
o2cb_monitor; rc=$?
|
ocf_log info "o2cb is now obsolete. Please remove the o2cb resource agent in your next maintenance window!"
|
||||||
case $rc in
|
return $OCF_SUCCESS
|
||||||
$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 $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
o2cb_usage() {
|
o2cb_usage() {
|
||||||
echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
|
echo "usage: $0 {start|stop|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
|
|
||||||
|
|
||||||
return $OCF_SUCCESS
|
return $OCF_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,51 +55,13 @@ meta_data() {
|
|||||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||||
<resource-agent name="o2cb">
|
<resource-agent name="o2cb">
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<shortdesc lang="en">o2cb resource agent</shortdesc>
|
<shortdesc lang="en">OBSOLETE o2cb resource agent OBSOLETE</shortdesc>
|
||||||
<longdesc lang="en">
|
<longdesc lang="en">
|
||||||
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!
|
||||||
</longdesc>
|
</longdesc>
|
||||||
<parameters>
|
<parameters>
|
||||||
|
|
||||||
<parameter name="sysfs" unique="0">
|
|
||||||
<longdesc lang="en">
|
|
||||||
Location where sysfs is mounted
|
|
||||||
</longdesc>
|
|
||||||
<shortdesc lang="en">Sysfs location</shortdesc>
|
|
||||||
<content type="string" default="/sys/fs"/>
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter name="configfs" unique="0">
|
|
||||||
<longdesc lang="en">
|
|
||||||
Location where configfs is mounted
|
|
||||||
</longdesc>
|
|
||||||
<shortdesc lang="en">Configfs location</shortdesc>
|
|
||||||
<content type="string" default="/sys/kernel/config"/>
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter name="stack" unique="0">
|
|
||||||
<longdesc lang="en">
|
|
||||||
Which userspace stack to use. Known values: pcmk, cman
|
|
||||||
</longdesc>
|
|
||||||
<shortdesc lang="en">Userspace stack</shortdesc>
|
|
||||||
<content type="string" default="pcmk"/>
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
<parameter name="daemon_timeout" unique="0">
|
|
||||||
<longdesc lang="en">
|
|
||||||
Number of seconds to allow the control daemon to come up
|
|
||||||
</longdesc>
|
|
||||||
<shortdesc lang="en">Daemon Timeout</shortdesc>
|
|
||||||
<content type="string" default="10"/>
|
|
||||||
</parameter>
|
|
||||||
|
|
||||||
</parameters>
|
</parameters>
|
||||||
<actions>
|
<actions>
|
||||||
<action name="start" timeout="90" />
|
|
||||||
<action name="stop" timeout="100" />
|
|
||||||
<action name="monitor" timeout="20" depth="0"/>
|
|
||||||
<action name="meta-data" timeout="5" />
|
|
||||||
<action name="validate-all" timeout="30" />
|
|
||||||
</actions>
|
</actions>
|
||||||
</resource-agent>
|
</resource-agent>
|
||||||
END
|
END
|
||||||
@ -440,10 +75,6 @@ start) o2cb_start
|
|||||||
;;
|
;;
|
||||||
stop) o2cb_stop
|
stop) o2cb_stop
|
||||||
;;
|
;;
|
||||||
monitor) o2cb_monitor
|
|
||||||
;;
|
|
||||||
validate-all) o2cb_validate
|
|
||||||
;;
|
|
||||||
usage|help) o2cb_usage
|
usage|help) o2cb_usage
|
||||||
exit $OCF_SUCCESS
|
exit $OCF_SUCCESS
|
||||||
;;
|
;;
|
||||||
|
@ -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
|
Fri Aug 9 13:55:01 CDT 2013 - rgoldwyn@suse.com
|
||||||
|
|
||||||
|
@ -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
|
Patch218: 0003-Remove-daemon-protocol-versions-and-consolidate-fs-v.patch
|
||||||
Patch219: 0005-Add-cluster_name-and-stack-name.patch
|
Patch219: 0005-Add-cluster_name-and-stack-name.patch
|
||||||
Patch220: libocfs2-needs-libaio.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: autoconf
|
||||||
BuildRequires: e2fsprogs-devel
|
BuildRequires: e2fsprogs-devel
|
||||||
@ -146,11 +154,19 @@ managing the file system.
|
|||||||
%patch213 -p1
|
%patch213 -p1
|
||||||
%patch214 -p1
|
%patch214 -p1
|
||||||
%patch215 -p1
|
%patch215 -p1
|
||||||
%patch216 -p1
|
#%patch216 -p1
|
||||||
%patch217 -p1
|
#%patch217 -p1
|
||||||
%patch218 -p1
|
#%patch218 -p1
|
||||||
%patch219 -p1
|
#%patch219 -p1
|
||||||
%patch220 -p1
|
%patch220 -p1
|
||||||
|
%patch221 -p1
|
||||||
|
%patch222 -p1
|
||||||
|
%patch223 -p1
|
||||||
|
%patch224 -p1
|
||||||
|
%patch225 -p1
|
||||||
|
%patch226 -p1
|
||||||
|
%patch227 -p1
|
||||||
|
%patch228 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export PROJECT="ocfs2-tools"
|
export PROJECT="ocfs2-tools"
|
||||||
@ -187,7 +203,7 @@ cd ..
|
|||||||
|
|
||||||
mv %{buildroot}/{,/usr}/sbin/o2image
|
mv %{buildroot}/{,/usr}/sbin/o2image
|
||||||
mv %{buildroot}/{,/usr}/sbin/debugfs.ocfs2
|
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}/libo2cb.a
|
||||||
chmod a-x %{buildroot}/%{_libdir}/libo2dlm.a
|
chmod a-x %{buildroot}/%{_libdir}/libo2dlm.a
|
||||||
chmod a-x %{buildroot}/%{_libdir}/libocfs2.a
|
chmod a-x %{buildroot}/%{_libdir}/libocfs2.a
|
||||||
@ -217,7 +233,7 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir}
|
|||||||
/sbin/o2cluster
|
/sbin/o2cluster
|
||||||
%{_sbindir}/o2image
|
%{_sbindir}/o2image
|
||||||
%{_sbindir}/debugfs.ocfs2
|
%{_sbindir}/debugfs.ocfs2
|
||||||
%{_sbindir}/ocfs2_controld.pcmk
|
#%{_sbindir}/ocfs2_controld.pcmk
|
||||||
%{_sbindir}/o2hbmonitor
|
%{_sbindir}/o2hbmonitor
|
||||||
%{_bindir}/reflink
|
%{_bindir}/reflink
|
||||||
%{_bindir}/o2info
|
%{_bindir}/o2info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user