aboutsummaryrefslogtreecommitdiffstats
path: root/main/ocfs2-tools
diff options
context:
space:
mode:
Diffstat (limited to 'main/ocfs2-tools')
-rw-r--r--main/ocfs2-tools/APKBUILD61
-rw-r--r--main/ocfs2-tools/build.patch32
-rw-r--r--main/ocfs2-tools/gcc45-ftbfs.patch21
-rw-r--r--main/ocfs2-tools/ocfs2-tools.confd38
-rw-r--r--main/ocfs2-tools/ocfs2-tools.initd193
5 files changed, 345 insertions, 0 deletions
diff --git a/main/ocfs2-tools/APKBUILD b/main/ocfs2-tools/APKBUILD
new file mode 100644
index 0000000000..b64566bde8
--- /dev/null
+++ b/main/ocfs2-tools/APKBUILD
@@ -0,0 +1,61 @@
+# Contributor:
+# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
+pkgname=ocfs2-tools
+pkgver=1.4.4
+pkgrel=3
+pkgdesc="Oracle Cluster File System 2 utilities"
+url="http://oss.oracle.com/projects/ocfs2-tools"
+arch="all"
+license="GPL2"
+depends=
+depends_dev="e2fsprogs-dev glib-dev readline-dev"
+makedepends="$depends_dev"
+install=
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://oss.oracle.com/projects/ocfs2-tools/dist/files/source/v1.4/$pkgname-$pkgver.tar.gz
+ gcc45-ftbfs.patch
+ build.patch
+ $pkgname.initd
+ $pkgname.confd"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+
+ for i in ../*.patch
+ do
+ msg "Applying patch $i"
+ patch -p1 -i $i || return 1
+ done
+
+ sed -i 's%sys/raw.h%linux/raw.h%' fswreck/include/main.h || return 1
+ sed -i 's%sys/raw.h%linux/raw.h%' debugfs.ocfs2/include/main.h || return 1
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-ocfs2console=no \
+ --enable-dynamic-fsck=yes \
+ --disable-glibtest || return 1
+ make -j1 || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install
+
+ # remove the 2 lines below (and this) if there is no init.d script
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/o2cb
+ install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/o2cb
+}
+
+md5sums="f7ae245e8baa499aa56d7af25a7885d5 ocfs2-tools-1.4.4.tar.gz
+5dba18ca5596b1de0f2eeb30f5ed1656 gcc45-ftbfs.patch
+c938040f0e77a4bb23e952c8f99b6cc5 build.patch
+601fbd79acdc52a9046293aa977b1547 ocfs2-tools.initd
+d81b6ab068ec92a137b58c9ad56c4637 ocfs2-tools.confd"
diff --git a/main/ocfs2-tools/build.patch b/main/ocfs2-tools/build.patch
new file mode 100644
index 0000000000..c0e9e503ab
--- /dev/null
+++ b/main/ocfs2-tools/build.patch
@@ -0,0 +1,32 @@
+diff -Nuard ocfs2-tools-1.4.3.orig/ocfs2_controld/Makefile ocfs2-tools-1.4.3/ocfs2_controld/Makefile
+--- ocfs2-tools-1.4.3.orig/ocfs2_controld/Makefile 2009-04-14 00:10:40.000000000 +0200
++++ ocfs2-tools-1.4.3/ocfs2_controld/Makefile 2009-09-30 08:22:04.000000000 +0200
+@@ -17,7 +17,7 @@
+ PCMK_INCLUDES = -I/usr/include/pacemaker -I/usr/include/heartbeat/ $(GLIB_CFLAGS)
+ endif
+
+-INCLUDES = -I$(TOPDIR)/include -I. $(PCMK_INCLUDES)
++INCLUDES = -I/usr/include/libxml2 -I$(TOPDIR)/include -I. $(PCMK_INCLUDES)
+ LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
+ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
+diff -Nuard ocfs2-tools-1.4.3.orig/ocfs2_controld/pacemaker.c ocfs2-tools-1.4.3/ocfs2_controld/pacemaker.c
+--- ocfs2-tools-1.4.3.orig/ocfs2_controld/pacemaker.c 2009-05-06 03:36:57.000000000 +0200
++++ ocfs2-tools-1.4.3/ocfs2_controld/pacemaker.c 2009-09-30 08:22:22.000000000 +0200
+@@ -22,6 +22,7 @@
+
+ #include <bzlib.h>
+
++#include <corosync/corodefs.h>
+ #include <pacemaker/crm_config.h>
+ /* heartbeat support is irrelevant here */
+ #undef SUPPORT_HEARTBEAT
+@@ -155,7 +156,7 @@
+ crm_log_init("ocfs2_controld", LOG_INFO, FALSE, TRUE, 0, NULL);
+
+ if(init_ais_connection(NULL, NULL, NULL, &local_node_uname, &our_nodeid) == FALSE) {
+- log_error("Connection to our AIS plugin (%d) failed", CRM_SERVICE);
++ log_error("Connection to our AIS plugin (%d) failed", PCMK_SERVICE);
+ return -1;
+ }
+
diff --git a/main/ocfs2-tools/gcc45-ftbfs.patch b/main/ocfs2-tools/gcc45-ftbfs.patch
new file mode 100644
index 0000000000..0db24f49e2
--- /dev/null
+++ b/main/ocfs2-tools/gcc45-ftbfs.patch
@@ -0,0 +1,21 @@
+diff -urN ocfs2-tools-1.4.3.orig//mount.ocfs2/mount.ocfs2.c ocfs2-tools-1.4.3/mount.ocfs2/mount.ocfs2.c
+--- ocfs2-tools-1.4.3.orig//mount.ocfs2/mount.ocfs2.c 2009-04-14 00:10:40.000000000 +0200
++++ ocfs2-tools-1.4.3/mount.ocfs2/mount.ocfs2.c 2010-03-24 07:23:45.000000000 +0100
+@@ -261,7 +261,7 @@
+ char *extra = NULL;
+ int dev_ro = 0;
+ char *hbstr = NULL;
+- char stackstr[strlen(OCFS2_CLUSTER_STACK_ARG) + OCFS2_STACK_LABEL_LEN + 1] = "";
++ char stackstr[strlen(OCFS2_CLUSTER_STACK_ARG) + OCFS2_STACK_LABEL_LEN + 1];
+ ocfs2_filesys *fs = NULL;
+ struct o2cb_cluster_desc cluster;
+ struct o2cb_region_desc desc;
+@@ -269,6 +269,8 @@
+ int hb_started = 0;
+ struct stat statbuf;
+
++ stackstr[0] = '\0';
++
+ initialize_ocfs_error_table();
+ initialize_o2dl_error_table();
+ initialize_o2cb_error_table();
diff --git a/main/ocfs2-tools/ocfs2-tools.confd b/main/ocfs2-tools/ocfs2-tools.confd
new file mode 100644
index 0000000000..29bc08406a
--- /dev/null
+++ b/main/ocfs2-tools/ocfs2-tools.confd
@@ -0,0 +1,38 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.conf,v 1.1 2006/07/20 05:13:14 dberkholz Exp $
+
+# Put your cluster names here, separated by space, ie.
+# OCFS2_CLUSTER="cluster1 admincluster cluster2"
+OCFS2_CLUSTER="ocfs2"
+
+# Some heartbeat tweaks to prevent self-fencing quite so much during heavy load.
+# http://oss.oracle.com/projects/ocfs2/dist/documentation/ocfs2_faq.html
+
+# How long to wait before a node is considered dead from lack of network activity.
+OCFS2_IDLE_TIMEOUT_MS="30000"
+# How often we should attempt to send heartbeats.
+OCFS2_KEEPALIVE_DELAY_MS="2000"
+OCFS2_RECONNECT_DELAY_MS="2000"
+# How often we should attempt to send heartbeats.
+# How many interations before a node is considered dead from lack of IO activity.
+# (dead_threshold - 1) * 2s
+OCFS2_DEAD_THRESHOLD="31"
+
+# Default: "-fy" (force check on double-unmounted boot). I beleave this is best.
+# Native way is "-y", but once I have twice reboot/powerOFF with bad result...
+# Affected only fstab.
+OCFS2_FSCK="-fy"
+
+# http://oss.oracle.com/projects/ocfs2-tools/news/article_8.html
+# starting from 1.4.3, fsck.ocfs2 "aggressively cache the metadata blocks"
+# this is useful on lots of free memory, but I have heavy slowdown on x86_64
+# with 1G of RAM.
+# "yes" will "swapoff -a" & "swapon -a" around fsck to avoid caching over swap
+OCFS2_FSCK_SWAPOFF="yes"
+
+# Signal to kill processes on stop/umount on busy device (empty to not kill)
+#OCFS2_UMOUNT_KILL="KILL"
+
+# "yes" to force stop
+#OCFS2_FORCE_STOP="no"
diff --git a/main/ocfs2-tools/ocfs2-tools.initd b/main/ocfs2-tools/ocfs2-tools.initd
new file mode 100644
index 0000000000..677b498f88
--- /dev/null
+++ b/main/ocfs2-tools/ocfs2-tools.initd
@@ -0,0 +1,193 @@
+#!/sbin/runscript
+
+: ${OCFS2_FSCK:="-fy"}
+
+depend() {
+ need net localmount
+ before netmount
+ after drbd
+}
+
+pseudofs() {
+ [ -n "`mount -t $1`" ] && return 0
+ ewarn "OCFS2: Pseudo-filesystem $1 are not mounted."
+ ewarn "Make sure you have following lines in your /etc/fstab:"
+ ewarn "none $2 $1 defaults 0 0"
+
+ # Why not?
+ ebegin "Mounting $1"
+ mount -t $1 none $2 && [ -n "`mount -t $1`" ]
+ eend $? || return 1
+}
+
+fmod() {
+ [[ -e "$1" ]] && return 0
+ modprobe -s $2 && [[ -e "$1" ]] && return 0
+ eerror "OCFS2: Module '$2' failed, '$1' not found"
+ return 1
+}
+
+# unsure about possibility to keep heartbeat unclean after correct umount
+# but Oracle do so
+clean_heartbeat(){
+ local err=0 id
+ for i in "/sys/kernel/config/cluster/$1/heartbeat"/*; do
+ [[ -d "$i" ]] || continue
+ id="${i##*/}"
+ ebegin "Cleaning OCFS2 heartbeat region $1/$id"
+ [[ "`/sbin/ocfs2_hb_ctl -I -u "$id" | grep -o " [0-9]* refs$"`" == " 0 refs" ]] && /sbin/ocfs2_hb_ctl -K -u "$id" || ! [[ -d "$i" ]]
+ eend $? || err=1
+ done
+ return $err
+}
+
+UUID(){
+ local dev fs stack uuid label
+ /sbin/mounted.ocfs2 -d|while read dev fs stack uuid label; do
+ [[ "$stack" == "o2cb" ]] && echo "$uuid"
+ done|sort -u
+}
+
+clusters(){
+ [[ -z "${OCFS2_CLUSTER}" ]] && for i in /sys/kernel/config/cluster/*; do
+ OCFS2_CLUSTER="${OCFS2_CLUSTER} ${i##*/}"
+ done
+ echo "${OCFS2_CLUSTER}"
+}
+
+stop_cluster(){
+ if clean_heartbeat $1 || [[ "${OCFS2_FORCE_STOP}" == yes ]]; then
+ ebegin "Stopping OCFS2 cluster '$1'"
+ /sbin/o2cb_ctl -H -n $1 -t cluster -a online=no >/dev/null
+ eend $? || return 1
+ else
+ return 1
+ fi
+}
+
+online(){
+ local cluster
+ for cluster in ${*:-$(clusters)}; do
+ grep -q "^1\$" /sys/kernel/config/cluster/$cluster/node/*/local 2>/dev/null || return 1
+ done
+ return 0
+}
+
+start() {
+ ( fmod /sys/fs/ocfs2 ocfs2 &&
+ fmod /sys/fs/ocfs2/cluster_stack ocfs2_stackglue &&
+ pseudofs configfs /sys/kernel/config &&
+ pseudofs ocfs2_dlmfs /dlm
+ ) || return 1
+ echo o2cb >/sys/fs/ocfs2/cluster_stack 2>/dev/null
+ if [[ "`cat /sys/fs/ocfs2/cluster_stack`" != "o2cb" ]]; then
+ eerror "OCFS2: Stack 'o2cb' not loaded. Check your kernel config."
+ return 1
+ fi
+
+ # autodetect
+ : ${OCFS2_CLUSTER:=$(UUID)}
+
+ for cluster in $(clusters); do
+ ebegin "Starting OCFS2 cluster '${cluster}'"
+ online $cluster || /sbin/o2cb_ctl -H -n ${cluster} -t cluster -a online=yes >/dev/null
+ if ! eend $? ; then
+ local OCFS2_FORCE_STOP=no
+ stop_cluster $cluster
+ return 1
+ fi
+
+ # Some heartbeat tweaks to prevent self-fencing quite so much during heavy load.
+ # http://oss.oracle.com/projects/ocfs2/dist/documentation/ocfs2_faq.html
+
+ # How long to wait before a node is considered dead from lack of network activity.
+ echo $OCFS2_IDLE_TIMEOUT_MS > /sys/kernel/config/cluster/${cluster}/idle_timeout_ms
+ # How often we should attempt to send heartbeats.
+ echo $OCFS2_KEEPALIVE_DELAY_MS > /sys/kernel/config/cluster/${cluster}/keepalive_delay_ms
+ echo $OCFS2_RECONNECT_DELAY_MS > /sys/kernel/config/cluster/${cluster}/reconnect_delay_ms
+ # How many interations before a node is considered dead from lack of IO activity.
+ # (dead_threshold - 1) * 2s
+ echo $OCFS2_DEAD_THRESHOLD > /sys/kernel/config/cluster/${cluster}/heartbeat/dead_threshold
+ done
+
+ local i
+ for i in 9 8 7 6 5 4 3 2 1 0; do
+ online && break
+ echo -n "$i"
+ sleep 1
+ done
+ # usure: IMHO locking not starts here
+# let i=OCFS2_RECONNECT_DELAY_MS*2/1000
+# sleep $i
+
+ # Voluntary fsck. Will be happened only ondemand -
+ # on both unmounted/double fault, placed in fstab.
+ [[ "$OCFS2_FSCK_SWAPOFF" == "yes" ]] && swapoff -a
+ for i in `mount -invfat ocfs2 2>/dev/null|sed -e 's: .*::g'` ; do
+ [[ -e "$i" ]] || continue
+ einfo "OCFS2: Trying 'fsck.ocfs2 $OCFS2_FSCK $i' (fs check if possible)"
+ /sbin/fsck.ocfs2 $OCFS2_FSCK "$i" 2>/dev/null
+ done
+ [[ "$OCFS2_FSCK_SWAPOFF" == "yes" ]] && swapon -a
+
+ # Any behaviour
+ ebegin "Mounting OCFS2 filesystems"
+ mount -at ocfs2
+ eend $?
+ return $?
+}
+
+_fuser(){
+ fuser -"${OCFS2_UMOUNT_KILL}" -v"${OCFS2_UMOUNT_KILL:+k}" $*
+ return $?
+}
+
+_umount(){
+ local i m
+ i=`umount $* 2>&1` && {
+ echo -n "$i"
+ return 0
+ }
+ echo "$i"
+ _fuser -mM `echo "$i"|grep "^umount: .* device is busy\.\$"|sed -e 's%^umount: \([^ ]*\): device is busy\.$%\1%g'` || return 1
+ [[ -z "${OCFS2_UMOUNT_KILL}" ]] && return 1
+ umount $* && return 0
+ sleep 1
+ umount $*
+ return $?
+}
+
+stop() {
+ local ret=0 dev m i
+ # now umount only clusters - under heartbeat. others later
+# ebegin "Unmounting OCFS2 filesystems"
+# _umount -at ocfs2
+# eend $?
+# ret=$?
+
+ for cluster in $(clusters); do
+ for dev in `cat /sys/kernel/config/cluster/$cluster/heartbeat/*/dev 2>/dev/null`; do
+ m=`grep "/dev/$dev " /proc/mounts|sed -e 's:^[^ ]* \([^ ]*\) .*$:\1:g'`
+ [[ -z "$m" ]] && continue
+ ebegin "Unmounting OCFS2 cluster '$cluster' filesystems '$dev' from '$m'"
+ if _umount $m; then
+ eend 0
+ continue
+ elif umount $m; then
+ einfon "Lazy unmounted. Waiting "
+ for i in 9 8 7 6 5 4 3 2 1 0; do
+ ( /sbin/ocfs2_hb_ctl -I -d /dev/$dev || break ) | grep -q " 0 refs\$" && break
+ echo -n "$i"
+ _fuser $m
+ sleep 1
+ done
+ echo
+ [[ "$i" != 0 ]] && continue
+ fi
+ eend 1
+ ret=1
+ done
+ stop_cluster $cluster || ret=1
+ done
+ return $ret
+}