File 0306-90multipath-add-shutdown-script.patch of Package dracut.4068
From 800cfd66abb60fe9524d321df77717435ed96e35 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 25 Aug 2016 09:33:26 +0200
Subject: [PATCH] 90multipath: add shutdown script
As the device-mapper module is removing all device-mapper tables
during shutdown we need to make sure to disable queuing on the
multipath devices; otherwise there might still be I/O pending
and the removal will fail.
References: bsc#994860
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
modules.d/90multipath/module-setup.sh | 1 +
modules.d/90multipath/multipath-shutdown.sh | 7 +++++++
modules.d/90multipath/multipathd-needshutdown.sh | 9 +++++----
3 files changed, 13 insertions(+), 4 deletions(-)
create mode 100755 modules.d/90multipath/multipath-shutdown.sh
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index a5db55f..ad257ad 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -114,6 +114,7 @@ install() {
fi
inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
+ inst_hook shutdown 20 "$moddir/multipath-shutdown.sh"
inst_rules 40-multipath.rules 56-multipath.rules \
62-multipath.rules 65-multipath.rules \
diff --git a/modules.d/90multipath/multipath-shutdown.sh b/modules.d/90multipath/multipath-shutdown.sh
new file mode 100755
index 0000000..47e9990
--- /dev/null
+++ b/modules.d/90multipath/multipath-shutdown.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+for i in $(multipath -l -v1); do
+ if ! $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
+ dmsetup message $i 0 fail_if_no_path
+ fi
+done
diff --git a/modules.d/90multipath/multipathd-needshutdown.sh b/modules.d/90multipath/multipathd-needshutdown.sh
index 214abd3..1d41bf8 100755
--- a/modules.d/90multipath/multipathd-needshutdown.sh
+++ b/modules.d/90multipath/multipathd-needshutdown.sh
@@ -1,7 +1,8 @@
#!/bin/sh
-for i in /dev/mapper/mpath*; do
- [ -b "$i" ] || continue
- need_shutdown
- break
+for i in $(multipath -l -v1); do
+ if $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
+ need_shutdown
+ break
+ fi
done
--
2.6.6