summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Zoffoli <xmerlin@gentoo.org>2005-03-22 13:59:10 +0000
committerChristian Zoffoli <xmerlin@gentoo.org>2005-03-22 13:59:10 +0000
commit016fbfbc870135c0dc47f4f78a8a801e3e617b79 (patch)
treec38c6d4ab0b8446bb608d3dd779fbc49f7f6bd22 /sys-fs/gfs/files
parentimproved init/conf (diff)
downloadgentoo-2-016fbfbc870135c0dc47f4f78a8a801e3e617b79.tar.gz
gentoo-2-016fbfbc870135c0dc47f4f78a8a801e3e617b79.tar.bz2
gentoo-2-016fbfbc870135c0dc47f4f78a8a801e3e617b79.zip
improved init, removed old fiiles/{gfs,gfs-mount}
(Portage version: 2.0.51.19)
Diffstat (limited to 'sys-fs/gfs/files')
-rwxr-xr-xsys-fs/gfs/files/gfs45
-rwxr-xr-xsys-fs/gfs/files/gfs-mount28
-rwxr-xr-xsys-fs/gfs/files/gfs.rc124
3 files changed, 124 insertions, 73 deletions
diff --git a/sys-fs/gfs/files/gfs b/sys-fs/gfs/files/gfs
deleted file mode 100755
index b06319b41bec..000000000000
--- a/sys-fs/gfs/files/gfs
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs,v 1.2 2005/03/19 22:04:36 xmerlin Exp $
-
-depend() {
- provide cluster
- need net
- need ccs fenced
- after cman
- use dns logger
-}
-
-checkconfig() {
- if [ ! -f /etc/ntp.conf ] ; then
- eerror "Please create /etc/ntp.conf"
- eerror "Sample conf: /usr/share/ntp/ntp.conf"
- return 1
- fi
- return 0
-}
-
-start() {
- checkconfig || return $?
-
- einfo "Starting gfs cluster:"
- ebegin "Loading needed kernel modules"
-
- if [ ! -f /proc/cluster/lock_dlm ]; then
- modprobe lock_dlm
- fi
- if [ ! -f /proc/fs/gfs ]; then
- modprobe gfs
- fi
- eend $? "Failed to load needed kernel modules"
-
-}
-
-stop() {
- einfo "Stopping gfs cluster:"
- ebegin "Removing gfs module"
- modprobe -r gfs &>/dev/null
- eend $?
-
-}
diff --git a/sys-fs/gfs/files/gfs-mount b/sys-fs/gfs/files/gfs-mount
deleted file mode 100755
index 739afd76cc5f..000000000000
--- a/sys-fs/gfs/files/gfs-mount
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs-mount,v 1.1 2005/03/19 17:32:19 xmerlin Exp $
-
-depend() {
- need net
- after gnbd-client gfs
- use dns logger
-}
-
-start() {
- GFS=`cat /etc/fstab | grep 'gfs'`
- if [ -n "$GFS" ] ; then
- ebegin "Mounting all gfs filesystems"
- cat /etc/fstab | awk '/[\t\s]gfs[\t\s]/ { print $1,$2 }' | xargs mount -v -t gfs
- eend $? "Failed to mount all gfs filesystems"
- fi
-}
-
-stop() {
- GFS=`cat /etc/fstab | grep 'gfs'`
- if [ -n "$GFS" ] ; then
- ebegin "Unmounting all gfs filesystems"
- cat /etc/fstab | awk '/[\t\s]gfs[\t\s]/ { print $2 }' | xargs umount -v -t gfs
- eend $? "Failed to umount all gfs filesystems"
- fi
-}
diff --git a/sys-fs/gfs/files/gfs.rc b/sys-fs/gfs/files/gfs.rc
new file mode 100755
index 000000000000..74f83ef3e730
--- /dev/null
+++ b/sys-fs/gfs/files/gfs.rc
@@ -0,0 +1,124 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/gfs/files/gfs.rc,v 1.1 2005/03/22 13:59:10 xmerlin Exp $
+
+depend() {
+ use dns logger
+ use net gnbd-client
+ need cluster-manager cluster-locking-manager fenced
+ provide cluster
+}
+
+start() {
+ einfo "Starting gfs cluster:"
+
+ if [ ! -f /etc/ntp.conf ] ; then
+ eerror "Please create /etc/ntp.conf"
+ eerror "Sample conf: /usr/share/ntp/ntp.conf"
+ eend 1
+ fi
+
+ local module
+
+ # detect cluster/locking manager cman+dlm or gulm ?
+ if [ -d /proc/cluster/config/cman ]; then
+ if [ ! -d /proc/cluster/lock_dlm ]; then
+ modules="${modules} lock_dlm"
+ fi
+ else
+ if [ ! -d /proc/cluster/lock_gulm ]; then
+ modules="${modules} lock_gulm"
+ fi
+ fi
+
+ if [ ! -f /proc/fs/gfs ]; then
+ modules="${modules} gfs"
+ fi
+
+ for module in ${modules}; do
+ ebegin "Loading ${module} kernel module"
+ modprobe ${module}
+
+ if [ "$?" -ne 0 ]
+ then
+ ewend 1 "Failed to load ${module} kernel module"
+ else
+ eend 0
+ fi
+ done
+
+ ebegin "Mounting GFS filesystems"
+ mount -at gfs >/dev/null
+
+ if [ "$?" -ne 0 ]
+ then
+ ewend 1 "Could not mount all GFS filesystems!"
+ else
+ eend 0
+ fi
+
+ return 0
+}
+
+stop() {
+ einfo "Stopping gfs cluster:"
+
+ local sig retry
+ local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
+
+ if [ -z "${remaining}" ]
+ then
+ ebegin "Unmounting GFS filesystems"
+ eend 0
+ else
+ sig=
+ retry=3
+ while [ -n "${remaining}" -a "${retry}" -gt 0 ]
+ do
+ if [ "${retry}" -lt 3 ]
+ then
+ ebegin "Unmounting GFS filesystems (retry)"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems this retry"
+ else
+ ebegin "Unmounting GFS filesystems"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems"
+ fi
+ remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
+ [ -z "${remaining}" ] && break
+ /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
+ sleep 5
+ retry=$((${retry} -1))
+ sig=-9
+ done
+ fi
+
+ local module modules
+
+ if [ -f /proc/fs/gfs ]; then
+ modules="gfs"
+ fi
+ if [ -d /proc/cluster/lock_dlm ]; then
+ modules="${modules} lock_dlm"
+ fi
+ if [ -d /proc/cluster/lock_gulm ]; then
+ modules="${modules} lock_gulm"
+ fi
+
+ local module
+ for module in ${modules}; do
+ ebegin "Unloading ${module} kernel module"
+ modprobe -r ${module}
+
+ if [ "$?" -ne 0 ]
+ then
+ ewend 1 "Failed to unload ${module} kernel module"
+ else
+ eend 0
+ fi
+ done
+
+ return 0
+}