]> www.infradead.org Git - users/hch/blktests.git/commit
common/rc: avoid module load in _have_driver()
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 23 Aug 2022 00:11:48 +0000 (09:11 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 29 Aug 2022 23:52:54 +0000 (08:52 +0900)
commit06a0ba866d90095777cb0831718fe73d24e8f8d4
tree8a850edd9b0a8b5b7b28143e14607896bcffd712
parent21f94b20a9af3bd2417886298a8b891c30fcf464
common/rc: avoid module load in _have_driver()

The helper function _have_driver() checks availability of the specified
driver, or module, regardless whether it is loadable or not. When the
driver is loadable, it loads the module for checking, but does not
unload it. This makes following test cases fail.

Such failure happens when nvmeof-mp test group is executed after nvme
test group with tcp transport. _have_driver() for tcp transport loads
nvmet and nvmet-tcp modules. nvmeof-mp test group tries to unload the
nvmet module but it fails because of dependency to the nvmet-tcp module.

To avoid the failure, do not load module in _have_driver() using -n
dry run option of the modprobe command. While at it, fix a minor problem
of modname '-' replacement. Currently, only the first '-' in modname is
replaced with '_'. Replace all '-'s.

Fixes: e9645877fbf0 ("common: add a helper if a driver is available")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
common/rc