90dm: Fixup shutdown script
When calling the shutdown script we need to take care of traversing the device-mapper tables, otherwise we might end up trying to remove a device-mapper device which still has another one stacked on top and the removal will fail. References: bsc#994860 Signed-off-by: Hannes Reinecke <hare@suse.com>master
parent
611b8ae0d7
commit
07e6357483
|
|
@ -1,11 +1,28 @@
|
|||
#!/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
|
||||
devname=$(cat /sys/block/${dev}/dm/name)
|
||||
dmsetup -v --noudevsync remove "$devname" || return $?
|
||||
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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue