From 2981d1e79851bc83751efc1d9ce987cdc65305bc Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 4 Jul 2016 15:39:44 +0200 Subject: [PATCH] tests: try to force remove higher minor first When force removing thin-pool we loose 'real' access to hidden device, and if such pool is in suspended state, any thin volume cannot be dropped. It likely should be also checked by dmsetup, but meanwhile apply simple logic - try to force remove first all higher minors first with assumption we first create thin-pool and then thin volume and there are usually not being released lower dm numbers to get the order wrong. --- test/lib/aux.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 865314944..66574df32 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -419,7 +419,8 @@ teardown_devs_prefixed() { while num_devs=$(dm_table | grep "$prefix" | wc -l) && \ test $num_devs -lt $num_remaining_devs -a $num_devs -ne 0; do test "$stray" -eq 0 || echo "Removing $num_devs stray mapped devices with names beginning with $prefix: " - for dm in $(dm_info name --sort open | grep "$prefix") ; do + # HACK: sort also by minors - so we try to close 'possibly later' created device first + for dm in $(dm_info name --sort open,-minor | grep "$prefix") ; do dmsetup remove -f "$dm" || true done num_remaining_devs=$num_devs -- 2.43.5