]> www.infradead.org Git - users/hch/blktests.git/commit
common/rc: ensure modules are loadable in _have_modules()
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 23 Aug 2022 00:11:50 +0000 (09:11 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 29 Aug 2022 23:52:54 +0000 (08:52 +0900)
commit8017ea524367b80b625c5eeb1aa4fccce02c5f76
treea05a5d4fe38b3934a6eb0b510a9fe8df50246a26
parent78271b8bb8c939e1d0b9cfa3ea321a4ed06635bd
common/rc: ensure modules are loadable in _have_modules()

The commit e9645877fbf0 ("common: add a helper if a driver is
available") introduced the helper function _have_driver() to check the
driver or module is available no matter whether it is a loadable module
or built-in module. It was assumed that _have_modules() whould check
that specified modules are loadable and not built-in.

However, the function _have_modules() returns true even if the specified
modules are built-in and not loadable. This causes failures of some test
cases on test system with built-in modules such as nbd/004. It also
means that _have_modules() and _have_driver() have same functionality.

To avoid the unexpected failures, fix _have_modules() to return false
when the specified modules are built-in. Check if loadable module file
exists by searching the module file path. If the module file does not
exist, return false. Also add comments to describe the difference
between _have_driver() and _have_modules().

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
common/rc