]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/ublk: avoid modprobe failure for built-in ublk_drv
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 5 Jul 2023 10:35:22 +0000 (19:35 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 14 Jul 2023 08:01:17 +0000 (17:01 +0900)
When ublk_drv driver is not a loadable module but a built-in module,
modprobe for the driver fails in _init_ublk. This results in unexpected
test case skips with the message "requires ublk_drv".

To not skip the test cases with built-in ublk_drv, call modprobe only
when the driver is loadable and its module file exists. Also, do not set
SKIP_REASONS to handle modprobe failure as test case failure.

Fixes: 840ccf1fc33e ("block/033: add test to cover gendisk leak")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/ublk

index 198c4db6144f058f0636f10c329954c99d8a26a0..8278d56df72f691eeacc88a53dda3afcdf89f9f2 100644 (file)
@@ -27,8 +27,7 @@ _init_ublk() {
        _remove_ublk_devices > /dev/null 2>&1
 
        modprobe -rq ublk_drv
-       if ! modprobe ublk_drv; then
-               SKIP_REASONS+=("requires ublk_drv")
+       if _module_file_exists ublk_drv && ! modprobe ublk_drv; then
                return 1
        fi