Use _have_driver instead of _have_modules in _have_scsi_debug for the basic scsi_debug 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/scsi_debug | 14 ++++++++++---- tests/block/001 | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/common/scsi_debug b/common/scsi_debug index 95da14e..e9161d3 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -5,7 +5,7 @@ # scsi_debug helper functions. _have_scsi_debug() { - _have_modules scsi_debug + _have_driver scsi_debug } _init_scsi_debug() { @@ -18,8 +18,14 @@ _init_scsi_debug() { args+=(zbc=host-managed zone_nr_conv=0) fi - if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then - return 1 + if ((${#args[@]})); then + if ! modprobe -qr scsi_debug; then + exit 1 + fi + if ! modprobe scsi_debug "${args[@]}"; then + SKIP_REASON="scsi_debug not modular" + return 1 + fi fi udevadm settle @@ -60,5 +66,5 @@ _exit_scsi_debug() { unset SCSI_DEBUG_TARGETS unset SCSI_DEBUG_DEVICES udevadm settle - modprobe -r scsi_debug + modprobe -rq scsi_debug } diff --git a/tests/block/001 b/tests/block/001 index 5f05fa8..fb93932 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,7 +13,9 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_scsi_debug && _have_modules sd_mod sr_mod + _have_scsi_debug + _have_driver sd_mod + _have_driver sr_mod } stress_scsi_debug() { -- 2.30.2