diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2010-03-25 12:52:06 -0500 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@opensvc.com> | 2010-03-25 20:18:28 +0100 |
commit | 439f52954a6f94f55bdb0943a1e8f5ca913e8a81 (patch) | |
tree | 48b57de1de110c6268a027d94f46a6cc2344c022 /multipathd | |
parent | e276a4eb7aff698a9a070b582d3b56d41c35c89e (diff) | |
download | multipath-tools-439f52954a6f94f55bdb0943a1e8f5ca913e8a81.tar.gz multipath-tools-439f52954a6f94f55bdb0943a1e8f5ca913e8a81.tar.bz2 multipath-tools-439f52954a6f94f55bdb0943a1e8f5ca913e8a81.zip |
multipath: don't let init script stop multipathd for root devices
This patch modifies the redhat init script, so that it doesn't allow
multipathd to be stopped when the root device is on it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'multipathd')
-rw-r--r-- | multipathd/multipathd.init.redhat | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/multipathd/multipathd.init.redhat b/multipathd/multipathd.init.redhat index ee776f0..e46b1b8 100644 --- a/multipathd/multipathd.init.redhat +++ b/multipathd/multipathd.init.redhat @@ -2,7 +2,7 @@ # # multipathd Starts the multipath daemon # -# chkconfig: - 13 87 +# chkconfig: - 06 87 # description: Manages device-mapper multipath devices ### BEGIN INIT INFO @@ -17,6 +17,7 @@ prog=`basename $DAEMON` initdir=/etc/rc.d/init.d lockdir=/var/lock/subsys sysconfig=/etc/sysconfig +syspath=/sys/block . $initdir/functions @@ -25,6 +26,36 @@ test -r $sysconfig/$prog && . $sysconfig/$prog RETVAL=0 +teardown_slaves() +{ +pushd $1 > /dev/null +if [ -d "slaves" ]; then +for slave in slaves/*; +do + if [ "$slave" = "slaves/*" ]; then + read dev < $1/dev + tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` + if ! [ -z $tablename ]; then + echo "Root is on a multipathed device, multipathd can not be stopped" + exit 1 + fi + else + local_slave=`readlink -f $slave`; + teardown_slaves $local_slave; + fi + done + +else + read dev < $1/dev + tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"` + if ! [ -z $tablename ]; then + echo "Root is on a multipathed device, multipathd can not be stopped" + exit 1 + fi +fi +popd > /dev/null +} + # # See how we were called. # @@ -39,6 +70,11 @@ start() { } stop() { + root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab) + dm_num=`dmsetup info -c --noheadings -o minor $root_dev` + root_dm_device="dm-$dm_num" + [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device + echo -n $"Stopping $prog daemon: " killproc $DAEMON RETVAL=$? |