On Sun, Mar 15, 2020 at 03:13:17PM -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(). > > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > common/null_blk | 12 ++++++++---- > tests/block/022 | 3 --- > tests/block/029 | 1 - > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/common/null_blk b/common/null_blk > index 2e300c20bbc7..6a5f99aaae9d 100644 > --- a/common/null_blk > +++ b/common/null_blk > @@ -8,11 +8,14 @@ _have_null_blk() { > _have_modules null_blk > } > > +_remove_null_blk_devices() { > + local d > + > + for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done I'd prefer to keep the deletion code using find from _init_null_blk. > +} > + > _init_null_blk() { > - if [[ -d /sys/kernel/config/nullb ]]; then > - find /sys/kernel/config/nullb -mindepth 1 -maxdepth 1 \ > - -type d -delete > - fi > + _remove_null_blk_devices > > local zoned="" > if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi > @@ -27,5 +30,6 @@ _init_null_blk() { > > _exit_null_blk() { > udevadm settle > + _remove_null_blk_devices This needs to happen before the udevadm settle.