#!/sbin/runscript # 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.init,v 1.1 2006/07/20 05:13:14 dberkholz Exp $ depend() { need net localmount before netmount } start() { einfo "Starting OCFS2 cluster" for cluster in ${OCFS2_CLUSTER}; do ebegin " - ${cluster}" /sbin/o2cb start ${cluster} 2>&1 eend $? # TODO integrate it in /sbin/o2cb # 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 sleep 2 } stop() { # Shamelesly stolen from netmount local ret ebegin "Unmounting OCFS2 filesystems" [ -z "$(umount -art ocfs2 2>&1)" ] ret=$? eend ${ret} "Failed to simply unmount filesystems" declare -a siglist=( "TERM" "KILL" "KILL" ) local retry=0 local remaining="go" while [ -n "${remaining}" -a ${retry} -lt 3 ] do remaining="$(awk '$3 ~ /'ocfs2'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" IFS=$'\n' set -- ${remaining//\\040/ } unset IFS [ -z "${remaining}" ] && break ebegin $'\t'"Unmounting ocfs2 filesystems (retry #$((retry+1)))" /bin/fuser -k -${siglist[$((retry++))]} -m "$@" &>/dev/null sleep 5 umount "$@" &>/dev/null eend $? $'\t'"Failed to unmount filesystems" done einfo "Stopping OCFS2 cluster" for cluster in ${OCFS2_CLUSTER}; do ebegin " - ${cluster}" /sbin/o2cb stop ${cluster} 2>&1 eend $? done } status() { einfo "Status OCFS2 cluster" for cluster in ${OCFS2_CLUSTER}; do ebegin " - ${cluster}" /sbin/o2cb status ${cluster} 2>&1 eend $? done sleep 2 }