From: Bart Van Assche Date: Mon, 12 Jun 2023 19:52:28 +0000 (+0000) Subject: common/scsi_debug: Use _unload_module() instead of modprobe -r X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dd9a329e4896639d1c72283bcf1e417c100556ea;p=users%2Fsagi%2Fblktests.git common/scsi_debug: Use _unload_module() instead of modprobe -r It may happen that unloading the scsi_debug kernel module fails a few times before it finally succeeds. Fix this by using _unload_module instead of modprobe -r. Signed-off-by: Bart Van Assche --- diff --git a/common/scsi_debug b/common/scsi_debug index 60e7d63..bbdffd2 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -85,7 +85,12 @@ _init_scsi_debug() { args+=(zbc=host-managed zone_nr_conv=0) fi - if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then + if ! _unload_module scsi_debug 10; then + echo "Unloading scsi_debug failed" >&2 + return 1 + fi + if ! modprobe scsi_debug "${args[@]}"; then + echo "Loading scsi_debug ${args[*]} failed" >&2 return 1 fi