From c547b1b78010ead573a2d3409830237cbc414807 Mon Sep 17 00:00:00 2001 From: Disha Goel Date: Wed, 26 Nov 2025 23:01:06 +0530 Subject: [PATCH] Skip tests if scsi_debug module is already loaded and in use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several tests across block/, scsi/, dm/, md/, zbd/, nvme/ require exclusive access to the scsi_debug module because they load, unload or reconfigure it. When scsi_debug is already loaded by the environment (e.g., by another driver or a previous setup), these tests fail with: modprobe: FATAL: Module scsi_debug is in use. Unloading scsi_debug failed scsi_debug 327680 4 Instead of modifying common rc files—which would overskip unrelated tests, this patch adds "_module_not_in_use scsi_debug" only to the tests that actually depend on exclusive access to scsi_debug. Signed-off-by: Disha Goel --- tests/block/001 | 1 + tests/block/002 | 1 + tests/block/025 | 1 + tests/block/027 | 1 + tests/block/028 | 1 + tests/block/032 | 1 + tests/block/037 | 1 + tests/dm/003 | 1 + tests/loop/004 | 1 + tests/md/004 | 1 + tests/nvme/065 | 1 + tests/scsi/004 | 1 + tests/scsi/007 | 1 + tests/scsi/010 | 1 + tests/throtl/rc | 1 + tests/zbd/008 | 1 + 16 files changed, 16 insertions(+) diff --git a/tests/block/001 b/tests/block/001 index 32dd22f8..37043a98 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -16,6 +16,7 @@ requires() { _have_scsi_debug _have_kernel_option BLK_DEV_SD _have_driver sr_mod + _module_not_in_use scsi_debug } stress_scsi_debug() { diff --git a/tests/block/002 b/tests/block/002 index 65b0fbdd..68091590 100755 --- a/tests/block/002 +++ b/tests/block/002 @@ -14,6 +14,7 @@ QUICK=1 requires() { _have_blktrace _have_scsi_debug + _module_not_in_use scsi_debug } test() { diff --git a/tests/block/025 b/tests/block/025 index 4c48e9f9..09d996f4 100755 --- a/tests/block/025 +++ b/tests/block/025 @@ -13,6 +13,7 @@ DESCRIPTION="do a huge discard with 4k sector size" requires() { _have_module scsi_debug + _module_not_in_use scsi_debug } test() { diff --git a/tests/block/027 b/tests/block/027 index f59dad2f..61475817 100755 --- a/tests/block/027 +++ b/tests/block/027 @@ -22,6 +22,7 @@ requires() { _have_cgroup2_controller io _have_scsi_debug _have_fio + _module_not_in_use scsi_debug } scsi_debug_stress_remove() { diff --git a/tests/block/028 b/tests/block/028 index 13b32787..db439094 100755 --- a/tests/block/028 +++ b/tests/block/028 @@ -13,6 +13,7 @@ DMESG_FILTER="sed -r 's/(guard tag error at sector|ref tag error at location)/bl requires() { _have_module scsi_debug + _module_not_in_use scsi_debug } test_pi() { diff --git a/tests/block/032 b/tests/block/032 index 5e25d0b0..90bdd47e 100755 --- a/tests/block/032 +++ b/tests/block/032 @@ -15,6 +15,7 @@ QUICK=1 requires() { _have_xfs _have_module scsi_debug + _module_not_in_use scsi_debug } test() { diff --git a/tests/block/037 b/tests/block/037 index 6ecbe373..332f2f83 100755 --- a/tests/block/037 +++ b/tests/block/037 @@ -20,6 +20,7 @@ QUICK=1 requires() { _have_cgroup2_controller io _have_scsi_debug + _module_not_in_use scsi_debug } scsi_debug_rebind() { diff --git a/tests/dm/003 b/tests/dm/003 index 35a3ad74..4c8c995b 100755 --- a/tests/dm/003 +++ b/tests/dm/003 @@ -13,6 +13,7 @@ QUICK=1 requires() { _have_scsi_debug + _module_not_in_use scsi_debug } setup_test_device() { diff --git a/tests/loop/004 b/tests/loop/004 index ca52d80b..e7e22158 100755 --- a/tests/loop/004 +++ b/tests/loop/004 @@ -15,6 +15,7 @@ requires() { _have_module scsi_debug _have_src_program loblksize _have_loop_set_block_size + _module_not_in_use scsi_debug } test() { diff --git a/tests/md/004 b/tests/md/004 index 9084066e..7292f84d 100755 --- a/tests/md/004 +++ b/tests/md/004 @@ -16,6 +16,7 @@ requires() { _have_scsi_debug _have_driver linear _have_driver raid0 + _module_not_in_use scsi_debug } setup_test_device() { diff --git a/tests/nvme/065 b/tests/nvme/065 index 38332732..b7e00afb 100755 --- a/tests/nvme/065 +++ b/tests/nvme/065 @@ -18,6 +18,7 @@ requires() { _have_scsi_debug _nvme_requires _require_nvme_trtype_is_loop + _module_not_in_use scsi_debug } setup_test_device() { diff --git a/tests/scsi/004 b/tests/scsi/004 index 7d0af544..c69c8db4 100755 --- a/tests/scsi/004 +++ b/tests/scsi/004 @@ -19,6 +19,7 @@ CAN_BE_ZONED=1 requires() { _have_scsi_debug + _module_not_in_use scsi_debug } test() { diff --git a/tests/scsi/007 b/tests/scsi/007 index a638e208..524435a5 100755 --- a/tests/scsi/007 +++ b/tests/scsi/007 @@ -13,6 +13,7 @@ QUICK=1 requires() { _have_module scsi_debug + _module_not_in_use scsi_debug } start_tracing() { diff --git a/tests/scsi/010 b/tests/scsi/010 index c5152a45..f41dd3d8 100755 --- a/tests/scsi/010 +++ b/tests/scsi/010 @@ -13,6 +13,7 @@ QUICK=1 requires() { _have_scsi_debug + _module_not_in_use scsi_debug } setup_test_device() { diff --git a/tests/throtl/rc b/tests/throtl/rc index d1afefd5..b2a470e7 100644 --- a/tests/throtl/rc +++ b/tests/throtl/rc @@ -24,6 +24,7 @@ group_requires() { _have_kernel_option BLK_DEV_THROTTLING _have_cgroup2_controller io _have_program bc + _module_not_in_use scsi_debug } _set_throtl_blkdev_type() { diff --git a/tests/zbd/008 b/tests/zbd/008 index 55b5b6ca..3af3de32 100755 --- a/tests/zbd/008 +++ b/tests/zbd/008 @@ -16,6 +16,7 @@ requires() { _have_module scsi_debug _have_module_param scsi_debug zbc _have_program xfs_io + _module_not_in_use scsi_debug } test() {