File 0223-90dm-fixup-dependency-cycle-between-MD-and-DM-shutdo.patch of Package dracut.12460

From e35fe0828445a36284b2ba0852247bf6671a2680 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 25 Aug 2016 09:49:14 +0200
Subject: [PATCH] 90dm: fixup dependency cycle between MD and DM shutdown

DM devices might be located on top of MD devices, so we need to
call the DM shutdown script before MD shutdown. The exception
here are multipath devices, which are below MD devices.
So skip removing multipath devices here to avoid spurious errors.

References: bsc#994860

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 modules.d/90dm/dm-shutdown.sh  | 14 ++++++++++++--
 modules.d/90dm/module-setup.sh |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh
index 0685a68..732548b 100755
--- a/modules.d/90dm/dm-shutdown.sh
+++ b/modules.d/90dm/dm-shutdown.sh
@@ -9,8 +9,18 @@ _remove_dm() {
         [ -e ${s} ] || continue
         _remove_dm ${s##*/}
     done
-    devname=$(cat /sys/block/${dev}/dm/name)
-    dmsetup -v --noudevsync remove "$devname" || return $?
+    # multipath devices might have MD devices on top,
+    # which are removed after this script. So do not
+    # remove those to avoid spurious errors
+    case $(cat /sys/block/${dev}/dm/uuid) in
+        mpath-*)
+            return 0
+            ;;
+        *)
+            devname=$(cat /sys/block/${dev}/dm/name)
+            dmsetup -v --noudevsync remove "$devname" || return $?
+            ;;
+    esac
     return 0
 }
 
diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh
index 419e8b1..a5ada46 100755
--- a/modules.d/90dm/module-setup.sh
+++ b/modules.d/90dm/module-setup.sh
@@ -39,6 +39,6 @@ install() {
     inst_rules "$moddir/59-persistent-storage-dm.rules"
     prepare_udev_rules 59-persistent-storage-dm.rules
 
-    inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
+    inst_hook shutdown 25 "$moddir/dm-shutdown.sh"
 }
 
-- 
2.6.6

openSUSE Build Service is sponsored by