From 07c1694ff59fd760a602fb1425c5c99bc0bd33ca Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 5 May 2016 21:00:42 +0200 Subject: [PATCH] tests: update aux raid support For raid1 use chunksize as bitmap-chunk specification. Always enforce usage of bitmap - getting comparable outcome as lvm2 raid support uses. Add udev_wait after stopping md array - as in fact leg-device are still in use by target even command has finished. (mdadm --stop causes WATCH rule wakeup, and ioctl(STOP_ARRAY) returns IMHO to early - it should finish and fsync work on leg devices first). --- test/lib/aux.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 08187b5cb..3bb469b87 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -659,6 +659,8 @@ prepare_md_dev() { rm -f debug.log strace.log MD_DEV MD_DEV_PV MD_DEVICES + coption="--chunk" + test "$level" = "1" && coption="--bitmap-chunk" # Have MD use a non-standard name to avoid colliding with an existing MD device # - mdadm >= 3.0 requires that non-standard device names be in /dev/md/ # - newer mdadm _completely_ defers to udev to create the associated device node @@ -668,7 +670,7 @@ prepare_md_dev() { mddev=/dev/md/md_lvm_test0 || \ mddev=/dev/md_lvm_test0 - mdadm --create --metadata=1.0 "$mddev" --auto=md --level $level --chunk $rchunk --raid-devices=$rdevs "${@:4}" || { + mdadm --create --metadata=1.0 "$mddev" --auto=md --level $level --bitmap=internal $coption=$rchunk --raid-devices=$rdevs "${@:4}" || { # Some older 'mdadm' version managed to open and close devices internaly # and reporting non-exclusive access on such device # let's just skip the test if this happens. @@ -707,6 +709,7 @@ cleanup_md_dev() { mdadm --stop "$dev" || true test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename $dev)" notify_lvmetad $(< MD_DEV_PV) + udev_wait # wait till events are process, not zeroing to early for dev in $(< MD_DEVICES); do mdadm --zero-superblock "$dev" || true notify_lvmetad "$dev" -- 2.43.5