* [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use
@ 2026-03-24 5:49 Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 1/7] check: move fallback device handling into _check_and_call_test_device() Shin'ichiro Kawasaki
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
When blktests users have scsi_debug devices configured for purposes other than
blktests, running blktests currently unloads scsi_debug unconditionally and
breaks the existing setup. To avoid disrupting such configurations, this patch
series improves blktests to check whether the scsi_debug module is already
loaded and in use, and to skip test cases that require scsi_debug in that
situation.
This series was originally proposed as a GitHub Pull Request [1]. Disha Goel and
I worked on the patches. The first four patches fix pre-existing problems found
while working on this series. The fifth patch implements the improvement
described above. The last two patches fix two additional problems that were
found during this work.
[1] https://github.com/linux-blktests/blktests/pull/218
Disha Goel (1):
Skip tests if scsi_debug module is already loaded and in use
Shin'ichiro Kawasaki (6):
check: move fallback device handling into
_check_and_call_test_device()
check: call _unload_module() after fallback_device_cleanup()
check: do not create fallback device when other requirements are not
met
check: call fallback_device() in the same bash context
common/scsi_debug: ensure scsi_debug is loadable before loading it
zbd/012: add missing scsi_debug check
check | 84 ++++++++++++++++++++++++-----------------------
common/scsi_debug | 31 ++++++++++++++---
tests/block/009 | 2 +-
tests/block/025 | 2 +-
tests/block/028 | 2 +-
tests/block/032 | 2 +-
tests/loop/004 | 2 +-
tests/md/002 | 2 +-
tests/scsi/007 | 2 +-
tests/scsi/009 | 2 +-
tests/srp/rc | 2 +-
tests/zbd/008 | 2 +-
tests/zbd/009 | 2 +-
tests/zbd/010 | 2 +-
tests/zbd/012 | 1 +
15 files changed, 83 insertions(+), 57 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH blktests 1/7] check: move fallback device handling into _check_and_call_test_device()
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 2/7] check: call _unload_module() after fallback_device_cleanup() Shin'ichiro Kawasaki
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
Currently, when a test case has callback functions for fallback device,
the fallback device is created in run_test(). Meanwhile,
_unload_module() is called in _call_test(). Then,
cleanup_fallback_device() is called after _unload_module().
_run_test
fallback_device
_check_and_call_test_device
_call_test
_unload_modules
cleanup_fallback_device
This is not desired since module unload can affect
cleanup_fallback_device(). For example, scsi_debug is used as a fallback
device, _unload_modules() can unload scsi_debug before calling
cleanup_fallback_device().
To resolve this, make two changes. The first change is to move fallback
operations from _run_test() to _check_and_call_test_device(). This
commit does it. After this commit, the call chain will be as follows.
_run_test
_check_and_call_test_device
fallback_device
_call_test
_unload_modules
cleanup_fallback_device
As the second change, the following commit will move the
_unload_modules() call.
While at this change, rename the local variable FALLBACK_DEVICE to
'fallback', since capital letters imply that the variable would be
a global variable.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
check | 57 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 28 insertions(+), 29 deletions(-)
diff --git a/check b/check
index f170458..3fa3e97 100755
--- a/check
+++ b/check
@@ -716,14 +716,34 @@ _check_and_call_test() {
_check_and_call_test_device() {
local postfix
local unset_skip_reason
- local ret
+ local ret=0
+ local fallback=0
if declare -fF requires >/dev/null; then
requires
fi
+ if [[ ${#TEST_DEVS[@]} -eq 0 ]] && \
+ declare -fF fallback_device >/dev/null; then
+ TEST_DEVS[0]=fallback
+ fi
+
[[ -n $COND_DESC ]] && postfix=_${COND_DESC//[ =]/_}
for TEST_DEV in "${TEST_DEVS[@]}"; do
+ if [[ $TEST_DEV == fallback ]]; then
+ if ! TEST_DEV=$(fallback_device); then
+ _warning "$TEST_NAME: fallback_device call failure"
+ return 0
+ fi
+
+ if ! _find_sysfs_dirs "$TEST_DEV"; then
+ _warning "$TEST_NAME: could not find sysfs directory for ${TEST_DEV}"
+ cleanup_fallback_device
+ return 0
+ fi
+ fallback=1
+ fi
+
TEST_DEV_SYSFS="${TEST_DEV_SYSFS_DIRS["$TEST_DEV"]}"
TEST_DEV_PART_SYSFS="${TEST_DEV_PART_SYSFS_DIRS["$TEST_DEV"]}"
@@ -744,6 +764,13 @@ _check_and_call_test_device() {
if (( unset_skip_reason )); then
unset SKIP_REASONS
fi
+
+ if (( fallback )); then
+ cleanup_fallback_device
+ unset "TEST_DEV_SYSFS_DIRS[${TEST_DEV}]]"
+ unset "TEST_DEV_PART_SYSFS_DIRS[${TEST_DEV}]"
+ TEST_DEVS=()
+ fi
done
return $ret
@@ -825,7 +852,6 @@ _run_test() {
DMESG_FILTER="cat"
RUN_FOR_ZONED=0
COND_DESC=""
- FALLBACK_DEVICE=0
MODULES_TO_UNLOAD=()
local nr_conds cond_i
@@ -855,26 +881,6 @@ _run_test() {
ret=$?
fi
elif declare -fF test_device >/dev/null; then
- if [[ ${#TEST_DEVS[@]} -eq 0 ]] && \
- declare -fF fallback_device >/dev/null; then
- if ! test_dev=$(fallback_device); then
- _warning "$TEST_NAME: fallback_device call failure"
- return 0
- fi
-
- if ! _find_sysfs_dirs "$test_dev"; then
- _warning "$TEST_NAME: could not find sysfs directory for ${test_dev}"
- cleanup_fallback_device
- return 0
- fi
- TEST_DEVS=( "${test_dev}" )
- FALLBACK_DEVICE=1
- fi
-
- if [[ ${#TEST_DEVS[@]} -eq 0 ]]; then
- return 0
- fi
-
if declare -fF set_conditions >/dev/null; then
nr_conds=$(set_conditions)
for ((cond_i = 0; cond_i < nr_conds; cond_i++)); do
@@ -887,13 +893,6 @@ _run_test() {
_check_and_call_test_device
ret=$?
fi
-
- if (( FALLBACK_DEVICE )); then
- cleanup_fallback_device
- unset "TEST_DEV_SYSFS_DIRS[${TEST_DEVS[0]}]"
- unset "TEST_DEV_PART_SYSFS_DIRS[${TEST_DEVS[0]}]"
- TEST_DEVS=()
- fi
else
_check_and_call_test_device_array
ret=$?
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 2/7] check: call _unload_module() after fallback_device_cleanup()
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 1/7] check: move fallback device handling into _check_and_call_test_device() Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 3/7] check: do not create fallback device when other requirements are not met Shin'ichiro Kawasaki
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
As described in the commit message of the previous commit,
_unload_module() is called before calling cleanup_fallback_device().
Then, modules that is not cleaned up can be unloaded by _unload_module()
and can cause unload failures.
To avoid the failures, move _unload_module() call into
_check_and_call_test_device() so that it is called after the
cleanup_fallback_device() call. After this change, the call chain
becomes as follows:
_run_test
_check_and_call_test_device
fallback_device
_call_test
cleanup_fallback_device
_unload_modules
This change requires to add _unload_modules() call to
_check_and_call_test() and _check_and_call_test_device_array() also.
Fixes: 756d18d5fef0 ("check: call _unload_modules for each test run")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
check | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/check b/check
index 3fa3e97..91064d7 100755
--- a/check
+++ b/check
@@ -417,7 +417,7 @@ _cleanup() {
_exit_cgroup2
}
-__call_test() {
+_call_test() {
local test_func="$1"
local seqres="${RESULTS_DIR}/${TEST_NAME}"
# shellcheck disable=SC2034
@@ -537,17 +537,6 @@ __call_test() {
fi
}
-_call_test() {
- local ret
-
- __call_test "$@"
- ret=$?
-
- _unload_modules
-
- return $ret
-}
-
_test_dev_is_zoned() {
[[ -e "${TEST_DEV_SYSFS}/queue/zoned" &&
$(cat "${TEST_DEV_SYSFS}/queue/zoned") != none ]]
@@ -711,6 +700,7 @@ _check_and_call_test() {
[[ -n $COND_DESC ]] && postfix=_${COND_DESC//[ =]/_}
RESULTS_DIR="$OUTPUT/nodev${postfix}"
_call_test test
+ _unload_modules
}
_check_and_call_test_device() {
@@ -771,6 +761,8 @@ _check_and_call_test_device() {
unset "TEST_DEV_PART_SYSFS_DIRS[${TEST_DEV}]"
TEST_DEVS=()
fi
+
+ _unload_modules
done
return $ret
@@ -842,6 +834,7 @@ _check_and_call_test_device_array() {
unset "TEST_DEV_ARRAY_SYSFS_DIRS[${devs[i]}]"
done
+ _unload_modules
return $ret
}
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 3/7] check: do not create fallback device when other requirements are not met
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 1/7] check: move fallback device handling into _check_and_call_test_device() Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 2/7] check: call _unload_module() after fallback_device_cleanup() Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 4/7] check: call fallback_device() in the same bash context Shin'ichiro Kawasaki
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
Currently, fallback devices are prepared regardless of whether other
requirements are fulfilled. This is not always desired. For example,
when users already created scsi_debug devices, it is not good to create
a fallback scsi_debug device, because it unloads scsi_debug module and
remove the scsi_debug devices users created. To prevent such scenario,
confirm requirements by checking skip reasons before creating fallback
devices.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
check | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/check b/check
index 91064d7..fdc7ba7 100755
--- a/check
+++ b/check
@@ -721,6 +721,11 @@ _check_and_call_test_device() {
[[ -n $COND_DESC ]] && postfix=_${COND_DESC//[ =]/_}
for TEST_DEV in "${TEST_DEVS[@]}"; do
if [[ $TEST_DEV == fallback ]]; then
+ if [[ -v SKIP_REASONS ]]; then
+ _output_notrun "$TEST_NAME"
+ return 0
+ fi
+
if ! TEST_DEV=$(fallback_device); then
_warning "$TEST_NAME: fallback_device call failure"
return 0
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 4/7] check: call fallback_device() in the same bash context
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (2 preceding siblings ...)
2026-03-24 5:49 ` [PATCH blktests 3/7] check: do not create fallback device when other requirements are not met Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 5/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
Currently, the callback function fallback_device() is called with bash
$() feature. This runs the function call in a new bash context. Then,
global variable changes in the function call are not reflected in the
caller context. This is not handy and does not allow checking
MODULES_TO_UNLOAD status change in the caller, which will be added in
the following commit.
To share the same bash context between the caller and the callee of
fallback_device(), do not use $(). Instead, use a temporary file to keep
the output of fallback_device().
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
check | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/check b/check
index fdc7ba7..00213cb 100755
--- a/check
+++ b/check
@@ -708,6 +708,7 @@ _check_and_call_test_device() {
local unset_skip_reason
local ret=0
local fallback=0
+ local fb_dev_file
if declare -fF requires >/dev/null; then
requires
@@ -726,10 +727,14 @@ _check_and_call_test_device() {
return 0
fi
- if ! TEST_DEV=$(fallback_device); then
+ # Use a tmp file to keep bash context in fallback_device
+ fb_dev_file="${OUTPUT}/${TEST_NAME/\//_}_fallback_dev"
+ if ! fallback_device > "$fb_dev_file"; then
_warning "$TEST_NAME: fallback_device call failure"
return 0
fi
+ TEST_DEV=$(<"$fb_dev_file")
+ rm -f "$fb_dev_file"
if ! _find_sysfs_dirs "$TEST_DEV"; then
_warning "$TEST_NAME: could not find sysfs directory for ${TEST_DEV}"
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 5/7] Skip tests if scsi_debug module is already loaded and in use
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (3 preceding siblings ...)
2026-03-24 5:49 ` [PATCH blktests 4/7] check: call fallback_device() in the same bash context Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 6/7] common/scsi_debug: ensure scsi_debug is loadable before loading it Shin'ichiro Kawasaki
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
From: Disha Goel <disgoel@linux.ibm.com>
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 loadable and 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
To prevent these failures, this patch introduces a new helper function
_have_loadable_scsi_debug(). It verifies if the module is already loaded
by checking the ${MODULES_TO_UNLOAD[*]} array. If the module exists but
is not in the array, it indicates the module was loaded before the test
started, and the test is skipped.
Additionally, for cases where scsi_debug is built-in, the environment may
have already created additional hosts. To prevent the tests from disrupting
these hosts, _have_scsi_debug() now checks the add_host attribute. If the
number of hosts is greater than 1, the test is skipped.
Link: https://github.com/linux-blktests/blktests/pull/218
Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/scsi_debug | 29 +++++++++++++++++++++++++----
tests/block/009 | 2 +-
tests/block/025 | 2 +-
tests/block/028 | 2 +-
tests/block/032 | 2 +-
tests/loop/004 | 2 +-
tests/md/002 | 2 +-
tests/scsi/007 | 2 +-
tests/scsi/009 | 2 +-
tests/srp/rc | 2 +-
tests/zbd/008 | 2 +-
tests/zbd/009 | 2 +-
tests/zbd/010 | 2 +-
13 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/common/scsi_debug b/common/scsi_debug
index 8964558..97a65c2 100644
--- a/common/scsi_debug
+++ b/common/scsi_debug
@@ -4,13 +4,34 @@
#
# scsi_debug helper functions.
-_have_scsi_debug() {
- _have_driver scsi_debug
-}
-
SD_PARAM_PATH=/sys/module/scsi_debug/parameters
SD_PSEUDO_PATH=/sys/bus/pseudo/drivers/scsi_debug
+_have_scsi_debug() {
+ _have_driver scsi_debug
+
+ if _module_file_exists scsi_debug; then
+ _have_loadable_scsi_debug
+ return $?
+ fi
+
+ if [[ -e "$SD_PSEUDO_PATH/add_host" ]] && \
+ [[ $(cat "$SD_PSEUDO_PATH/add_host") -gt 1 ]]; then
+ SKIP_REASONS+=("scsi_debug already has multiple hosts configured")
+ return 1
+ fi
+}
+
+_have_loadable_scsi_debug() {
+ _have_module scsi_debug || return 1
+
+ if [[ -d /sys/module/scsi_debug ]] && \
+ [[ ! ${MODULES_TO_UNLOAD[*]} =~ scsi_debug ]]; then
+ SKIP_REASONS+=("scsi_debug is already loaded before test")
+ return 1
+ fi
+}
+
_scsi_debug_key_path() {
local key=${1}
diff --git a/tests/block/009 b/tests/block/009
index 7256afc..8995646 100755
--- a/tests/block/009
+++ b/tests/block/009
@@ -12,7 +12,7 @@
DESCRIPTION="check page-cache coherency after BLKDISCARD"
requires() {
- _have_module scsi_debug
+ _have_loadable_scsi_debug
_have_program xfs_io
}
diff --git a/tests/block/025 b/tests/block/025
index 4c48e9f..6582fa3 100755
--- a/tests/block/025
+++ b/tests/block/025
@@ -12,7 +12,7 @@
DESCRIPTION="do a huge discard with 4k sector size"
requires() {
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
test() {
diff --git a/tests/block/028 b/tests/block/028
index 13b3278..c03ad6c 100755
--- a/tests/block/028
+++ b/tests/block/028
@@ -12,7 +12,7 @@ DESCRIPTION="do I/O on scsi_debug with DIF/DIX enabled"
DMESG_FILTER="sed -r 's/(guard tag error at sector|ref tag error at location)/blktests failure: \\1/'"
requires() {
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
test_pi() {
diff --git a/tests/block/032 b/tests/block/032
index 5e25d0b..7f89a15 100755
--- a/tests/block/032
+++ b/tests/block/032
@@ -14,7 +14,7 @@ QUICK=1
requires() {
_have_xfs
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
test() {
diff --git a/tests/loop/004 b/tests/loop/004
index ca52d80..fc7e4b0 100755
--- a/tests/loop/004
+++ b/tests/loop/004
@@ -12,7 +12,7 @@ QUICK=1
requires() {
_have_program xfs_io
- _have_module scsi_debug
+ _have_loadable_scsi_debug
_have_src_program loblksize
_have_loop_set_block_size
}
diff --git a/tests/md/002 b/tests/md/002
index 1349a18..e1da8b6 100755
--- a/tests/md/002
+++ b/tests/md/002
@@ -12,7 +12,7 @@ DESCRIPTION="test md atomic writes"
QUICK=1
requires() {
- _have_driver scsi_debug
+ _have_scsi_debug
_stacked_atomic_test_requires
}
diff --git a/tests/scsi/007 b/tests/scsi/007
index a638e20..8a8d4ea 100755
--- a/tests/scsi/007
+++ b/tests/scsi/007
@@ -12,7 +12,7 @@ DESCRIPTION="Trigger the SCSI error handler"
QUICK=1
requires() {
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
start_tracing() {
diff --git a/tests/scsi/009 b/tests/scsi/009
index 8860e1c..41a5152 100755
--- a/tests/scsi/009
+++ b/tests/scsi/009
@@ -12,7 +12,7 @@ DESCRIPTION="test scsi atomic writes"
QUICK=1
requires() {
- _have_driver scsi_debug
+ _have_scsi_debug
_have_xfs_io_atomic_write
}
diff --git a/tests/srp/rc b/tests/srp/rc
index 8585272..03fe55a 100755
--- a/tests/srp/rc
+++ b/tests/srp/rc
@@ -58,7 +58,7 @@ group_requires() {
_have_kver 5 5
_have_iproute2 190404
fi
- _have_module scsi_debug
+ _have_loadable_scsi_debug
_have_module target_core_iblock
_have_module target_core_mod
_module_not_in_use scsi_transport_srp
diff --git a/tests/zbd/008 b/tests/zbd/008
index 55b5b6c..cdfbedf 100755
--- a/tests/zbd/008
+++ b/tests/zbd/008
@@ -13,7 +13,7 @@ DESCRIPTION="check no stale page cache after BLKZONERESET and data read race"
TIMED=1
requires() {
- _have_module scsi_debug
+ _have_loadable_scsi_debug
_have_module_param scsi_debug zbc
_have_program xfs_io
}
diff --git a/tests/zbd/009 b/tests/zbd/009
index b268483..a36ad71 100755
--- a/tests/zbd/009
+++ b/tests/zbd/009
@@ -36,7 +36,7 @@ requires() {
_have_driver btrfs
_have_module_param scsi_debug zone_cap_mb
_have_program mkfs.btrfs && have_good_mkfs_btrfs
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
test() {
diff --git a/tests/zbd/010 b/tests/zbd/010
index c5cb76a..cb7202c 100755
--- a/tests/zbd/010
+++ b/tests/zbd/010
@@ -15,7 +15,7 @@ requires() {
_have_module null_blk
_have_module_param scsi_debug zone_cap_mb
_have_program mkfs.f2fs
- _have_module scsi_debug
+ _have_loadable_scsi_debug
}
test() {
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 6/7] common/scsi_debug: ensure scsi_debug is loadable before loading it
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (4 preceding siblings ...)
2026-03-24 5:49 ` [PATCH blktests 5/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 7/7] zbd/012: add missing scsi_debug check Shin'ichiro Kawasaki
2026-04-04 8:06 ` [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
Currently, _have_scsi_debug_group_number_stats() assumes that scsi_debug
is loadable. This does not work when scsi_debug is built-in. Before
loading scsi_debug in the function, ensure that scsi_debug is loadable.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/scsi_debug | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common/scsi_debug b/common/scsi_debug
index 97a65c2..6aa7420 100644
--- a/common/scsi_debug
+++ b/common/scsi_debug
@@ -49,6 +49,8 @@ _scsi_debug_key_path() {
_have_scsi_debug_group_number_stats() {
local ret=0
+ _have_loadable_scsi_debug || return 1
+
modprobe -qr scsi_debug >&/dev/null
modprobe -q scsi_debug delay=0 >&/dev/null
if ! [[ -e ${SD_PSEUDO_PATH}/group_number_stats ]]; then
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 7/7] zbd/012: add missing scsi_debug check
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (5 preceding siblings ...)
2026-03-24 5:49 ` [PATCH blktests 6/7] common/scsi_debug: ensure scsi_debug is loadable before loading it Shin'ichiro Kawasaki
@ 2026-03-24 5:49 ` Shin'ichiro Kawasaki
2026-04-04 8:06 ` [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-03-24 5:49 UTC (permalink / raw)
To: linux-block; +Cc: Shin'ichiro Kawasaki
The test case uses loadable scsi_debug, but it misses the check for it.
Add the missing check.
Fixes: 3ca2657f94b8 ("zbd/012: Test requeuing of zoned writes and queue freezing")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/zbd/012 | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/zbd/012 b/tests/zbd/012
index b2bda5c..c2e47f3 100755
--- a/tests/zbd/012
+++ b/tests/zbd/012
@@ -13,6 +13,7 @@ TIMED=1
requires() {
_have_fio_zbd_zonemode
+ _have_loadable_scsi_debug
}
toggle_iosched() {
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
` (6 preceding siblings ...)
2026-03-24 5:49 ` [PATCH blktests 7/7] zbd/012: add missing scsi_debug check Shin'ichiro Kawasaki
@ 2026-04-04 8:06 ` Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Shinichiro Kawasaki @ 2026-04-04 8:06 UTC (permalink / raw)
To: linux-block@vger.kernel.org; +Cc: disgoel@linux.ibm.com
On Mar 24, 2026 / 14:49, Shin'ichiro Kawasaki wrote:
> When blktests users have scsi_debug devices configured for purposes other than
> blktests, running blktests currently unloads scsi_debug unconditionally and
> breaks the existing setup. To avoid disrupting such configurations, this patch
> series improves blktests to check whether the scsi_debug module is already
> loaded and in use, and to skip test cases that require scsi_debug in that
> situation.
>
> This series was originally proposed as a GitHub Pull Request [1]. Disha Goel and
> I worked on the patches. The first four patches fix pre-existing problems found
> while working on this series. The fifth patch implements the improvement
> described above. The last two patches fix two additional problems that were
> found during this work.
FYI, I applied this series.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-04-04 8:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 5:49 [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 1/7] check: move fallback device handling into _check_and_call_test_device() Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 2/7] check: call _unload_module() after fallback_device_cleanup() Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 3/7] check: do not create fallback device when other requirements are not met Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 4/7] check: call fallback_device() in the same bash context Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 5/7] Skip tests if scsi_debug module is already loaded and in use Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 6/7] common/scsi_debug: ensure scsi_debug is loadable before loading it Shin'ichiro Kawasaki
2026-03-24 5:49 ` [PATCH blktests 7/7] zbd/012: add missing scsi_debug check Shin'ichiro Kawasaki
2026-04-04 8:06 ` [PATCH blktests 0/7] Skip tests if scsi_debug module is already loaded and in use Shinichiro Kawasaki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.