blob: 7dc350e0f4c60bcb1d4ef1d69347670b15592595 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/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.3 2005/03/23 14:35:55 xmerlin Exp $
depend() {
use dns logger
use net
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"
modules="${modules} lock_harness"
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
}
|