diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2024-12-03 11:05:56 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mtkaczyk@kernel.org> | 2024-12-13 10:08:10 +0100 |
commit | 023b89992a8e2398fa619619b74a69a5bf0227ca (patch) | |
tree | 6f4c55c2fb2fa66f18e8a560b88c4c179411104f | |
parent | tests: fix 10ddf-create (diff) | |
download | mdadm-023b89992a8e2398fa619619b74a69a5bf0227ca.tar.xz mdadm-023b89992a8e2398fa619619b74a69a5bf0227ca.zip |
tests: fix 09imsm-assemble
Refactor imsm_check_removal() to give mdadm a chance to remove the
device, add retries.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
-rw-r--r-- | tests/09imsm-assemble | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/09imsm-assemble b/tests/09imsm-assemble index d7028c62..9b04aa97 100644 --- a/tests/09imsm-assemble +++ b/tests/09imsm-assemble @@ -12,12 +12,23 @@ imsm_check_hold() { } imsm_check_removal() { - if ! mdadm --remove $1 $2 ; then - echo "$2 removal from $1 should have succeeded" >&2 - cat /proc/mdstat >&2 - mdadm -E $2 - exit 1 - fi + local ret=5 + local success=0 + + for ((i=1; i<=ret; i++)); do + if mdadm --remove "$1" "$2"; then + success=1 + break + fi + sleep 1 + done + + if [ $success -ne 1 ]; then + echo "$2 removal from $1 should have succeeded" >&2 + cat /proc/mdstat >&2 + mdadm -E "$2" + exit 1 + fi } export IMSM_DEVNAME_AS_SERIAL=1 |