Browse Source

Merge pull request #323 from danimo/dm-fixes

Two SUSE fixes for 90dm
master
Harald Hoyer 7 years ago committed by GitHub
parent
commit
c0f2b6bebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      modules.d/90dm/dm-shutdown.sh
  2. 2
      modules.d/90dm/module-setup.sh

31
modules.d/90dm/dm-shutdown.sh

@ -1,11 +1,38 @@ @@ -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"

2
modules.d/90dm/module-setup.sh

@ -38,6 +38,6 @@ install() { @@ -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"
}


Loading…
Cancel
Save