Merge pull request #323 from danimo/dm-fixes

Two SUSE fixes for 90dm
master
Harald Hoyer 2017-12-18 09:06:54 +01:00 committed by GitHub
commit c0f2b6bebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 3 deletions

View File

@ -1,11 +1,38 @@
#!/bin/sh

_remove_dm() {
local dev=$1
local s
local devname

for s in /sys/block/${dev}/holders/dm-* ; do
[ -e ${s} ] || continue
_remove_dm ${s##*/}
done
# 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
}

_do_dm_shutdown() {
local ret=0
local final=$1
local dev

info "Disassembling device-mapper devices"
for dev in $(dmsetup info -c --noheadings -o name) ; do
dmsetup -v --noudevsync remove "$dev" || ret=$?
for dev in /sys/block/dm-* ; do
[ -e ${dev} ] || continue
_remove_dm ${dev##*/} || ret=$?
done
if [ "x$final" != "x" ]; then
info "dmsetup ls --tree"

View File

@ -38,6 +38,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"
}