|
Harald Hoyer |
3610a1 |
From c0f2b6bebc0b2feefdb15a2862308c08bbd4a77e Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
3610a1 |
From: Harald Hoyer <harald@hoyer.xyz>
|
|
Harald Hoyer |
3610a1 |
Date: Mon, 18 Dec 2017 09:06:54 +0100
|
|
Harald Hoyer |
3610a1 |
Subject: [PATCH] Merge pull request #323 from danimo/dm-fixes
|
|
Harald Hoyer |
3610a1 |
|
|
Harald Hoyer |
3610a1 |
Two SUSE fixes for 90dm
|
|
Harald Hoyer |
3610a1 |
---
|
|
Harald Hoyer |
3610a1 |
modules.d/90dm/dm-shutdown.sh | 31 +++++++++++++++++++++++++++++--
|
|
Harald Hoyer |
3610a1 |
modules.d/90dm/module-setup.sh | 2 +-
|
|
Harald Hoyer |
3610a1 |
2 files changed, 30 insertions(+), 3 deletions(-)
|
|
Harald Hoyer |
3610a1 |
|
|
Harald Hoyer |
3610a1 |
diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh
|
|
Harald Hoyer |
3610a1 |
index 7e4f4a58..b23836f4 100755
|
|
Harald Hoyer |
3610a1 |
--- a/modules.d/90dm/dm-shutdown.sh
|
|
Harald Hoyer |
3610a1 |
+++ b/modules.d/90dm/dm-shutdown.sh
|
|
Harald Hoyer |
3610a1 |
@@ -1,11 +1,38 @@
|
|
Harald Hoyer |
3610a1 |
#!/bin/sh
|
|
Harald Hoyer |
3610a1 |
|
|
Harald Hoyer |
3610a1 |
+_remove_dm() {
|
|
Harald Hoyer |
3610a1 |
+ local dev=$1
|
|
Harald Hoyer |
3610a1 |
+ local s
|
|
Harald Hoyer |
3610a1 |
+ local devname
|
|
Harald Hoyer |
3610a1 |
+
|
|
Harald Hoyer |
3610a1 |
+ for s in /sys/block/${dev}/holders/dm-* ; do
|
|
Harald Hoyer |
3610a1 |
+ [ -e ${s} ] || continue
|
|
Harald Hoyer |
3610a1 |
+ _remove_dm ${s##*/}
|
|
Harald Hoyer |
3610a1 |
+ done
|
|
Harald Hoyer |
3610a1 |
+ # multipath devices might have MD devices on top,
|
|
Harald Hoyer |
3610a1 |
+ # which are removed after this script. So do not
|
|
Harald Hoyer |
3610a1 |
+ # remove those to avoid spurious errors
|
|
Harald Hoyer |
3610a1 |
+ case $(cat /sys/block/${dev}/dm/uuid) in
|
|
Harald Hoyer |
3610a1 |
+ mpath-*)
|
|
Harald Hoyer |
3610a1 |
+ return 0
|
|
Harald Hoyer |
3610a1 |
+ ;;
|
|
Harald Hoyer |
3610a1 |
+ *)
|
|
Harald Hoyer |
3610a1 |
+ devname=$(cat /sys/block/${dev}/dm/name)
|
|
Harald Hoyer |
3610a1 |
+ dmsetup -v --noudevsync remove "$devname" || return $?
|
|
Harald Hoyer |
3610a1 |
+ ;;
|
|
Harald Hoyer |
3610a1 |
+ esac
|
|
Harald Hoyer |
3610a1 |
+ return 0
|
|
Harald Hoyer |
3610a1 |
+}
|
|
Harald Hoyer |
3610a1 |
+
|
|
Harald Hoyer |
3610a1 |
_do_dm_shutdown() {
|
|
Harald Hoyer |
3610a1 |
local ret=0
|
|
Harald Hoyer |
3610a1 |
local final=$1
|
|
Harald Hoyer |
3610a1 |
+ local dev
|
|
Harald Hoyer |
3610a1 |
+
|
|
Harald Hoyer |
3610a1 |
info "Disassembling device-mapper devices"
|
|
Harald Hoyer |
3610a1 |
- for dev in $(dmsetup info -c --noheadings -o name) ; do
|
|
Harald Hoyer |
3610a1 |
- dmsetup -v --noudevsync remove "$dev" || ret=$?
|
|
Harald Hoyer |
3610a1 |
+ for dev in /sys/block/dm-* ; do
|
|
Harald Hoyer |
3610a1 |
+ [ -e ${dev} ] || continue
|
|
Harald Hoyer |
3610a1 |
+ _remove_dm ${dev##*/} || ret=$?
|
|
Harald Hoyer |
3610a1 |
done
|
|
Harald Hoyer |
3610a1 |
if [ "x$final" != "x" ]; then
|
|
Harald Hoyer |
3610a1 |
info "dmsetup ls --tree"
|
|
Harald Hoyer |
3610a1 |
diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh
|
|
Harald Hoyer |
3610a1 |
index 2b8e39ff..02d97c24 100755
|
|
Harald Hoyer |
3610a1 |
--- a/modules.d/90dm/module-setup.sh
|
|
Harald Hoyer |
3610a1 |
+++ b/modules.d/90dm/module-setup.sh
|
|
Harald Hoyer |
3610a1 |
@@ -38,6 +38,6 @@ install() {
|
|
Harald Hoyer |
3610a1 |
inst_rules "$moddir/59-persistent-storage-dm.rules"
|
|
Harald Hoyer |
3610a1 |
prepare_udev_rules 59-persistent-storage-dm.rules
|
|
Harald Hoyer |
3610a1 |
|
|
Harald Hoyer |
3610a1 |
- inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
|
Harald Hoyer |
3610a1 |
+ inst_hook shutdown 25 "$moddir/dm-shutdown.sh"
|
|
Harald Hoyer |
3610a1 |
}
|
|
Harald Hoyer |
3610a1 |
|
|
Harald Hoyer |
3610a1 |
|