Message ID | 20200320222413.24386-2-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add a test that triggers the blk_mq_realloc_hw_ctxs() error path | expand |
On Fri, Mar 20, 2020 at 03:24:10PM -0700, Bart Van Assche wrote: > Instead of making every test remove null_blk device instances before calling > _exit_null_blk(), move the null_blk device instance removal code into > _exit_null_blk(). > > Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Daniel Wagner <dwagner@suse.de>
diff --git a/common/null_blk b/common/null_blk index 2e300c20bbc7..a4140e365955 100644 --- a/common/null_blk +++ b/common/null_blk @@ -8,11 +8,15 @@ _have_null_blk() { _have_modules null_blk } -_init_null_blk() { +_remove_null_blk_devices() { if [[ -d /sys/kernel/config/nullb ]]; then find /sys/kernel/config/nullb -mindepth 1 -maxdepth 1 \ -type d -delete fi +} + +_init_null_blk() { + _remove_null_blk_devices local zoned="" if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi @@ -26,6 +30,7 @@ _init_null_blk() { } _exit_null_blk() { + _remove_null_blk_devices udevadm settle modprobe -r null_blk } diff --git a/tests/block/022 b/tests/block/022 index 1404aacef295..b2c53e266d81 100755 --- a/tests/block/022 +++ b/tests/block/022 @@ -50,9 +50,6 @@ test() { wait $pid1 } 2>/dev/null - rmdir /sys/kernel/config/nullb/1 - rmdir /sys/kernel/config/nullb/0 - _exit_null_blk echo "Test complete" } diff --git a/tests/block/029 b/tests/block/029 index d298bac8db5c..0d521edb0cf6 100755 --- a/tests/block/029 +++ b/tests/block/029 @@ -58,7 +58,6 @@ test() { else echo "Skipping test because $sq cannot be modified" >>"$FULL" fi - rmdir /sys/kernel/config/nullb/nullb0 _exit_null_blk echo Passed }