1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

aux: teardown also devices with testing UUID

Hunt also for devices with LVMTEST prefix in UUID.

Call teardown_devs_prefixed - so if they hold RAM or SCSI
they are closed before trying to remove kernel modules.
This commit is contained in:
Zdenek Kabelac 2023-09-02 21:36:34 +02:00
parent d34d1f0173
commit 9087ace2af

View File

@ -403,7 +403,7 @@ teardown_devs_prefixed() {
# HACK: sort also by minors - so we try to close 'possibly later' created device first
test "$i" = 0 || sortby="-minor"
for dm in $(dm_info name,open --separator ';' --nameprefixes --unquoted --sort open,"$sortby" -S "name=~$prefix" --mangle none || true) ; do
for dm in $(dm_info name,open --separator ';' --nameprefixes --unquoted --sort open,"$sortby" -S "name=~$prefix || uuid=~$prefix" --mangle none || true) ; do
test "$dm" != "No devices found" || break 2
eval "$dm"
local force="-f"
@ -436,10 +436,14 @@ teardown_devs() {
restore_dm_mirror
test ! -f MD_DEV || cleanup_md_dev
test ! -f DEVICES || teardown_devs_prefixed "$PREFIX"
if [ -f DEVICES ] || [ -f RAMDISK ] || [ -f SCSI_DEBUG_DEV ]; then
teardown_devs_prefixed "$PREFIX"
fi
if test -f RAMDISK ; then
for i in 1 2 ; do
modprobe -r brd && break
modprobe -r brd && { rm -f RAMDISK ; break ; }
sleep .1
udev_wait
done
@ -451,7 +455,7 @@ teardown_devs() {
udev_wait
test "${LVM_TEST_PARALLEL:-0}" -eq 1 || {
for i in 1 2 ; do
modprobe -r scsi_debug && break
modprobe -r scsi_debug && { rm -f SCSI_DEBUG_DEV ; break ; }
sleep .1
udev_wait
done
@ -741,7 +745,7 @@ prepare_scsi_debug_dev() {
cleanup_scsi_debug_dev() {
teardown_devs
rm -f SCSI_DEBUG_DEV LOOP
rm -f LOOP
}
mdadm_create() {