Re: [PATCH blktests v2 1/4] Make _exit_null_blk remove all null_blk device instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux