Accepting request 305879 from home:ganghe:branches:network:ha-clustering:Factory
- libo2dlm: Close file description after use + 0001-libo2dlm-Close-file-description-after-use.patch - debugfs.ocfs2: Fix a bug in process_open_args() + 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch - Update ocfs2-tools.tar.bz2 to upstream v1.8.4 - Use new ocfs2-tools git URL https://github.com/markfasheh/ocfs2-tools.git - Drop patches (merged upstream): - 0001-Use-cmap-for-getting-cluster-name.patch - 0002-Remove-controld-dependency-in-group_join-leave.patch - 0003-Auto-setup-cluster_stack-based-on-what-is-on-disk.patch - 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch - 0005-mkfs-Setup-cluster_stack-if-not-setup-based-on-what-.patch - 0006-Auto-setup-pcmk-stack-as-default-if-no-stack-is-setu.patch OBS-URL: https://build.opensuse.org/request/show/305879 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=82
This commit is contained in:
parent
46561a2b65
commit
c57803101a
@ -1,159 +0,0 @@
|
||||
From 6423caf73ef9d0f22acf294e100523bc2af3acc9 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Sat, 21 Dec 2013 18:41:04 -0600
|
||||
Subject: [PATCH] Use cmap for getting cluster name
|
||||
|
||||
---
|
||||
debugfs.ocfs2/Makefile | 2 +-
|
||||
libo2cb/o2cb_abi.c | 79 +++++++++++++++++++++++++++-----------------------
|
||||
o2cb.pc.in | 2 +-
|
||||
o2cb_ctl/Makefile | 2 +-
|
||||
4 files changed, 46 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/debugfs.ocfs2/Makefile b/debugfs.ocfs2/Makefile
|
||||
index ca4c9a4..30dfa5f 100644
|
||||
--- a/debugfs.ocfs2/Makefile
|
||||
+++ b/debugfs.ocfs2/Makefile
|
||||
@@ -32,7 +32,7 @@ HFILES = \
|
||||
OBJS = $(subst .c,.o,$(CFILES))
|
||||
|
||||
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
|
||||
-LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
|
||||
+LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb $(DL_LIBS)
|
||||
|
||||
MANS = debugfs.ocfs2.8
|
||||
|
||||
diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c
|
||||
index ae03595..6c3ad73 100644
|
||||
--- a/libo2cb/o2cb_abi.c
|
||||
+++ b/libo2cb/o2cb_abi.c
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include <corosync/cmap.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -1966,52 +1968,57 @@ static errcode_t classic_list_clusters(char ***clusters)
|
||||
|
||||
static errcode_t user_list_clusters(char ***clusters)
|
||||
{
|
||||
- errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE;
|
||||
- int rc, fd = -1;
|
||||
- char buf[OCFS2_CONTROLD_MAXLINE];
|
||||
+ errcode_t ret = O2CB_ET_SERVICE_UNAVAILABLE;
|
||||
+ void *lib_handle = NULL;
|
||||
+ char **list;
|
||||
+ int rv;
|
||||
|
||||
- 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;
|
||||
+ cmap_handle_t handle;
|
||||
+ static int (*initialize)(cmap_handle_t *handle);
|
||||
+ static int (*get_string)(cmap_handle_t handle,
|
||||
+ const char *string,
|
||||
+ char **name);
|
||||
+ static int (*finalize)(cmap_handle_t handle);
|
||||
|
||||
- default:
|
||||
- err = O2CB_ET_SERVICE_UNAVAILABLE;
|
||||
- break;
|
||||
- }
|
||||
+
|
||||
+ lib_handle = dlopen("libcmap.so.4", RTLD_NOW | RTLD_LOCAL);
|
||||
+ if (!lib_handle)
|
||||
+ return ret;
|
||||
+
|
||||
+ initialize = dlsym(lib_handle, "cmap_initialize");
|
||||
+ if (!initialize)
|
||||
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;
|
||||
+ get_string = dlsym(lib_handle, "cmap_get_string");
|
||||
+ if (!get_string)
|
||||
goto out;
|
||||
- }
|
||||
|
||||
- rc = receive_list(fd, buf, clusters);
|
||||
- if (rc) {
|
||||
- /* fprintf(stderr, "Error reading from daemon: %s\n",
|
||||
- strerror(-rc)); */
|
||||
- err = O2CB_ET_IO;
|
||||
+ finalize = dlsym(lib_handle, "cmap_finalize");
|
||||
+ if (!finalize)
|
||||
goto out;
|
||||
- }
|
||||
|
||||
- err = 0;
|
||||
+ rv = initialize(&handle);
|
||||
+ if (rv != CS_OK)
|
||||
+ goto out;
|
||||
|
||||
-out:
|
||||
- if (fd != -1)
|
||||
- close(fd);
|
||||
+ list = (char **)malloc(sizeof(char *) * 2);
|
||||
+ if (!list)
|
||||
+ goto out;
|
||||
|
||||
- return err;
|
||||
+ rv = get_string(handle, "totem.cluster_name", &list[0]);
|
||||
+ if (rv != CS_OK) {
|
||||
+ free(list);
|
||||
+ ret = O2CB_ET_INTERNAL_FAILURE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ list[1] = NULL;
|
||||
+ *clusters = list;
|
||||
+ finalize(handle);
|
||||
+ ret = 0;
|
||||
+out:
|
||||
+ dlclose(lib_handle);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
errcode_t o2cb_list_clusters(char ***clusters)
|
||||
diff --git a/o2cb.pc.in b/o2cb.pc.in
|
||||
index be94b8a..f13c560 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 -ldl
|
||||
Cflags: -I${includedir}
|
||||
diff --git a/o2cb_ctl/Makefile b/o2cb_ctl/Makefile
|
||||
index 5efcab4..8589748 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 $(DL_LIBS)
|
||||
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
|
||||
|
||||
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
|
||||
--
|
||||
1.8.4
|
||||
|
34
0001-libo2dlm-Close-file-description-after-use.patch
Normal file
34
0001-libo2dlm-Close-file-description-after-use.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 63a8fc605fc8dc1c4e327eb17ba6a5a614928608 Mon Sep 17 00:00:00 2001
|
||||
From: piaojun <piaojun@huawei.com>
|
||||
Date: Thu, 2 Apr 2015 20:46:47 +0800
|
||||
Subject: [PATCH 1/2] libo2dlm: Close file description after use
|
||||
|
||||
In o2dlm_generate_random_value(), randfd should be closed after use.
|
||||
|
||||
Signed-off-by: Jun Piao <piaojun@huawei.com>
|
||||
Reviewed-by: Alex Chen <alex.chen@huawei.com>
|
||||
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
---
|
||||
libo2dlm/o2dlm.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libo2dlm/o2dlm.c b/libo2dlm/o2dlm.c
|
||||
index dbc642b..375f659 100644
|
||||
--- a/libo2dlm/o2dlm.c
|
||||
+++ b/libo2dlm/o2dlm.c
|
||||
@@ -102,9 +102,10 @@ static errcode_t o2dlm_generate_random_value(int64_t *value)
|
||||
if ((randfd = open("/dev/urandom", O_RDONLY)) == -1)
|
||||
return O2DLM_ET_RANDOM;
|
||||
|
||||
- if (read(randfd, value, readlen) != readlen)
|
||||
+ if (read(randfd, value, readlen) != readlen) {
|
||||
+ close(randfd);
|
||||
return O2DLM_ET_RANDOM;
|
||||
-
|
||||
+ }
|
||||
close(randfd);
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.1.2
|
||||
|
@ -1,188 +0,0 @@
|
||||
From c863784d971acd7efddc415d5140b8846799162e Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Fri, 27 Dec 2013 09:20:52 -0600
|
||||
Subject: [PATCH] Remove controld dependency in group_join/leave
|
||||
|
||||
---
|
||||
libo2cb/o2cb_abi.c | 156 +++--------------------------------------------------
|
||||
1 file changed, 7 insertions(+), 149 deletions(-)
|
||||
|
||||
diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c
|
||||
index 40f8176..5eca49d 100644
|
||||
--- a/libo2cb/o2cb_abi.c
|
||||
+++ b/libo2cb/o2cb_abi.c
|
||||
@@ -1373,164 +1373,22 @@ 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)
|
||||
+ 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;
|
||||
+ errcode_t ret = 0;
|
||||
|
||||
-out:
|
||||
- if (err && (control_daemon_fd != -1)) {
|
||||
- close(control_daemon_fd);
|
||||
- control_daemon_fd = -1;
|
||||
- }
|
||||
+ ret = o2cb_validate_cluster_name(cluster);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
- return err;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
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.4
|
||||
|
73
0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch
Normal file
73
0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From 41057a7eef9da9d77cde46d336a7f8a19564d7f8 Mon Sep 17 00:00:00 2001
|
||||
From: piaojun <piaojun@huawei.com>
|
||||
Date: Wed, 6 May 2015 10:25:10 +0800
|
||||
Subject: [PATCH 2/2] debugfs.ocfs2: Fix a bug in process_open_args()
|
||||
|
||||
In process_open_args(), 'dev' get the wrong value because getopt() will
|
||||
change the value of args[1]. This problem will cause failure in
|
||||
debugfs.ocfs2. ocfs2. So we should assign 'dev' before getopt().
|
||||
|
||||
This fix fixes the bug introduced in 9693851641bfcd0f2bab226e9f03d9ab05cb7edf
|
||||
|
||||
Signed-off-by: Jun Piao <piaojun@huawei.com>
|
||||
Reviewed-by: Alex Chen <alex.chen@huawei.com>
|
||||
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Reported-by: Gang He <ghe@suse.com>
|
||||
---
|
||||
debugfs.ocfs2/commands.c | 20 +++++++++++++-------
|
||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
|
||||
index 1b0b2d9..6da396a 100644
|
||||
--- a/debugfs.ocfs2/commands.c
|
||||
+++ b/debugfs.ocfs2/commands.c
|
||||
@@ -534,6 +534,7 @@ static int process_open_args(char **args,
|
||||
int num, argc, c;
|
||||
|
||||
for (argc = 0; (args[argc]); ++argc);
|
||||
+ dev = strdup(args[1]);
|
||||
optind = 0;
|
||||
while ((c = getopt(argc, args, "is:")) != EOF) {
|
||||
switch (c) {
|
||||
@@ -544,26 +545,31 @@ static int process_open_args(char **args,
|
||||
s = strtoul(optarg, &ptr, 0);
|
||||
break;
|
||||
default:
|
||||
- return 1;
|
||||
+ ret = 1;
|
||||
+ goto bail;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- if (!s)
|
||||
- return 0;
|
||||
+ if (!s) {
|
||||
+ ret = 0;
|
||||
+ goto bail;
|
||||
+ }
|
||||
|
||||
num = ocfs2_get_backup_super_offsets(NULL, byte_off,
|
||||
ARRAY_SIZE(byte_off));
|
||||
- if (!num)
|
||||
- return -1;
|
||||
+ if (!num) {
|
||||
+ ret = -1;
|
||||
+ goto bail;
|
||||
+ }
|
||||
|
||||
if (s < 1 || s > num) {
|
||||
fprintf(stderr, "Backup super block is outside of valid range"
|
||||
"(between 1 and %d)\n", num);
|
||||
- return -1;
|
||||
+ ret = -1;
|
||||
+ goto bail;
|
||||
}
|
||||
|
||||
- dev = strdup(args[1]);
|
||||
ret = get_blocksize(dev, byte_off[s-1], &blksize, s);
|
||||
if (ret) {
|
||||
com_err(args[0],ret, "Can't get the blocksize from the device"
|
||||
--
|
||||
2.1.2
|
||||
|
@ -1,174 +0,0 @@
|
||||
From 4b99b5a6042fe9b33079df64ab13817a309de528 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Fri, 27 Dec 2013 09:52:09 -0600
|
||||
Subject: [PATCH] Auto setup cluster_stack based on what is on disk
|
||||
|
||||
This happens only the first time.
|
||||
mount.ocfs2 reads the stack from the filesystems superblock. If the
|
||||
stack is not setup, it will modprobe the modules and write the
|
||||
appropriate stack name to cluster_stack file.
|
||||
If it is already present, it tries to edit/re-write it, if different.
|
||||
If it fails, the mount fails.
|
||||
---
|
||||
include/o2cb/o2cb.h | 1 +
|
||||
libo2cb/o2cb_abi.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
mount.ocfs2/mount.ocfs2.c | 6 +++
|
||||
3 files changed, 111 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 5eca49d..c751abf 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>
|
||||
@@ -145,6 +146,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);
|
||||
@@ -2383,3 +2400,90 @@ 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, OCFS2_PCMK_CLUSTER_STACK,
|
||||
+ OCFS2_STACK_LABEL_LEN)) ||
|
||||
+ (!strncmp(stack_name, OCFS2_CMAN_CLUSTER_STACK,
|
||||
+ 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,
|
||||
+ OCFS2_STACK_LABEL_LEN);
|
||||
+ 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.4
|
||||
|
@ -1,86 +0,0 @@
|
||||
From f7ea242d2bf76c71cfe7fd9555d44c2486610486 Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Fri, 27 Dec 2013 10:01:33 -0600
|
||||
Subject: [PATCH] mkfs.ocfs2: Abort if cluster information is not detected
|
||||
|
||||
---
|
||||
mkfs.ocfs2/check.c | 19 +++++++++++++++----
|
||||
mkfs.ocfs2/mkfs.h | 2 +-
|
||||
2 files changed, 16 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
|
||||
index f05dc72..75f0e7b 100644
|
||||
--- a/mkfs.ocfs2/check.c
|
||||
+++ b/mkfs.ocfs2/check.c
|
||||
@@ -33,7 +33,7 @@ int is_classic_stack(char *stack_name)
|
||||
}
|
||||
|
||||
/* For ocfs2_fill_cluster_information(). Errors are to be ignored */
|
||||
-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
|
||||
+errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
|
||||
{
|
||||
errcode_t err;
|
||||
struct o2cb_cluster_desc cluster;
|
||||
@@ -44,11 +44,11 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
|
||||
|
||||
err = o2cb_init();
|
||||
if (err)
|
||||
- return;
|
||||
+ goto out;
|
||||
|
||||
err = o2cb_running_cluster_desc(&cluster);
|
||||
if (err)
|
||||
- return;
|
||||
+ goto out;
|
||||
|
||||
if (cluster.c_stack) {
|
||||
/*
|
||||
@@ -59,6 +59,8 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
|
||||
*cluster_name = cluster.c_cluster;
|
||||
*stack_flags = cluster.c_flags;
|
||||
}
|
||||
+out:
|
||||
+ return err;
|
||||
}
|
||||
|
||||
/* For ocfs2_fill_cluster_information(). Errors are to be ignored */
|
||||
@@ -132,6 +134,7 @@ int ocfs2_fill_cluster_information(State *s)
|
||||
uint8_t user_stack_flags, o2cb_stack_flags, disk_stack_flags;
|
||||
int clusterinfo = 0, userspace = 0;
|
||||
int ret = -1;
|
||||
+ errcode_t err;
|
||||
|
||||
if (s->mount == MOUNT_LOCAL)
|
||||
return 0;
|
||||
@@ -139,7 +142,15 @@ int ocfs2_fill_cluster_information(State *s)
|
||||
*user_value = *o2cb_value = *disk_value = '\0';
|
||||
|
||||
/* get currently active cluster stack */
|
||||
- cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags);
|
||||
+ err = cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags);
|
||||
+ if (err && !s->cluster_stack) {
|
||||
+ com_err(s->progname, 0, "Could not determine cluster "
|
||||
+ "information.\nEither load the correct kernel module"
|
||||
+ ", set the cluster_stack and start cluster "
|
||||
+ "services, or provide --cluster-stack and "
|
||||
+ "--cluster-name command line arguments.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
/* get cluster stack configured on disk */
|
||||
disk_fill(s->device_name, &disk_stack_name, &disk_cluster_name,
|
||||
diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h
|
||||
index 13b4fb5..ca2004c 100644
|
||||
--- a/mkfs.ocfs2/mkfs.h
|
||||
+++ b/mkfs.ocfs2/mkfs.h
|
||||
@@ -243,6 +243,6 @@ struct _State {
|
||||
};
|
||||
|
||||
int is_classic_stack(char *stack_name);
|
||||
-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags);
|
||||
+errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags);
|
||||
int ocfs2_fill_cluster_information(State *s);
|
||||
int ocfs2_check_volume(State *s);
|
||||
--
|
||||
1.8.4
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 8d9ac69db21d36c6e05a58a38da1091bbb70956d Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Fri, 27 Dec 2013 10:05:23 -0600
|
||||
Subject: [PATCH] mkfs: Setup cluster_stack if not setup based on what is set
|
||||
|
||||
---
|
||||
mkfs.ocfs2/check.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
|
||||
index 75f0e7b..865dcc3 100644
|
||||
--- a/mkfs.ocfs2/check.c
|
||||
+++ b/mkfs.ocfs2/check.c
|
||||
@@ -350,6 +350,15 @@ int ocfs2_check_volume(State *s)
|
||||
goto nolock;
|
||||
|
||||
if (!s->force) {
|
||||
+ if (s->cluster_stack) {
|
||||
+ ret = o2cb_setup_stack(s->cluster_stack);
|
||||
+ if (ret) {
|
||||
+ com_err(s->progname, ret,
|
||||
+ "while setting up stack\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ret = o2cb_init();
|
||||
if (ret) {
|
||||
com_err(s->progname, ret,
|
||||
--
|
||||
1.8.4
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 1e041fdfb09bfc39aa37bea7d491bcf56794fa1c Mon Sep 17 00:00:00 2001
|
||||
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
||||
Date: Tue, 11 Feb 2014 10:54:23 -0600
|
||||
Subject: [PATCH] Auto setup pcmk stack as default if no stack is setup
|
||||
|
||||
Note: This changes the default behavior from classic stack to pcmk
|
||||
---
|
||||
libo2cb/o2cb_abi.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c
|
||||
index 5e0c4fb..26ea03e 100644
|
||||
--- a/libo2cb/o2cb_abi.c
|
||||
+++ b/libo2cb/o2cb_abi.c
|
||||
@@ -172,7 +172,9 @@ static errcode_t determine_stack(void)
|
||||
ssize_t len;
|
||||
char line[100];
|
||||
errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE;
|
||||
+ int setup_performed = 0;
|
||||
|
||||
+redo:
|
||||
len = read_stack_file(line, sizeof(line));
|
||||
if (len > 0) {
|
||||
if (line[len - 1] == '\n') {
|
||||
@@ -192,8 +194,11 @@ static errcode_t determine_stack(void)
|
||||
err = 0;
|
||||
}
|
||||
} else if (len == -ENOENT) {
|
||||
- current_stack = &classic_stack;
|
||||
- err = 0;
|
||||
+ if (!setup_performed) {
|
||||
+ o2cb_setup_stack(OCFS2_PCMK_CLUSTER_STACK);
|
||||
+ setup_performed = 1;
|
||||
+ goto redo;
|
||||
+ }
|
||||
}
|
||||
|
||||
return err;
|
||||
--
|
||||
1.8.4
|
||||
|
4
_service
4
_service
@ -1,9 +1,9 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="disabled">
|
||||
<param name="url">git://oss.oracle.com/git/ocfs2-tools.git</param>
|
||||
<param name="url">https://github.com/markfasheh/ocfs2-tools.git</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="exclude">.git</param>
|
||||
<param name="versionformat">1.8.3+git.%ct.%h</param>
|
||||
<param name="versionformat">1.8.4</param>
|
||||
<param name="revision">master</param>
|
||||
</service>
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0da129916f2be1f4a2950c127d8c31ec57f2c8635b4d5de7c386125b0a5b88b0
|
||||
size 1507995
|
3
ocfs2-tools-1.8.4.tar.gz
Normal file
3
ocfs2-tools-1.8.4.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6a55b7c49b833562ddb4958e9bfaa7fbf28a955a8f9e6e19a8334cb82c18a9d0
|
||||
size 1479049
|
@ -1,3 +1,24 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri May 8 13:12:57 UTC 2015 - ghe@suse.com
|
||||
|
||||
- libo2dlm: Close file description after use
|
||||
+ 0001-libo2dlm-Close-file-description-after-use.patch
|
||||
- debugfs.ocfs2: Fix a bug in process_open_args()
|
||||
+ 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 7 12:26:30 UTC 2015 - ghe@suse.com
|
||||
|
||||
- Update ocfs2-tools.tar.bz2 to upstream v1.8.4
|
||||
- Use new ocfs2-tools git URL https://github.com/markfasheh/ocfs2-tools.git
|
||||
- Drop patches (merged upstream):
|
||||
- 0001-Use-cmap-for-getting-cluster-name.patch
|
||||
- 0002-Remove-controld-dependency-in-group_join-leave.patch
|
||||
- 0003-Auto-setup-cluster_stack-based-on-what-is-on-disk.patch
|
||||
- 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
|
||||
- 0005-mkfs-Setup-cluster_stack-if-not-setup-based-on-what-.patch
|
||||
- 0006-Auto-setup-pcmk-stack-as-default-if-no-stack-is-setu.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 9 03:26:29 UTC 2015 - ghe@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ocfs2-tools
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,12 +17,12 @@
|
||||
|
||||
|
||||
Name: ocfs2-tools
|
||||
Version: 1.8.3+git.1418704844.65fac00
|
||||
Version: 1.8.4
|
||||
Release: 0
|
||||
Summary: Oracle Cluster File System 2 Core Tools
|
||||
License: GPL-2.0+
|
||||
Group: System/Filesystems
|
||||
Url: http://oss.oracle.com/projects/ocfs2-tools/
|
||||
Url: https://ocfs2.wiki.kernel.org/
|
||||
Source: ocfs2-tools-%{version}.tar.gz
|
||||
Source1: o2cb.ocf
|
||||
Source2: reflink.tar.bz2
|
||||
@ -35,12 +35,8 @@ Patch202: fix-configure-check-libs.patch
|
||||
Patch204: dont-use-var-lock-subsys.patch
|
||||
Patch205: ocfs2-tools-kernel33.patch
|
||||
Patch206: ocfs2-tools-resource.patch
|
||||
Patch222: 0001-Use-cmap-for-getting-cluster-name.patch
|
||||
Patch223: 0002-Remove-controld-dependency-in-group_join-leave.patch
|
||||
Patch224: 0003-Auto-setup-cluster_stack-based-on-what-is-on-disk.patch
|
||||
Patch225: 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
|
||||
Patch226: 0005-mkfs-Setup-cluster_stack-if-not-setup-based-on-what-.patch
|
||||
Patch227: 0006-Auto-setup-pcmk-stack-as-default-if-no-stack-is-setu.patch
|
||||
Patch301: 0001-libo2dlm-Close-file-description-after-use.patch
|
||||
Patch302: 0002-debugfs.ocfs2-Fix-a-bug-in-process_open_args.patch
|
||||
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: e2fsprogs-devel
|
||||
@ -139,12 +135,8 @@ OCFS2 filesystem.
|
||||
%patch204 -p1
|
||||
%patch205 -p1
|
||||
%patch206 -p1
|
||||
%patch222 -p1
|
||||
%patch223 -p1
|
||||
%patch224 -p1
|
||||
%patch225 -p1
|
||||
%patch226 -p1
|
||||
%patch227 -p1
|
||||
%patch301 -p1
|
||||
%patch302 -p1
|
||||
|
||||
%build
|
||||
export PROJECT="ocfs2-tools"
|
||||
|
Loading…
Reference in New Issue
Block a user