Re: allow to run most tests with built-in null_blk

Shinichiro Kawasaki
2022-06-06T11:44:45Z

On Jun 03, 2022 / 06:55, Christoph Hellwig wrote:
> Hi Shin'ichiro,
>
> this series updates most tests that use null_blk so that they can
> work with a built-in null_blk driver. The onces that require
> shared_tags or failure injection, which currently can only be
> controlled through module parameters still require a module until
> the kernel is updated (which I plan to look into).

Hi Christoph,

Thanks for the series. I ran tests with this series in my test system and found
two problems. Could you revise the series to address them?

1) null_blk built-in: some test cases fail with modprobe message

With the series and null_blk driver built-in, I still observe a number of test
cases with null_blk fail. The error message was follows:

+modprobe: FATAL: Module null_blk is builtin.

I found the modprobe -r command in _exit_null_blk() reports the message. With
the additional hank below, the message goes away and I observe many passes.

diff --git a/common/null_blk b/common/null_blk
index c82327d..a435147 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -54,5 +54,5 @@ _configure_null_blk() {
_exit_null_blk() {
_remove_null_blk_devices
udevadm settle
- modprobe -r null_blk
+ modprobe -qr null_blk
}

I guess the hank was just slipped out from one of your patches. 2nd patch,
probably.

2) null_blk module: block/023 and other test cases with CAN_BE_ZONED=1 fail

The test cases fail with this message:

mkdir: cannot create directory ‘/sys/kernel/config/nullb/nullb1’: No such file or directory

If null_blk is a module, _configure_null_blk assumes that the module is already
loaded. This is true for most of the test cases since _have_null_blk called in
requires() loads the module. But it is not true for block/023 since this test
case repeats _configure_null_blk and _exit_null_blk in a loop. At the 2nd and
later repetition of the loop, _exit_null_blk unloaded null_blk module and the
assumption is broken. Hence the error.

Also, when RUN_ZONED_TESTS=1 is set in config, test cases with CAN_BE_ZONED=1,
(block/{006,016,017,020,021,023}), repeats the test case twice, once for regular
null_blk and 2nd for zoned null_blk. The 2nd run with zoned_null_blk fails with
the symptom above.

I suggest to add one more commit as follows. It makes _configure_null_blk check
that null_blk module is loaded. If not, loades the module.

diff --git a/common/null_blk b/common/null_blk
index a435147..6be1081 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -36,6 +36,8 @@ _init_null_blk() {
_configure_null_blk() {
local nullb=/sys/kernel/config/nullb/$1 param val

+ [[ ! -d /sys/module/null_blk ]] && modprobe -q null_blk
+
shift
mkdir "$nullb" || return $?

On top of the two problems above, I made comments on the last patch. Other than
that, the series looks good to me. Thanks!

--
Shin'ichiro Kawasaki