From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] multipath: don't let init script stop multipathd for root devices
Date: Thu, 25 Mar 2010 12:52:06 -0500 [thread overview]
Message-ID: <20100325175205.GG23952@ether.msp.redhat.com> (raw)
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>
---
:100644 100644 ee776f0... e46b1b8... M multipathd/multipathd.init.redhat
multipathd/multipathd.init.redhat | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
Index: multipath-tools-100322/multipathd/multipathd.init.redhat
===================================================================
--- multipath-tools-100322.orig/multipathd/multipathd.init.redhat
+++ multipath-tools-100322/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
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=$?
next reply other threads:[~2010-03-25 17:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 17:52 Benjamin Marzinski [this message]
2010-03-26 2:04 ` [PATCH] multipath: don't let init script stop multipathd for root devices Kiyoshi Ueda
2010-03-26 16:23 ` Benjamin Marzinski
2010-03-30 0:11 ` Kiyoshi Ueda
2010-04-01 18:42 ` Benjamin Marzinski
2010-04-02 2:20 ` Kiyoshi Ueda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100325175205.GG23952@ether.msp.redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.