From 7b048f6b43a7cb752bae44fbed0da8508b24b959 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 20 Jul 2017 12:15:06 +0200 Subject: [PATCH] tests: aus.sh fix md teardown Commit 8a912d6dbcc34ce2b76a0104c39de7aa0480c512 missed the wrong logic, we use 2 vars 'dev' & 'mddev' and their usage can't be mixed. So correctly separate them so mddev keeps name of MD device. --- test/lib/aux.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index e620e8126..b8a0cc074 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -778,10 +778,11 @@ cleanup_md_dev() { local IFS=$IFS_NL local dev - dev=$(< MD_DEV) + local mddev + mddev=$(< MD_DEV) udev_wait - mdadm --stop "$dev" || true - test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename "$dev")" + mdadm --stop "$mddev" || true + test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename "$mddev")" notify_lvmetad "$(< MD_DEV_PV)" udev_wait # wait till events are process, not zeroing to early for dev in $(< MD_DEVICES); do @@ -789,12 +790,12 @@ cleanup_md_dev() { notify_lvmetad "$dev" done udev_wait - if [ -b "$dev" ]; then + if [ -b "$mddev" ]; then # mdadm doesn't always cleanup the device node # sleeps offer hack to defeat: 'md: md127 still in use' # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25 sleep 2 - rm -f "$dev" + rm -f "$mddev" fi rm -f MD_DEV MD_DEVICES MD_DEV_PV }