]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/scsi_debug: Use _unload_module() instead of modprobe -r
authorBart Van Assche <bvanassche@acm.org>
Mon, 12 Jun 2023 19:52:28 +0000 (19:52 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 26 Jul 2023 19:15:40 +0000 (12:15 -0700)
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 <bvanassche@acm.org>
common/scsi_debug

index 60e7d639448b864177fa1c64000b2033a4aad979..bbdffd2ca4627e34a3a30cb660b096344c795a19 100644 (file)
@@ -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