osc copypac from project:openSUSE:Factory package:ocfs2-tools revision:80

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=143
This commit is contained in:
Gang He 2021-11-04 07:12:44 +00:00 committed by Git OBS Bridge
parent 1f10766da4
commit 26c5ae23aa
19 changed files with 2134 additions and 0 deletions

View File

@ -0,0 +1,86 @@
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

View File

@ -0,0 +1,28 @@
From 15891da74943b0f878b486741ff67507b9bd6177 Mon Sep 17 00:00:00 2001
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
Date: Fri, 23 May 2014 11:41:24 -0500
Subject: [PATCH 7/7] Improve error message if DLM service is unavailable
o2dlm_initialize_fsdlm to return O2DLM_ET_SERVICE_UNAVAILABLE if
DLM service is not running (ENOTCONN).
---
libo2dlm/o2dlm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libo2dlm/o2dlm.c b/libo2dlm/o2dlm.c
index dbc642b..c0fbb21 100644
--- a/libo2dlm/o2dlm.c
+++ b/libo2dlm/o2dlm.c
@@ -1035,6 +1035,9 @@ static errcode_t o2dlm_initialize_fsdlm(const char *domain_name,
case EPERM:
ret = O2DLM_ET_BAD_DOMAIN_DIR;
break;
+ case ENOTCONN:
+ ret = O2DLM_ET_SERVICE_UNAVAILABLE;
+ break;
default:
ret = O2DLM_ET_INTERNAL_FAILURE;
break;
--
1.8.4.5

View File

@ -0,0 +1,165 @@
From c89760fc41f466a7a2be99ed2f648875c2d64e7a Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Thu, 23 Jul 2015 17:13:39 +0800
Subject: [PATCH 2/3] vendor: Add vendor files for sles12
Add vendor files for sles12, and enable systemd support for o2cb
based on the patch named "add systemd support" from "Junxiao Bi"
<junxiao.bi@oracle.com>.
Signed-off-by: Eric Ren <zren@suse.com>
---
vendor/Makefile | 2 +-
vendor/sles12/Makefile | 10 +++++++
vendor/sles12/Vendor.make | 11 +++++++
vendor/sles12/rpmarch.guess | 70 +++++++++++++++++++++++++++++++++++++++++++++
vendor/sles12/vendor.guess | 13 +++++++++
5 files changed, 105 insertions(+), 1 deletion(-)
create mode 100644 vendor/sles12/Makefile
create mode 100644 vendor/sles12/Vendor.make
create mode 100755 vendor/sles12/rpmarch.guess
create mode 100755 vendor/sles12/vendor.guess
diff --git a/vendor/Makefile b/vendor/Makefile
index 58ac84d..022d030 100644
--- a/vendor/Makefile
+++ b/vendor/Makefile
@@ -2,6 +2,6 @@ TOPDIR = ..
include $(TOPDIR)/Preamble.make
-SUBDIRS = common rhel7 rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9
+SUBDIRS = common sles12 rhel7 rhel6 rhel5 sles10 rhel4 sles9 fc7 fc8 fc9
include $(TOPDIR)/Postamble.make
diff --git a/vendor/sles12/Makefile b/vendor/sles12/Makefile
new file mode 100644
index 0000000..89c16a7
--- /dev/null
+++ b/vendor/sles12/Makefile
@@ -0,0 +1,10 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+DIST_FILES = \
+ rpmarch.guess \
+ Vendor.make \
+ vendor.guess
+
+include $(TOPDIR)/Postamble.make
diff --git a/vendor/sles12/Vendor.make b/vendor/sles12/Vendor.make
new file mode 100644
index 0000000..b186054
--- /dev/null
+++ b/vendor/sles12/Vendor.make
@@ -0,0 +1,11 @@
+#
+# SLES 12
+#
+
+TOOLSARCH = $(shell $(TOPDIR)/vendor/sles12/rpmarch.guess tools $(TOPDIR))
+VENDOR_EXTENSION = SLE12
+SYSTEMD_ENABLED = 1
+
+include $(TOPDIR)/vendor/common/Vendor.make
+
+packages: rpm
diff --git a/vendor/sles12/rpmarch.guess b/vendor/sles12/rpmarch.guess
new file mode 100755
index 0000000..3514627
--- /dev/null
+++ b/vendor/sles12/rpmarch.guess
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+mode="$1"
+srcdir="$2"
+
+host_cpu=
+
+QUERYFILE=/etc/SuSE-release
+
+if test -n "$QUERYFILE"; then
+ host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`"
+fi
+
+if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then
+ host_alias=`$srcdir/config.guess`
+ host=`$srcdir/config.sub $host_alias`
+ host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+fi
+
+case "$host_cpu" in
+ x86_64|ia64|s390x)
+ TOOLSARCH="$host_cpu"
+ ;;
+ i386|i486|i586|i686|i786|k6|k7)
+ TOOLSARCH="i386"
+ ;;
+ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+ TOOLSARCH="ppc"
+ ;;
+ *)
+ echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
+ TOOLSARCH=""
+ ;;
+esac
+
+# Only a few of these need to be overwritten from RPM's default
+case "$host_cpu" in
+ i586)
+ MODULEARCH="$host_cpu"
+ ;;
+ i386|i686)
+ MODULEARCH="i586"
+ ;;
+ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+ MODULEARCH="ppc64"
+ ;;
+ *)
+ MODULEARCH=""
+ ;;
+esac
+
+case "$mode" in
+ module)
+ if [ -n "$MODULEARCH" ] ; then
+ echo "--target $MODULEARCH"
+ fi
+ ;;
+ tools)
+ if [ -n "$TOOLSARCH" ] ; then
+ echo "--target $TOOLSARCH"
+ fi
+ ;;
+ *)
+ echo "rpmarch.guess: Invalid mode: $mode" >&2
+ echo "error"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vendor/sles12/vendor.guess b/vendor/sles12/vendor.guess
new file mode 100755
index 0000000..83ce085
--- /dev/null
+++ b/vendor/sles12/vendor.guess
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ ! -f /etc/SuSE-release ]
+then
+ exit 1
+fi
+
+if [ "`rpm -qf /etc/SuSE-release --qf '%{VERSION}' 2>/dev/null`" != "12" ]
+then
+ exit 1
+fi
+
+exit 0
--
2.1.4

View File

@ -0,0 +1,30 @@
From dc357b652edb7e8e2970fd6f4549c433710093b8 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Tue, 8 Sep 2015 10:27:51 +0800
Subject: [PATCH 3/3] ocfs2-tools: add systemd support fix
The ocfs2.service should be after remote-fs.target so that iscsi
volume would be available at first.
Signed-off-by: Eric Ren <zren at suse.com>
Reviewed-by: Junxiao Bi <junxiao.bi at oracle.com>
---
vendor/common/ocfs2.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vendor/common/ocfs2.service b/vendor/common/ocfs2.service
index 768f806..c7ecbea 100644
--- a/vendor/common/ocfs2.service
+++ b/vendor/common/ocfs2.service
@@ -2,7 +2,7 @@
Description=Mount ocfs2 Filesystems
Documentation=man:ocfs2(7) man:mount.ocfs2(8)
Requires=o2cb.service
-After=o2cb.service
+After=o2cb.service remote-fs.target
[Service]
Type=oneshot
--
2.1.4

18
_service Normal file
View File

@ -0,0 +1,18 @@
<services>
<service name="tar_scm" mode="disabled">
<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.7</param>
<param name="revision">master</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">ocfs2*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">ocfs2</param>
</service>
</services>

View File

@ -0,0 +1,13 @@
Index: ocfs2-tools-1.8.5/libo2cb/o2cb_abi.c
===================================================================
--- a/libo2cb/o2cb_abi.c
+++ b/libo2cb/o2cb_abi.c
@@ -201,7 +201,7 @@ redo:
}
} else if (len == -ENOENT) {
if (!setup_performed) {
- o2cb_setup_stack(OCFS2_CLASSIC_CLUSTER_STACK);
+ o2cb_setup_stack(OCFS2_PCMK_CLUSTER_STACK);
setup_performed = 1;
goto redo;
} else {

View File

@ -0,0 +1,39 @@
Index: ocfs2-tools/libo2cb/o2cb_err.et
===================================================================
--- ocfs2-tools.orig/libo2cb/o2cb_err.et 2012-08-24 10:22:54.000000000 -0500
+++ ocfs2-tools/libo2cb/o2cb_err.et 2012-08-24 10:23:03.000000000 -0500
@@ -33,6 +33,12 @@ ec O2CB_ET_IO,
ec O2CB_ET_SERVICE_UNAVAILABLE,
"Unable to access cluster service"
+ec O2CB_ET_SERVICE_HANDSHAKE_UNAVAILABLE,
+ "Unable to access cluster serivce due to bad handshake"
+
+ec O2CB_ET_SERVICE_DEV_UNAVAILABLE,
+ "Unable to access cluster service device"
+
ec O2CB_ET_INTERNAL_FAILURE,
"Internal logic failure"
Index: ocfs2-tools/libo2cb/o2cb_abi.c
===================================================================
--- ocfs2-tools.orig/libo2cb/o2cb_abi.c 2012-08-24 10:22:54.000000000 -0500
+++ ocfs2-tools/libo2cb/o2cb_abi.c 2012-08-24 10:23:03.000000000 -0500
@@ -2367,7 +2367,7 @@ static errcode_t o2cb_control_handshake(
if (ret != 0)
err = O2CB_ET_IO;
else if (!found)
- err = O2CB_ET_SERVICE_UNAVAILABLE; /* no match */
+ err = O2CB_ET_SERVICE_HANDSHAKE_UNAVAILABLE; /* no match */
break;
}
@@ -2424,7 +2424,7 @@ errcode_t o2cb_control_open(unsigned int
case ENOTDIR:
case ENOENT:
case EISDIR:
- err = O2CB_ET_SERVICE_UNAVAILABLE;
+ err = O2CB_ET_SERVICE_DEV_UNAVAILABLE;
break;
case EACCES:

104
debug-ocfs2_hb_ctl.patch Normal file
View File

@ -0,0 +1,104 @@
Index: ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
===================================================================
--- ocfs2-tools.orig/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <sys/stat.h>
#include <signal.h>
+#include <syslog.h>
#include "ocfs2/ocfs2.h"
@@ -137,6 +138,7 @@ static errcode_t get_desc(const char *de
if (!region_desc->r_name || !region_desc->r_device_name)
err = OCFS2_ET_NO_MEMORY;
} else {
+ syslog(LOG_INFO, "filled heartbeat desc, err: %d\n", (int)err);
region_desc->r_name = NULL;
region_desc->r_device_name = NULL;
goto out_close;
@@ -157,6 +159,7 @@ static errcode_t get_desc(const char *de
err = OCFS2_ET_NO_MEMORY;
}
} else {
+ syslog(LOG_INFO, "filled cluster desc, err: %d\n", (int)err);
cluster_desc->c_stack = NULL;
cluster_desc->c_cluster = NULL;
}
@@ -202,9 +205,9 @@ static errcode_t compare_dev(const char
/* Any problem with getting the descriptor is NOT FOUND */
err = OCFS2_ET_FILE_NOT_FOUND;
- if (get_desc(device))
+ if (get_desc(device)) {
goto out;
-
+ }
if (!strcmp(region_desc->r_name, hbo->uuid_str)) {
hbo->dev_str = device;
err = 0;
@@ -381,12 +384,19 @@ static errcode_t stop_heartbeat(struct h
{
errcode_t err = 0;
- if (!hbo->dev_str)
+ if (!hbo->dev_str) {
err = lookup_dev(hbo);
+ if (err)
+ syslog(LOG_INFO, "looked up device, ret: %d\n",
+ (int)err);
+ }
if (!err) {
region_desc->r_persist = 1; /* hb_ctl is for reals */
region_desc->r_service = hbo->service;
err = o2cb_group_leave(cluster_desc, region_desc);
+ if (err)
+ syslog(LOG_INFO, "left group - err: %d\n",
+ (int)err);
}
return err;
@@ -536,14 +546,42 @@ static void print_usage(int err)
fprintf(output, " %s -h\n", progname);
}
+static int
+hack_enable_coredumps(void)
+{
+ struct rlimit rlim;
+
+ if (getrlimit(RLIMIT_CORE, &rlim) < 0) {
+ return -1;
+ }
+
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit(RLIMIT_CORE, &rlim);
+ (void)chdir("/var/lib/openais");
+ return 0;
+}
+
+
int main(int argc, char **argv)
{
errcode_t err = 0;
int ret = 0;
+ int i;
struct hb_ctl_options hbo = {
.action = HB_ACTION_UNKNOWN,
};
char *hbuuid = NULL;
+ char tmp[1024];
+
+ openlog("ocfs2_hb_ctl", LOG_CONS|LOG_NDELAY|LOG_PID, LOG_KERN);
+ sprintf(tmp, "ocfs2_hb_ctl");
+ for (i = 0; i < argc; i++) {
+ strncat(tmp, " ", sizeof(tmp)-1);
+ strncat(tmp, argv[i], sizeof(tmp)-1);
+ }
+ syslog(LOG_INFO, "%s\n", tmp);
+
+ hack_enable_coredumps();
setbuf(stdout, NULL);
setbuf(stderr, NULL);

View File

@ -0,0 +1,24 @@
Index: ocfs2-tools/vendor/common/ocfs2.init
===================================================================
--- ocfs2-tools.orig/vendor/common/ocfs2.init
+++ ocfs2-tools/vendor/common/ocfs2.init
@@ -107,9 +107,6 @@ FUSER=`which fuser`
case "$1" in
start|reload)
- if [ -d /var/lock/subsys ] ; then
- touch /var/lock/subsys/ocfs2
- fi
if [ -n "`ocfs2fstab`" ] ; then
echo -n "Starting Oracle Cluster File System (OCFS2) "
mount -at ocfs2
@@ -143,9 +140,6 @@ case "$1" in
retry=$(($retry - 1))
sig=-9
done
- if [ -z "$remaining" ] && [ -e /var/lock/subsys/ocfs2 ] ; then
- rm /var/lock/subsys/ocfs2
- fi
[ -z "$remaining" ] && success_status
;;
restart|force-reload)

View File

@ -0,0 +1,32 @@
Index: ocfs2-tools/configure.in
===================================================================
--- ocfs2-tools.orig/configure.in 2012-08-24 10:22:47.000000000 -0500
+++ ocfs2-tools/configure.in 2012-08-24 10:23:24.000000000 -0500
@@ -276,9 +276,12 @@ if test "x$cpg_found" = "xyes"; then
# TRY="$TRY"
saved_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $TRY -lcpg"
+ saved_LIBS="$LIBS"
+ LDFLAGS="$LDFLAGS $TRY"
+ LIBS="-lcpg"
AC_LINK_IFELSE([AC_LANG_CALL([], [cpg_initialize])],
cpg_found=yes)
+ LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
if test "x$cpg_found" = "xyes"; then
@@ -320,9 +323,12 @@ if test "x$ckpt_found" = "xyes"; then
# TRY="$TRY"
saved_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $TRY -lSaCkpt"
+ saved_LIBS="$LIBS"
+ LDFLAGS="$LDFLAGS $TRY"
+ LIBS="-lSaCkpt"
AC_LINK_IFELSE([AC_LANG_CALL([], [saCkptInitialize])],
ckpt_found=yes)
+ LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
if test "x$ckpt_found" = "xyes"; then

View File

@ -0,0 +1,45 @@
From 34888925e54a210cb0e7989eef57ea8041fbc9e8 Mon Sep 17 00:00:00 2001
From: Kastixx <b.m.kast@gmail.com>
Date: Tue, 19 Oct 2021 01:32:14 +0300
Subject: [PATCH 1/2] Fixed `mounted.ocfs2` output when some devices are Not
Ready
When `mounted.ocfs2 -d` (quick scan) encounters a device in Not Ready state, it tries to read the device, fails, and in theory should skip it and proceed to the next one. However, due to an integer comparison with mixed signedness it does not break out of a read loop when `do_pread` returns an error code (-1), and fills the structure for current file system with the data that is left in the buffer from the previous file system.
In such conditions, the command produces the following output:
```
# these two devices are working
/dev/mapper/360000970000197600444533037353334_part1 pcmk hacluster B9223C9922754CE88236EDDE6B281D15 ALPHA
/dev/mapper/360000970000197600444533037353335_part1 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
# these two are not ready
/dev/mapper/360000970000197600444533037423031 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
/dev/mapper/360000970000197600444533037423032 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
# this one is OK
/dev/mapper/360000970000197600444533037423030_part1 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
# these two are not ready again
/dev/mapper/360000970000197600444533037423033 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
/dev/mapper/360000970000197600444533037423034 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
```
Here, labels and UUIDs for offline devices are the same as for preceding active ones.
The fix converts the unsigned value returned by `sizeof` to signed integer explicitly.
---
mounted.ocfs2/mounted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index 8902fe0c..4fc53da5 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -530,7 +530,7 @@ static void do_quick_detect(struct list_head *dev_list)
for (offset = 1; offset <= 8; offset <<= 1) {
ret = do_pread(fd, buf, sizeof(buf), (offset * 1024));
- if (ret < sizeof(buf))
+ if (ret < (int) sizeof(buf))
break;
di = (struct ocfs2_dinode *)buf;
if (!memcmp(di->i_signature,
--
2.12.3

57
ocfs2-devel.diff Normal file
View File

@ -0,0 +1,57 @@
Index: ocfs2-tools/vendor/common/o2cb.init.sh
===================================================================
--- ocfs2-tools.orig/vendor/common/o2cb.init.sh 2012-08-24 10:22:54.000000000 -0500
+++ ocfs2-tools/vendor/common/o2cb.init.sh 2012-08-24 10:23:09.000000000 -0500
@@ -8,7 +8,8 @@
# Provides: o2cb
# Required-Start: $network
# Should-Start:
-# Required-Stop:
+# Should-Stop:
+# Required-Stop: $null
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: Load O2CB cluster services at system boot.
@@ -671,7 +672,7 @@ status_filesystem()
status_daemon()
{
- DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}"
+ DAEMON="/usr/sbin/ocfs2_controld.${O2CB_STACK}"
echo -n "Checking for control daemon: "
if [ -n "$(pidofproc "$DAEMON")" ]
then
@@ -700,6 +701,7 @@ bringup_daemon()
fi
sleep 1
done
+ sleep 2
return 0
}
@@ -707,7 +709,7 @@ bringup_daemon()
kill_daemon()
{
SIGNAL="$1"
- DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}"
+ DAEMON="/usr/sbin/ocfs2_controld.${O2CB_STACK}"
status_daemon >/dev/null 2>&1 || return 2
Index: ocfs2-tools/vendor/common/ocfs2.init
===================================================================
--- ocfs2-tools.orig/vendor/common/ocfs2.init 2012-08-24 10:22:54.000000000 -0500
+++ ocfs2-tools/vendor/common/ocfs2.init 2012-08-24 10:23:09.000000000 -0500
@@ -8,9 +8,9 @@
### BEGIN INIT INFO
# Provides: ocfs2
# Required-Start: $network o2cb
-# Required-Stop:
-# X-UnitedLinux-Should-Start:
-# X-UnitedLinux-Should-Stop:
+# Required-Stop: $null
+# Should-Start:
+# Should-Stop:
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: Mount OCFS2 volumes at boot.

3
ocfs2-tools-1.8.7.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d87b9982b6c186f963b39ba4a667d307efe4337748c02aa194f9fe6519bfac8
size 1522282

View File

@ -0,0 +1,14 @@
Index: ocfs2-tools/include/ocfs2-kernel/ocfs2_fs.h
===================================================================
--- ocfs2-tools.orig/include/ocfs2-kernel/ocfs2_fs.h 2012-08-24 10:22:41.000000000 -0500
+++ ocfs2-tools/include/ocfs2-kernel/ocfs2_fs.h 2012-08-24 10:23:30.000000000 -0500
@@ -329,6 +329,9 @@
*/
#define OCFS2_CLUSTER_O2CB_GLOBAL_HEARTBEAT (0x01)
+// Reintroduce umode_t, which disappeared in kernel 3.3
+typedef unsigned short umode_t;
+
struct ocfs2_system_inode_info {
char *si_name;
int si_iflags;

View File

@ -0,0 +1,12 @@
Index: ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
===================================================================
--- ocfs2-tools.orig/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -40,6 +40,7 @@
#include <sys/stat.h>
#include <signal.h>
#include <syslog.h>
+#include <sys/resource.h>
#include "ocfs2/ocfs2.h"

1064
ocfs2-tools.changes Normal file

File diff suppressed because it is too large Load Diff

340
ocfs2-tools.spec Normal file
View File

@ -0,0 +1,340 @@
#
# spec file for package ocfs2-tools
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
#if run "rpmbuild --with=ocfs2console"
#_with_ocfs2console will be automatically defined
%if %{defined _with_ocfs2console}
%define _ocfs2console 1
%else
%if 0%{?suse_version} >= 1500
%define _ocfs2console 0
%else
%define _ocfs2console 1
%endif
%endif
Name: ocfs2-tools
Version: 1.8.7
Release: 0
Summary: Oracle Cluster File System 2 Core Tools
License: GPL-2.0-only
Group: System/Filesystems
URL: https://ocfs2.wiki.kernel.org/
Source: ocfs2-tools-%{version}.tar.gz
Source1: reflink.tar.bz2
Patch001: auto-setup-pcmk-stack-as-default-if-no-stack-is-setup.patch
Patch103: debug-ocfs2_hb_ctl.patch
Patch105: bug-470741-debug_start_failures.patch
Patch106: ocfs2-devel.diff
Patch107: reflink-no-syscall.patch
Patch202: fix-configure-check-libs.patch
Patch204: dont-use-var-lock-subsys.patch
Patch205: ocfs2-tools-kernel33.patch
Patch206: ocfs2-tools-resource.patch
Patch225: 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
Patch228: 0007-Improve-error-message-if-DLM-service-is-unavailable.patch
Patch405: 0007-vendor-Add-vendor-files-for-sles12.patch
Patch406: 0008-ocfs2-tools-add-systemd-support-fix.patch
Patch501: fixed-mounted.ocfs2-output-when-some-devices-are-Not.patch
Patch502: update-mounted.ocfs2-mounted.c.patch
BuildRequires: autoconf
BuildRequires: e2fsprogs-devel
BuildRequires: libaio-devel
BuildRequires: libbz2-devel
BuildRequires: libcorosync-devel
BuildRequires: libdlm-devel
BuildRequires: libxslt-devel
BuildRequires: libz1
BuildRequires: readline-devel
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libxml-2.0)
Requires(pre): %fillup_prereq
Requires: e2fsprogs
Requires: glib2 >= 2.2.3
Requires: libdlm
Requires: modutils
Requires: net-tools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Recommends: ocfs2-kmp
%if 0%{?suse_version} >= 1315
%define systemd_enabled 1
%else
%define systemd_enabled 0
Requires(pre): %insserv_prereq
%endif
%description
OCFS2 is the Oracle Cluster File System.
This package contains the core user-space tools needed for creating and
managing the file system.
%if 0%{_ocfs2console} == 1
%package -n ocfs2console
Summary: Oracle Cluster Filesystem 2 GUI tools
Group: System/Filesystems
BuildRequires: python-devel
BuildRequires: python-gtk-devel
Requires: e2fsprogs
Requires: glib2 >= 2.2.3
Requires: ocfs2-tools = %{version}
Requires: ocfs2-tools = %{version}
Requires: python-gtk >= 1.99.16
Requires: vte >= 0.11.10
Provides: ocfs2-support = %{version}
Obsoletes: ocfs2-support < %{version}
%description -n ocfs2console
OCFS2 is the Oracle Cluster Filesystem.
This package contains additional tools and a GUI (python-gtk).
%endif
%package devel
Summary: Oracle Cluster File System 2 Development files
Group: Development/Libraries/C and C++
Requires: libcom_err
Requires: libcom_err-devel
Requires: ocfs2-tools = %{version}
%description devel
OCFS2 is the Oracle Cluster File System.
This package contains the header files for developing low-level
OCFS2-aware applications.
%package devel-static
Summary: Oracle Cluster File System 2 static libraries
Group: Development/Libraries/C and C++
Requires: libcom_err
Requires: libcom_err-devel
Requires: ocfs2-tools = %{version}
%description devel-static
OCFS2 is the Oracle Cluster File System.
This package contains the static libraries for developing low-level
OCFS2-aware applications.
%package o2cb
Summary: Oracle Cluster File System 2 tools for the native o2cb stack
Group: System/Filesystems
Requires: ocfs2-tools = %{version}
%description o2cb
OCFS is the Oracle Cluster File System.
This package contains the tools to manage the native o2cb stack for the
OCFS2 filesystem.
%prep
%setup -q -a 1
%patch001 -p1
%patch103 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p0
%patch202 -p1
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch225 -p1
%patch228 -p1
%patch405 -p1
%patch406 -p1
%patch501 -p1
%patch502 -p1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export PROJECT="ocfs2-tools"
autoreconf -fi -I /usr/share/aclocal
%configure --disable-debug \
%if 0%{_ocfs2console} == 1
--enable-ocfs2console=yes \
%endif
--enable-dynamic-fsck=yes \
--enable-dynamic-ctl=yes
make OPTS="%{optflags}"
cd reflink
cp ../config.guess ../config.sub coreutils-6.9/build-aux/
%configure
make reflink
cd ..
%install
mkdir -p %{buildroot}/sbin
mkdir -p %{buildroot}%{_prefix}/bin
mkdir -p %{buildroot}%{_fillupdir}
mkdir -p %{buildroot}%{_udevrulesdir}
cp -f vendor/common/51-ocfs2.rules %{buildroot}%{_udevrulesdir}
cp -f vendor/common/o2cb.sysconfig %{buildroot}%{_fillupdir}/sysconfig.o2cb
%if %{systemd_enabled}
mkdir -p %{buildroot}/usr/lib/systemd/system
cp -f vendor/common/o2cb.service %{buildroot}/usr/lib/systemd/system/
cp -f vendor/common/ocfs2.service %{buildroot}/usr/lib/systemd/system/
cp -f vendor/common/o2cb.init %{buildroot}/sbin
cp -f vendor/common/ocfs2.init %{buildroot}/sbin
%else
mkdir -p %{buildroot}%{_sysconfdir}/init.d
cp -f vendor/common/o2cb.init %{buildroot}%{_sysconfdir}/init.d/o2cb
cp -f vendor/common/ocfs2.init %{buildroot}%{_sysconfdir}/init.d/ocfs2
ln -sf ..%{_sysconfdir}/init.d/o2cb %{buildroot}/sbin/rco2cb
ln -sf ..%{_sysconfdir}/init.d/ocfs2 %{buildroot}/sbin/rcocfs2
%endif
make DESTDIR="%{buildroot}" install
cd reflink
make DESTDIR="%{buildroot}" install
cd ..
rm %{buildroot}/sbin/defragfs.ocfs2
rm %{buildroot}/%{_mandir}/man8/defragfs.ocfs2.8
mv %{buildroot}/{,/usr}/sbin/o2image
mv %{buildroot}/{,/usr}/sbin/debugfs.ocfs2
#mv %{buildroot}/{,/usr}/sbin/ocfs2_controld.pcmk
chmod a-x %{buildroot}/%{_libdir}/libo2cb.a
chmod a-x %{buildroot}/%{_libdir}/libo2dlm.a
chmod a-x %{buildroot}/%{_libdir}/libocfs2.a
%if 0%{_ocfs2console} == 1
python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir}/ocfs2interface', ddir='%{py_sitedir}/ocfs2interface')"
%endif
%if %{systemd_enabled}
%pre o2cb
%service_add_pre ocfs2.service o2cb.service
%endif
%preun o2cb
%if %{systemd_enabled}
%service_del_preun ocfs2.service o2cb.service
%else
%stop_on_removal ocfs2
%stop_on_removal o2cb
%endif
%post o2cb
%fillup_only -n o2cb
%if %{systemd_enabled}
%service_add_post ocfs2.service o2cb.service
%endif
%postun o2cb
%if %{systemd_enabled}
%service_del_postun ocfs2.service o2cb.service
%else
%{insserv_cleanup}
%restart_on_update ocfs2
%restart_on_update o2cb
%endif
%files
%defattr(-,root,root)
%license COPYING
%doc CREDITS MAINTAINERS
%doc documentation/users_guide.txt
%dir /usr/lib/udev
%dir %{_udevrulesdir}
/sbin/fsck.ocfs2
/sbin/mkfs.ocfs2
/sbin/mounted.ocfs2
/sbin/tunefs.ocfs2
/sbin/mount.ocfs2
/sbin/ocfs2_hb_ctl
/sbin/o2cluster
%{_sbindir}/o2image
%{_sbindir}/debugfs.ocfs2
%{_sbindir}/o2hbmonitor
%{_bindir}/reflink
%{_bindir}/o2info
%{_udevrulesdir}/51-ocfs2.rules
%{_mandir}/man8/debugfs.ocfs2.8*
%{_mandir}/man8/fsck.ocfs2.8*
%{_mandir}/man8/fsck.ocfs2.checks.8*
%{_mandir}/man8/mkfs.ocfs2.8*
%{_mandir}/man8/tunefs.ocfs2.8*
%{_mandir}/man8/mounted.ocfs2.8*
%{_mandir}/man8/ocfs2_hb_ctl.8*
%{_mandir}/man8/mount.ocfs2.8*
%{_mandir}/man8/o2image.8.gz
%{_mandir}/man8/o2cluster.8.gz
%{_mandir}/man8/o2hbmonitor.8.gz
%{_mandir}/man5/o2cb.sysconfig.5.gz
%{_mandir}/man5/ocfs2.cluster.conf.5.gz
%{_mandir}/man7/ocfs2.7.gz
%{_mandir}/man1/o2info.1.gz
%if 0%{_ocfs2console} == 1
%files -n ocfs2console
%defattr(-,root,root)
%{_sbindir}/ocfs2console
%{py_sitedir}/ocfs2interface
%{_mandir}/man8/ocfs2console.8*
%endif
%files o2cb
%defattr(-,root,root)
%doc README.O2CB
/sbin/o2cb_ctl
/sbin/o2cb
%if %{systemd_enabled}
/sbin/o2cb.init
/sbin/ocfs2.init
/usr/lib/systemd/system/o2cb.service
/usr/lib/systemd/system/ocfs2.service
%else
/sbin/rco2cb
/sbin/rcocfs2
%{_sysconfdir}/init.d/o2cb
%{_sysconfdir}/init.d/ocfs2
%endif
%{_mandir}/man8/o2cb_ctl.8*
%{_fillupdir}/sysconfig.o2cb
%{_mandir}/man7/o2cb.7.gz
%{_mandir}/man8/o2cb.8.gz
%files devel
%defattr(-,root,root)
%{_includedir}/o2cb
%{_includedir}/o2dlm
%{_includedir}/ocfs2
%{_includedir}/ocfs2-kernel
%{_libdir}/pkgconfig/o2cb.pc
%{_libdir}/pkgconfig/o2dlm.pc
%{_libdir}/pkgconfig/ocfs2.pc
%files devel-static
%defattr(-,root,root)
%{_libdir}/libo2cb.a
%{_libdir}/libo2dlm.a
%{_libdir}/libocfs2.a
%changelog

57
reflink-no-syscall.patch Normal file
View File

@ -0,0 +1,57 @@
Index: reflink/coreutils-6.9/src/ln.c
===================================================================
--- reflink.orig/coreutils-6.9/src/ln.c
+++ reflink/coreutils-6.9/src/ln.c
@@ -152,52 +152,6 @@ target_directory_operand (char const *fi
return is_a_dir;
}
-#ifndef HAVE_REFLINK
-# ifndef HAVE_REFLINKAT
-# include <sys/syscall.h>
-
-# ifndef SYS_reflinkat
-# ifdef __i386__
-# define __NR_reflinkat 337
-# endif
-# ifdef __x86_64__
-# define __NR_reflinkat 299
-# endif
-# define SYS_reflinkat __NR_reflinkat
-# endif /* SYS_reflinkat */
-
-# ifdef SYS_reflinkat
-static int reflinkat(int olddirfd, const char *oldpath,
- int newdirfd, const char *newpath,
- int preserve, int flags)
-{
- return syscall(SYS_reflinkat, olddirfd, oldpath, newdirfd, newpath,
- preserve, flags);
-}
-# else
-static int reflinkat(int olddirfd, const char *oldpath,
- int newdirfd, const char *newpath,
- int preserve, int flags)
-{
- return -ENOSYS;
-}
-# endif /* SYS_reflinkat */
-# endif /* HAVE_REFLINKAT */
-
-/*
- * We've now defined reflinkat of some sort. We can use it to build
- * reflink.
- */
-# ifndef AT_FDCWD
-# define AT_FDCWD -100
-# endif
-static int reflink(const char *oldpath, const char *newpath,
- int preserve)
-{
- return reflinkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, preserve, 0);
-}
-#endif /* HAVE_REFLINK */
-
#ifndef REFLINK_ATTR_NONE
# define REFLINK_ATTR_NONE 0
#endif

3
reflink.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d197e3c716ab12213332d9787375fecda0ede55508ca1e71aec9922e8c124ba5
size 5167807