]> www.infradead.org Git - users/hch/blktests.git/commitdiff
nvme/005: Don't rely on modprobing to set the multipath paramater
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 17 Jul 2019 17:12:52 +0000 (11:12 -0600)
committerOmar Sandoval <osandov@osandov.com>
Mon, 29 Jul 2019 17:12:18 +0000 (10:12 -0700)
On test systems with existing nvme drives or built-in modules it may not
be possible to remove nvme-core in order to re-probe it with
multipath=1.

Instead, skip the test if the multipath parameter is not already set
ahead of time.

Note: the multipath parameter of nvme-core is set by default if
CONFIG_NVME_MULTIPATH is set so this will only affect systems
that explicitly disable it via the module parameter.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
common/rc
tests/nvme/005

index 5dd2c9512fd2a84353737f29e6dbb41815fb26da..a487cc69026c903a82e92a56bc4c5f338f6e1176 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -55,6 +55,24 @@ _have_module_param() {
        return 0
 }
 
+_have_module_param_value() {
+       local value
+
+       modprobe "$1"
+
+       if ! _have_module_param "$1" "$2"; then
+               return 1
+       fi
+
+       value=$(cat "/sys/module/$1/parameters/$2")
+       if [[ "${value}" != "$3" ]]; then
+               SKIP_REASON="$1 module parameter $2 must be set to $3"
+               return 1
+       fi
+
+       return 0
+}
+
 _have_program() {
        if command -v "$1" >/dev/null 2>&1; then
                return 0
index e72fc809c9368703f8a36b7df60c5943e00e055d..91c164de73e614bc2cb6f3ce9066552faac2870d 100755 (executable)
@@ -12,18 +12,13 @@ QUICK=1
 
 requires() {
        _have_modules loop nvme-core nvme-loop nvmet && \
-               _have_module_param nvme-core multipath && _have_configfs
+               _have_module_param_value nvme_core multipath Y && \
+               _have_configfs
 }
 
 test() {
        echo "Running ${TEST_NAME}"
 
-       # Clean up all stale modules
-       modprobe -r nvme-loop
-       modprobe -r nvme-core
-       modprobe -r nvmet
-
-       modprobe nvme-core multipath=1
        modprobe nvmet
        modprobe nvme-loop
 
@@ -57,7 +52,6 @@ test() {
        rm "$TMPDIR/img"
 
        modprobe -r nvme-loop
-       modprobe -r nvme-core
        modprobe -r nvmet
 
        echo "Test complete"