]> www.infradead.org Git - users/hch/blktests.git/commit
check,common/rc: load module in _have_driver() and unload after test
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 1 Sep 2022 02:19:35 +0000 (11:19 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 2 Sep 2022 03:36:18 +0000 (12:36 +0900)
commit5c6aa7a0ae0bb032868699a052cb62f0316b08b4
tree345333a6421805a536fe0b7ffafed841b44c401c
parentc13c66ac86f1c5997855eae7585337f0122991cf
check,common/rc: load module in _have_driver() and unload after test

The commit 06a0ba866d90 ("common/rc: avoid module load in
_have_driver()") removed module load from _have_driver(). However, it
was pointed out no module load in _have_driver() is confusing and adds
complexity [1]. It requires explicit module loads and unloads in number
of test cases. The module unloads must be checked if unload is safe or
not. Also module load error must be handled. To avoid these complexity,
a new helper function would be required, but it will be look like the
_have_driver() with module load.

Then revert back the feature to load module in _have_driver(). To
address the issue that the commit 06a0ba866d90 tried to fix, record the
modules loaded by _have_driver() in MODULES_TO_UNLOAD array. Unload
the recorded modules after each test case processing completed. This
avoids the side-effect by the modules loaded by _have_driver().

[1] https://lore.kernel.org/linux-block/89aedf1d-ae08-adef-db29-17e5bf85d054@grimberg.me/

Fixes: 06a0ba866d90 ("common/rc: avoid module load in _have_driver()")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
check
common/rc