Use _have_driver instead of _have_modules in _have_null_blk for the basic null_blk check, and instead only require an actual module in _init_null_blk when specific module parameters are passed. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- common/null_blk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/null_blk b/common/null_blk index 6611db0..ccf3750 100644 --- a/common/null_blk +++ b/common/null_blk @@ -5,7 +5,7 @@ # null_blk helper functions. _have_null_blk() { - _have_modules null_blk + _have_driver null_blk } _remove_null_blk_devices() { @@ -16,15 +16,19 @@ _remove_null_blk_devices() { } _init_null_blk() { - _remove_null_blk_devices + local modparams="$@" - local zoned="" - if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi + if (( RUN_FOR_ZONED )); then + modparams="${modparams} zoned=1" + fi - if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then + if [ -n "${modparams}" ] && ! _have_modules null_blk; then return 1 fi + _remove_null_blk_devices + modprobe -qr null_blk && modprobe -q null_blk ${modparams} + udevadm settle return 0 } @@ -46,5 +50,5 @@ _configure_null_blk() { _exit_null_blk() { _remove_null_blk_devices udevadm settle - modprobe -r null_blk + modprobe -qr null_blk } -- 2.30.2