mbox series

[blktests,0/5] improve _have_driver() module load issue solution

Message ID 20220902034516.223173-1-shinichiro.kawasaki@wdc.com (mailing list archive)
Headers show
Series improve _have_driver() module load issue solution | expand

Message

Shinichiro Kawasaki Sept. 2, 2022, 3:45 a.m. UTC
The commit 06a0ba866d90 ("common/rc: avoid module load in _have_driver()")
removed module load from _have_driver(). However, it turned out that it was not
a good solution. In the recent discussion for module load preparation for nvme
test cases, it was pointed out no module load in _have_driver() is confusing and
adding complexity [1]:

 - Without module load in _have_driver(), explicit module load and unload are
   required in number of test cases. Boiler plates.
 - The module unload is not always safe. Need care if the module unload is
   expected or not.
 - The module load needs error handling.

I can think of a new helper function to address the comments above, but it will
look like _have_driver() with module load. Hence, I suggest to revert back some
part of the the commit 06a0ba866d90 to load modules in _have_driver() (Sorry
Christoph, Bart for doing this on the commit you reviewed). As a better
solution, I propose to record the modules loaded in _have_driver() and unload
them at each test case end, regardless of the test case is skipped or executed.
I confirmed this fix avoids the issue that the commit 06a0ba866d90 tried to fix.

In this series, 4th patch is the core change in _have_driver. 1st, 2nd and 3rd
patches are clean-up preparation patches for the 4th patch. 5th patch reverts
changes in nbd/rc, which is no longer required after the 4th patch.

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

Shin'ichiro Kawasaki (5):
  check: clean up _run_test()
  common,tests: rename unload_module() to _unload_module()
  check,common/rc: move _unload_module() from common/rc to check
  check,common/rc: load module in _have_driver() and unload after test
  Revert "nbd/rc: load nbd module explicitly"

 check                      | 36 +++++++++++++++++++++++++++++++-----
 common/multipath-over-rdma |  4 ++--
 common/rc                  | 26 ++++++++++----------------
 tests/nbd/rc               | 12 ++----------
 tests/nvmeof-mp/rc         | 12 ++++++------
 tests/srp/rc               |  8 ++++----
 6 files changed, 55 insertions(+), 43 deletions(-)