]> www.infradead.org Git - users/hch/blktests.git/log
users/hch/blktests.git
2 years agozbd/009: check mkfs.btrfs version
Shin'ichiro Kawasaki [Mon, 8 Aug 2022 01:44:07 +0000 (10:44 +0900)]
zbd/009: check mkfs.btrfs version

mkfs.btrfs versions from 5.17 to 5.18.x fail to format zoned block
devices without option '-m single' [1]. Skip the test case when
mkfs.btrfs has the versions.

[1] https://lore.kernel.org/linux-btrfs/cover.1659426744.git.wqu@suse.com/

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoMerge pull request #99 from bvanassche/master
Shin'ichiro Kawasaki [Mon, 15 Aug 2022 08:19:45 +0000 (17:19 +0900)]
Merge pull request #99 from bvanassche/master

tests/scsi: Add tests for SCSI devices with gap zones

2 years agosrc/mount_clear_sock.c: fix compiling error
Yi Zhang [Mon, 8 Aug 2022 10:36:23 +0000 (18:36 +0800)]
src/mount_clear_sock.c: fix compiling error

<linux/mount.h> and <sys/mount.h> are known pairs of headers that conflict
See https://sourceware.org/glibc/wiki/Synchronizing_Headers
$ make
make -C src all
make[1]: Entering directory '/root/blktests/src'
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H -o mount_clear_sock mount_clear_sock.c
In file included from /usr/include/linux/fs.h:19,
                 from mount_clear_sock.c:15:
/usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
   95 | enum fsconfig_command {
      |      ^~~~~~~~~~~~~~~~
In file included from mount_clear_sock.c:11:
/usr/include/sys/mount.h:189:6: note: originally defined here
  189 | enum fsconfig_command
      |      ^~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FLAG’
   96 |         FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:191:3: note: previous definition of ‘FSCONFIG_SET_FLAG’ with type ‘enum fsconfig_command’
  191 |   FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:97:9: error: redeclaration of enumerator ‘FSCONFIG_SET_STRING’
   97 |         FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:193:3: note: previous definition of ‘FSCONFIG_SET_STRING’ with type ‘enum fsconfig_command’
  193 |   FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:98:9: error: redeclaration of enumerator ‘FSCONFIG_SET_BINARY’
   98 |         FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:195:3: note: previous definition of ‘FSCONFIG_SET_BINARY’ with type ‘enum fsconfig_command’
  195 |   FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:99:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH’
   99 |         FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:197:3: note: previous definition of ‘FSCONFIG_SET_PATH’ with type ‘enum fsconfig_command’
  197 |   FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:100:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH_EMPTY’
  100 |         FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:199:3: note: previous definition of ‘FSCONFIG_SET_PATH_EMPTY’ with type ‘enum fsconfig_command’
  199 |   FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:101:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FD’
  101 |         FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |         ^~~~~~~~~~~~~~~
/usr/include/sys/mount.h:201:3: note: previous definition of ‘FSCONFIG_SET_FD’ with type ‘enum fsconfig_command’
  201 |   FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |   ^~~~~~~~~~~~~~~
/usr/include/linux/mount.h:102:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_CREATE’
  102 |         FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:203:3: note: previous definition of ‘FSCONFIG_CMD_CREATE’ with type ‘enum fsconfig_command’
  203 |   FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:103:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_RECONFIGURE’
  103 |         FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:205:3: note: previous definition of ‘FSCONFIG_CMD_RECONFIGURE’ with type ‘enum fsconfig_command’
  205 |   FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:129:8: error: redefinition of ‘struct mount_attr’
  129 | struct mount_attr {
      |        ^~~~~~~~~~
/usr/include/sys/mount.h:161:8: note: originally defined here
  161 | struct mount_attr
      |        ^~~~~~~~~~

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme/040: fix device file path
Shin'ichiro Kawasaki [Fri, 29 Jul 2022 00:15:05 +0000 (09:15 +0900)]
nvme/040: fix device file path

The test case nvme/040 performs I/O to a nvmf device file. However, it
specifies wrong path to the device file then the I/O is done to a
regular file. Hence fix the path.

Fixes: ebf197d1aea4 ("nvme: add nvmf reset/disconnect during traffic test")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
2 years agotests/zbd: Add tests for SCSI devices with gap zones
Bart Van Assche [Thu, 21 Apr 2022 17:43:15 +0000 (10:43 -0700)]
tests/zbd: Add tests for SCSI devices with gap zones

Verify that I/O on top of BTRFS or F2FS on top of zoned scsi_debug works
fine if gap zones are present.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agoblock/002: remove debugfs check while blktrace is running
Yi Zhang [Sat, 30 Jul 2022 07:58:28 +0000 (15:58 +0800)]
block/002: remove debugfs check while blktrace is running

See kernel commit: 99d055b4fd4b ("block: remove per-disk debugfs files
in blk_unregister_queue")

This fix avoids the test case failure observed since the kernel commit
0a9a25ca7843 ("block: let blkcg_gq grab request queue's refcnt").

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[Shin'ichiro: improved commit message]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/008: avoid _offline_cpu() call in sub-shell
Shin'ichiro Kawasaki [Mon, 4 Jul 2022 11:16:38 +0000 (20:16 +0900)]
block/008: avoid _offline_cpu() call in sub-shell

The helper function _offline_cpu() sets a value to RESTORE_CPUS_ONLINE.
However, the commit bd6b882b2650 ("block/008: check CPU offline failure
due to many IRQs") put _offline_cpu() call in sub-shell, then the set
value to RESTORE_CPUS_ONLINE no longer affects function caller's
environment. This resulted in offlined CPUs not restored by _cleanup()
when the test case block/008 calls only _offline_cpu() and does not call
_online_cpu().

To fix the issue, avoid _offline_cpu() call in sub-shell. Use file
redirect to get output of _offline_cpu() instead of sub-shell execution.

Fixes: bd6b882b2650 ("block/008: check CPU offline failure due to many IRQs")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Link: https://lore.kernel.org/linux-block/20220703180956.2922025-1-yi.zhang@redhat.com/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoRevert "common/cpuhotplug: allow _offline_cpu() call in sub-shell"
Shin'ichiro Kawasaki [Wed, 27 Jul 2022 01:54:54 +0000 (10:54 +0900)]
Revert "common/cpuhotplug: allow _offline_cpu() call in sub-shell"

This reverts commit 107256dc53d55f558e349e463a5a99c3bb6b4189.

The commit makes block/008 fail when multiple devices are set as
TEST_DEVS.

Link: https://lore.kernel.org/linux-block/CAHj4cs_XGXhHZsipb-BA2O_acaeBjDXa-CDfY771=a_GfEaU6w@mail.gmail.com/
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/cpuhotplug: allow _offline_cpu() call in sub-shell
Shin'ichiro Kawasaki [Tue, 19 Jul 2022 02:52:16 +0000 (11:52 +0900)]
common/cpuhotplug: allow _offline_cpu() call in sub-shell

The helper function _offline_cpu() sets a value to RESTORE_CPUS_ONLINE.
However, the commit bd6b882b2650 ("block/008: check CPU offline failure
due to many IRQs") put _offline_cpu() call in sub-shell, then the set
value to RESTORE_CPUS_ONLINE no longer affects function caller's
environment. This resulted in off-lined CPUs not restored by _cleanup()
when the test case block/008 calls only _offline_cpu() and does not call
_online_cpu().

To fix the issue, set RESTORE_CPUS_ONLINE in _have_cpu_hotplug() in
place of _offline_cpu(). _have_cpu_hotplug() is less likely to be called
in sub-shell. In same manner, do not set RESTORE_CPUS_ONLINE in
_online_cpu() either. Check that RESTORE_CPUS_ONLINE is set in
_offline_cpu() to avoid unexpected CPUs left off-lined. This check also
avoids a shellcheck warning.

Fixes: bd6b882b2650 ("block/008: check CPU offline failure due to many IRQs")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonew: fix test case addition to new test group
Shin'ichiro Kawasaki [Tue, 19 Jul 2022 03:10:36 +0000 (12:10 +0900)]
new: fix test case addition to new test group

The "new" script adds script files for a new test case to the specified
test group. However, this file addition fails when the user specifies
non-existing new test group name as the target test group. The failure
happens because the "new" script assumes the target test group directory
has at least one test case, but this is not true when a new group is
created. Fix this by checking the existence of the test cases in the
target test group.

Fixes: b1e29e775872 ("Create test name from most recently used test number")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
2 years agonbd: add a module load and device connect test
Sun Ke [Tue, 19 Jul 2022 07:12:16 +0000 (15:12 +0800)]
nbd: add a module load and device connect test

This is a regression test for commit 06c4da89c24e
nbd: call genl_unregister_family() first in nbd_cleanup()

Two concurrent processes,one load and unload nbd module
cyclically, the other one connect and disconnect nbd device cyclically.
Last for 10 seconds.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme/rc: replace SKIP_REASON with SKIP_REASONS
Shin'ichiro Kawasaki [Fri, 22 Jul 2022 00:28:02 +0000 (09:28 +0900)]
nvme/rc: replace SKIP_REASON with SKIP_REASONS

The commit 5c2012764cbc (common, tests: Print multiple skip reasons)
changed the variable SKIP_REASON to the array SKIP_REASONS. The commit
e9828f1646cd ("nvme/rc: Fixup SKIP_REASON usage") changed SKIP_REASON
usage from variable to array, but did not change the name. Just add 'S'
to fix it.

Fixes: e9828f1646cd ("nvme/rc: Fixup SKIP_REASON usage")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoMerge pull request #98 from hreinecke/auth.v7
Shin'ichiro Kawasaki [Fri, 22 Jul 2022 00:26:45 +0000 (09:26 +0900)]
Merge pull request #98 from hreinecke/auth.v7

Testsuite for nvme in-band authentication

2 years agonvme/rc: Fixup SKIP_REASON usage
Hannes Reinecke [Wed, 20 Jul 2022 16:23:26 +0000 (18:23 +0200)]
nvme/rc: Fixup SKIP_REASON usage

SKIP_REASON can't be set directly, but rather has to be appended to.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/045: test re-authentication
Hannes Reinecke [Fri, 12 Nov 2021 14:39:21 +0000 (15:39 +0100)]
nvme/045: test re-authentication

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/044: test bi-directional authentication
Hannes Reinecke [Thu, 30 Sep 2021 14:03:24 +0000 (16:03 +0200)]
nvme/044: test bi-directional authentication

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/043: test hash and dh group variations for authenticated connections
Hannes Reinecke [Thu, 30 Sep 2021 13:52:36 +0000 (15:52 +0200)]
nvme/043: test hash and dh group variations for authenticated connections

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/042: test dhchap key types for authenticated connections
Hannes Reinecke [Thu, 30 Sep 2021 12:57:40 +0000 (14:57 +0200)]
nvme/042: test dhchap key types for authenticated connections

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/041: create authenticated connections
Hannes Reinecke [Thu, 30 Sep 2021 12:19:30 +0000 (14:19 +0200)]
nvme/041: create authenticated connections

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/rc: add more arguments to _nvme_connect_subsys()
Hannes Reinecke [Mon, 22 Nov 2021 15:22:25 +0000 (16:22 +0100)]
nvme/rc: add more arguments to _nvme_connect_subsys()

Add optional arguments for setting 'hostnqn', 'hostid', 'hostkey',
and 'ctrlkey' to _nvme_connect_subsys() to make it usable for
testing nvme in-band authentication.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/rc: add functions for in-band authentication
Hannes Reinecke [Fri, 19 Nov 2021 12:33:42 +0000 (13:33 +0100)]
nvme/rc: add functions for in-band authentication

Add functions to enable in-band authentication.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/rc: clear hosts directory in _cleanup_nvmet()
Hannes Reinecke [Mon, 22 Nov 2021 15:15:32 +0000 (16:15 +0100)]
nvme/rc: clear hosts directory in _cleanup_nvmet()

When clearing out the configuration we need to clear the 'hosts'
directory, too, as scripts might have added host configurations.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/rc: clear allowed_hosts subdirectory
Hannes Reinecke [Fri, 19 Nov 2021 12:23:34 +0000 (13:23 +0100)]
nvme/rc: clear allowed_hosts subdirectory

When removing a subsystem we need to clear out the allowed_hosts
subdirectory, otherwise removal will fail.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
2 years agonvme/rc: do not print error message when no nvme device is found
Hannes Reinecke [Fri, 19 Nov 2021 12:21:40 +0000 (13:21 +0100)]
nvme/rc: do not print error message when no nvme device is found

_find_nvme_dev() will only print an nvme device node if one is found,
so no point in printing an error message.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
2 years agotests/nvme: Set clear_ids for passthru targets
Alan Adamson [Tue, 5 Jul 2022 20:56:31 +0000 (13:56 -0700)]
tests/nvme: Set clear_ids for passthru targets

This allows to connect to passthru targets when the client and target
are on the same host.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
[Shin'ichiro: replaced single bracket with double brackets]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon, tests: Print multiple skip reasons
lizhijian@fujitsu.com [Wed, 13 Jul 2022 12:12:05 +0000 (12:12 +0000)]
common, tests: Print multiple skip reasons

Some test cases or test groups have rather large number of test
run requirements and then they may have multiple skip reasons. However,
blktests can report only single skip reason. To know all of the skip
reasons, we need to repeat skip reason resolution and blktests run.
This is a troublesome work.

In this patch, we add skip reasons to SKIP_REASONS array, then all of
the skip reasons will be printed by iterating SKIP_REASONS at one shot
run.

Most of the works are done by following script:

sed -i 's/SKIP_REASON/SKIP_REASONS/' $(git ls-files)
git grep -h 'SKIP_REASONS=' | awk -F'SKIP_REASONS=' '{print $2}' | sort | uniq |
while read -r r
do
s="SKIP_REASONS=$r"
f=$(git grep -l "$s")
sed -i "s@$s@SKIP_REASONS+=($r)@" $f
done

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme: add nvmf reset/disconnect during traffic test
Sagi Grimberg [Thu, 30 Jun 2022 15:44:44 +0000 (18:44 +0300)]
nvme: add nvmf reset/disconnect during traffic test

Test traffic controller reset and disconnect during traffic.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
Link: https://lore.kernel.org/linux-nvme/20220630154444.475600-1-sagi@grimberg.me/
[Shin'ichiro: removed kill and wait for fio job, fixed shellcheck warnings]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/007: support fallback device
Shin'ichiro Kawasaki [Fri, 3 Jun 2022 08:31:15 +0000 (17:31 +0900)]
block/007: support fallback device

The test case block/007 requires TEST_DEVS which support IO polling.
To allow test case executed without such devices, fallback to a null_blk
device when TEST_DEVS is empty.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/multipath-over-rdma: skip NO-CARRIER NIC when start_soft_rdma
Yi Zhang [Thu, 30 Jun 2022 09:56:25 +0000 (17:56 +0800)]
common/multipath-over-rdma: skip NO-CARRIER NIC when start_soft_rdma

The rxe/siw driver will be bind to NO-CARRIER interface which lead
nvmeof-mp/001 failed.
For example, nvmeof-mp/001 with two NICs, if will output
count_devices(): 1 <> 2 when the second NIC has NO-CARRIER

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme: add optional ipv6 test flavor
Sagi Grimberg [Mon, 27 Jun 2022 11:32:00 +0000 (14:32 +0300)]
nvme: add optional ipv6 test flavor

Allow Setting nvme_adrfam=[ipv4|ipv6] and running tests on either
address family. Ignored for non IP transports.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblktests: Add _have_kernel_config_file() and _check_kernel_option()
Xiao Yang [Mon, 27 Jun 2022 07:32:49 +0000 (15:32 +0800)]
blktests: Add _have_kernel_config_file() and _check_kernel_option()

The helper function _have_kernel_option() sets SKIP_REASON when the
specified kernel config option is not set. Sometimes this SKIP_REASON
update is not desired and it is unset after _have_kernel_option() calls.
This unset is not straight-forward and confusing.

To avoid the unset operation, introduce two new helper functions:

1) _have_kernel_config_file() which sets SKIP_REASON when neither
   /boot/config* nor /proc/config.gz is available.
2) _check_kernel_option() which doesn't set SKIP_RESAON when
   the specified kernel option is not defined.

Also re-implement _have_kernel_option() with the new helper functions.
When SKIP_REASON update is not desired, call _check_kernel_option() in
place of _have_kernel_option().

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
[Shin'ichiro: added change purpose in the commit message]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvmeof-mp/rc: Avoid skipping tests due to the expected SKIP_REASON
Xiao Yang [Fri, 24 Jun 2022 07:50:23 +0000 (15:50 +0800)]
nvmeof-mp/rc: Avoid skipping tests due to the expected SKIP_REASON

In _have_kernel_option(), SKIP_REASON = "kernel option NVME_MULTIPATH
has not been enabled" is expected but all nvmeof-mp tests are skipped
due to the SKIP_REASON. For example:
-----------------------------------------------------
./check nvmeof-mp/001
nvmeof-mp/***                                                [not run]
    kernel option NVME_MULTIPATH has not been enabled
-----------------------------------------------------

Avoid the issue by unsetting the SKIP_REASON.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Fixes: 7ae143852f6c ("common/rc: don't unset previous SKIP_REASON in _have_kernel_option()")
[Shin'ichiro: reduced in-line comment]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoMerge pull request #95 from zhijianli88/skip-reason
Shin'ichiro Kawasaki [Mon, 20 Jun 2022 10:23:53 +0000 (19:23 +0900)]
Merge pull request #95 from zhijianli88/skip-reason

common/rc: don't unset previous SKIP_REASON in _have_kernel_option()

2 years agocommon/rc: don't unset previous SKIP_REASON in _have_kernel_option()
Li Zhijian [Wed, 15 Jun 2022 07:07:39 +0000 (15:07 +0800)]
common/rc: don't unset previous SKIP_REASON in _have_kernel_option()

unset previous SKIP_REASON could cause a false failure.

nvme/033 => nvme0n1 (create and connect to an NVMeOF target with a passthru controller) [failed]
    runtime  2.383s  ...  0.376s
    --- tests/nvme/033.out      2022-06-08 08:46:27.956692453 +0000
    +++ /home/lizhijian/blktests/results/nvme0n1/nvme/033.out.bad       2022-06-15 06:32:31.131001276 +0000
    @@ -1,3 +1,8 @@
     Running nvme/033
    -NQN:blktests-subsystem-1 disconnected 1 controller(s)
    +tests/nvme/rc: line 181: nvme: command not found
    +tests/nvme/033: line 19: nvme: command not found
    +tests/nvme/033: line 20: nvme: command not found
    +tests/nvme/033: line 19: nvme: command not found
    +tests/nvme/033: line 20: nvme: command not found
    ...
    (Run 'diff -u tests/nvme/033.out /home/lizhijian/blktests/results/nvme0n1/nvme/033.out.bad' to see the entire diff)

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agocheck: ensure to suppress job status output
Shin'ichiro Kawasaki [Thu, 16 Jun 2022 04:12:14 +0000 (13:12 +0900)]
check: ensure to suppress job status output

Unexpected job status output by wait commands was observed on openSUSE
15.3 and it made some test cases fail. To avoid the job status output
during test case runs, ensure to turn off job control monitor in sub-
shell for test case runs.

Reported-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/linux-block/20220613151721.18664-1-jack@suse.cz/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Tested-by: Jan Kara <jack@suse.cz>
2 years agoMerge pull request #93 from michael-schaller/master
Shin'ichiro Kawasaki [Wed, 15 Jun 2022 09:04:51 +0000 (18:04 +0900)]
Merge pull request #93 from michael-schaller/master

loop: Add test to setup GPT and ESP on raw disk image

2 years agoMerge pull request #87 from bvanassche/master
Shin'ichiro Kawasaki [Wed, 15 Jun 2022 09:03:16 +0000 (18:03 +0900)]
Merge pull request #87 from bvanassche/master

Introduce the io_schedulers() function

2 years agoloop: Add test to setup GPT and ESP on raw disk image
Michael Schaller [Wed, 15 Jun 2022 05:57:18 +0000 (07:57 +0200)]
loop: Add test to setup GPT and ESP on raw disk image

Add test for setting up a raw disk image with a GPT and ESP.
This is a regression test for commit b9684a71fca7
("block, loop: support partitions without scanning").

Signed-off-by: Michael Schaller <misch@google.com>
2 years agoIntroduce the _io_schedulers() function
Bart Van Assche [Sun, 27 Mar 2022 15:18:41 +0000 (08:18 -0700)]
Introduce the _io_schedulers() function

The functionality for retrieving the I/O schedulers supported by a request
queue occurs multiple times. Hence introduce a function for retrieving the
supported I/O schedulers.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agonvme/039: avoid module loads for various transport types
Shin'ichiro Kawasaki [Fri, 10 Jun 2022 12:15:18 +0000 (21:15 +0900)]
nvme/039: avoid module loads for various transport types

The test case nvme/039 does not depend on nvme transport type and does
not require modules for the transport types. The _nvme_requires call in
requires() loads the modules and those modules are left unloaded after
the test case run. This causes failures of following nvmeof-mp test runs
with message:

  modprobe: FATAL: Module nvmet is in use.

To avoid the unnecessary module loads, remove _nvme_requires call.
Instead, just check existence of nvme command.

Fixes: 9accb5f86670 ("tests/nvme: add tests for error logging")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
2 years agozbd: allow falling back to built-in null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:39 +0000 (14:47 +0200)]
zbd: allow falling back to built-in null_blk

Use _configure_null_blk to configure the fallback device and thus allow
for a built-in null_blk driver.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/024: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:38 +0000 (14:47 +0200)]
block/024: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/023: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:37 +0000 (14:47 +0200)]
block/023: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/021: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:36 +0000 (14:47 +0200)]
block/021: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/020: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:35 +0000 (14:47 +0200)]
block/020: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/018: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:34 +0000 (14:47 +0200)]
block/018: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/017: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:33 +0000 (14:47 +0200)]
block/017: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/016: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:32 +0000 (14:47 +0200)]
block/016: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/006: convert to use _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:31 +0000 (14:47 +0200)]
block/006: convert to use _configure_null_blk

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/029: don't require modular null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:30 +0000 (14:47 +0200)]
block/029: don't require modular null_blk

Drop the call to _init_null_blk and just operate on nullb1 instead,
leaving the default device alone.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/null_blk: respect RUN_FOR_ZONED in _configure_null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:29 +0000 (14:47 +0200)]
common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk

Create zoned devices in _configure_null_blk when RUN_FOR_ZONED is
set, just like it is done in _init_null_blk

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/null_blk: allow _configure_null_blk with built-in null_blk
Christoph Hellwig [Tue, 7 Jun 2022 12:47:28 +0000 (14:47 +0200)]
common/null_blk: allow _configure_null_blk with built-in null_blk

Test that do use _configure_null_blk already configure do not actually
require a built-in null_blk driver.  Relax the check in _have_null_blk
to just require a driver instead of a module, and instead set a skip
reason instead of failing in _init_null_blk when null_blk is built-in
or otherwise not available.

Also try to load the null_blk module in _configure_null_blk as
_init_null_blk is optional now and we thus can't rely on the module
to be loaded.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/null_blk: remove explicit queue_mode=2 parameters
Christoph Hellwig [Tue, 7 Jun 2022 12:47:27 +0000 (14:47 +0200)]
common/null_blk: remove explicit queue_mode=2 parameters

queue_mode 2 (aka blk-mq) is the default in null_blk, so remove the
extra explicitly parameter.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme/033: Remove volatile output
Xiao Yang [Sat, 4 Jun 2022 16:06:38 +0000 (00:06 +0800)]
nvme/033: Remove volatile output

The output of _nvme_discover() will be changed according to
${nvme_trtype} and the number of NICs. For example: nvme/033
with nvme_trtype=tcp and two NICs got the following error:
------------------------------------------------
 Running nvme/033
-Discovery Log Number of Records 1, Generation counter X
+Discovery Log Number of Records 2, Generation counter X
 =====Discovery Log Entry 0======
-trtype:  loop
+trtype:  tcp
+subnqn:  nqn.2014-08.org.nvmexpress.discovery
+=====Discovery Log Entry 1======
+trtype:  tcp
 subnqn:  blktests-subsystem-1
 NQN:blktests-subsystem-1 disconnected 1 controller(s)
 Test complete
------------------------------------------------

Remove volatile output to fix the issue.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme: don't require the nvme drivers to be built in
Christoph Hellwig [Wed, 1 Jun 2022 06:48:37 +0000 (08:48 +0200)]
nvme: don't require the nvme drivers to be built in

Use _have_driver instead of _have_modules to check for the availability
of the nvme drivers, and don't bother checking at all for drivers that
are pulled in as dependencies.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoscsi: don't require sg to be built in
Christoph Hellwig [Wed, 1 Jun 2022 06:48:36 +0000 (08:48 +0200)]
scsi: don't require sg to be built in

Use _have_driver instead of _have_modules in _have_scsi_generic as
nothing requires the sg driver to be modular.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonbd: do not require nbd support to be modular
Christoph Hellwig [Wed, 1 Jun 2022 06:48:35 +0000 (08:48 +0200)]
nbd: do not require nbd support to be modular

Use _have_driver instead of _have_modules in _have_nbd as nothing requires
the nbd driver to be modular.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon: do not require loop support to be modular
Christoph Hellwig [Wed, 1 Jun 2022 06:48:34 +0000 (08:48 +0200)]
common: do not require loop support to be modular

Use _have_driver instead of _have_modules in _have_loop as nothing requires
the loop driver to be modular.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon: fix _have_module_param_value to work with built-in drivers
Christoph Hellwig [Wed, 1 Jun 2022 06:48:33 +0000 (08:48 +0200)]
common: fix _have_module_param_value to work with built-in drivers

Don't bother to call modprobe directly and just check the /sys/module/
directory.  Also switch to using descriptive variable names for the
parameters.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon: add a helper if a driver is available
Christoph Hellwig [Wed, 1 Jun 2022 06:48:32 +0000 (08:48 +0200)]
common: add a helper if a driver is available

Unlike _have_modules this allows allows for a built-in driver.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme: use _have_loop instead of _have_modules loop
Christoph Hellwig [Wed, 1 Jun 2022 06:48:31 +0000 (08:48 +0200)]
nvme: use _have_loop instead of _have_modules loop

Also check for the losetup existance.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoMerge pull request #90 from zhijianli88/my_dmesg
Shin'ichiro Kawasaki [Thu, 2 Jun 2022 02:54:00 +0000 (11:54 +0900)]
Merge pull request #90 from zhijianli88/my_dmesg

Introduce _dmesg_since_test_start() and use it in nvme/003 to avoid false-positive failure.

2 years agonvme/003: skip the test if kmsg is not writeable
Li Zhijian [Mon, 30 May 2022 02:52:44 +0000 (10:52 +0800)]
nvme/003: skip the test if kmsg is not writeable

_dmesg_start_from_tests() works properly only if kmsg is writeable.

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agocommon/rc: move _have_writeable_kmsg() helper to common/rc
Li Zhijian [Mon, 30 May 2022 02:48:07 +0000 (10:48 +0800)]
common/rc: move _have_writeable_kmsg() helper to common/rc

So that other tests can use it easily.

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agonvme/003: use _dmesg_since_test_start() to check dmesg output
Li Zhijian [Mon, 30 May 2022 02:33:12 +0000 (10:33 +0800)]
nvme/003: use _dmesg_since_test_start() to check dmesg output

To avoid a false-positive failure due to previous dmesg.

nvme/003 (test if we're sending keep-alives to a discovery controller) [failed]
    runtime  10.868s  ...  10.854s
    --- tests/nvme/003.out      2022-05-11 12:06:52.951599746 +0800
    +++ /home/lizhijian/blktests/results/nodev/nvme/003.out.bad 2022-05-30 10:36:07.775320133 +0800
    @@ -1,3 +1,4 @@
     Running nvme/003
    +Fail
     NQN:nqn.2014-08.org.nvmexpress.discovery disconnected 1 controller(s)
     Test complete

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agocheck: Introduce _dmesg_since_test_start()
Li Zhijian [Fri, 13 May 2022 07:07:37 +0000 (15:07 +0800)]
check: Introduce _dmesg_since_test_start()

It will print dmesg since test start

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agoblock/022: skip test when only 1 cpu available master
Xiao Liang [Fri, 9 Oct 2020 13:55:37 +0000 (21:55 +0800)]
block/022: skip test when only 1 cpu available

Below is fail log in single cpu node.
block/022 (Test hang caused by freeze/unfreeze sequence)     [failed]
    runtime    ...  30.138s
    --- tests/block/022.out 2020-10-09 12:43:48.000000000 +0000
    +++ /usr/local/blktests/results/nodev/block/022.out.bad 2020-10-09 13:45:18.594417401 +0000
    @@ -1,2 +1,3 @@
     Running block/022
    +taskset: failed to set pid 13212's affinity: Invalid argument
     Test complete

Signed-off-by: Xiao Liang <xiliang@redhat.com>
[Shin'ichiro: fixed commit message typo and resolved merge conflict]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvmeof-mp/001: Set expected count properly
Xiao Yang [Sat, 21 May 2022 12:30:20 +0000 (20:30 +0800)]
nvmeof-mp/001: Set expected count properly

The number of block devices will increase according
to the number of RDMA-capable NICs.
For example, nvmeof-mp/001 with two RDMA-capable NICs
got the following error:
-------------------------------------
    Configured NVMe target driver
    -count_devices(): 1 <> 1
    +count_devices(): 2 <> 1
    Passed
-------------------------------------

Set expected count properly by calculating the number
of RDMA-capable NICs.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agosrp/011: Avoid $dev becoming invalid during test
Xiao Yang [Wed, 18 May 2022 06:44:17 +0000 (14:44 +0800)]
srp/011: Avoid $dev becoming invalid during test

$dev will become invalid when log_out has been done
and fio doesn't run yet. In this case subsequent fio
throws the following error:
-------------------------------------
    From diff -u 011.out 011.out.bad
    Configured SRP target driver
    -Passed

    From 011.full:
    fio: looks like your file system does not support direct=1/buffered=0
    fio: destination does not support O_DIRECT
    run_fio exit code: 1
-------------------------------------
This issue happens randomly.

Try to fix the issue by holding $dev before test.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
2 years agoCONTIRIBUTING, README: transfer maintainer role
Shin'ichiro Kawasaki [Wed, 25 May 2022 02:04:24 +0000 (11:04 +0900)]
CONTIRIBUTING, README: transfer maintainer role

To offload blktests maintenance overhead from Omar, I volunteer to take
the blktests maintainer role. Replace Omar's name and e-mail address in
CONTRIBUTING.md with mine. Also note his original authorship in
README.md.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/multipath-over-rdma: Remove unused debug operation
Xiao Yang [Tue, 17 May 2022 03:52:58 +0000 (11:52 +0800)]
common/multipath-over-rdma: Remove unused debug operation

The loop ("for m in ;") will never be entered and it seems
unnecessary to debug sereval modules during test. So I try
to remove the debug operation.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
2 years agotests/nvme: add tests for error logging
Alan Adamson [Mon, 16 May 2022 22:55:39 +0000 (15:55 -0700)]
tests/nvme: add tests for error logging

Test nvme error logging by injecting errors. Kernel must have FAULT_INJECTION
and FAULT_INJECTION_DEBUG_FS configured to use error injector. Tests can be
run with or without NVME_VERBOSE_ERRORS configured.

Test for commit bd83fe6f2cd2 ("nvme: add verbose error logging").

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
2 years agotests/nvme: add helper routine to use error injector
Alan Adamson [Mon, 16 May 2022 22:55:38 +0000 (15:55 -0700)]
tests/nvme: add helper routine to use error injector

nvme tests can use these helper routines to setup and use
the nvme error injector.

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
2 years agoDocumentation: Fix typo nvme-trtype -> nvme_trtype
Xiao Yang [Wed, 11 May 2022 03:00:59 +0000 (11:00 +0800)]
Documentation: Fix typo nvme-trtype -> nvme_trtype

Fixes: 3be78490def5 ("Documentation: add document for nvme-rdma nvmeof-mp srp tests")
Reviewed-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
2 years agotests/nvme/rc: Fix possible endless loop
Li Zhijian [Tue, 17 May 2022 06:22:35 +0000 (14:22 +0800)]
tests/nvme/rc: Fix possible endless loop

A failed connection will cause the later endless loop, so we should return
directly in such case.

344 _nvmet_passthru_target_connect() {
345         local trtype=$1
346         local subsys_name=$2
347
348         _nvme_connect_subsys "${trtype}" "${subsys_name}" || return
349         nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}")
350
351         # The following tests can race with the creation
352         # of the device so ensure the block device exists
353         # before continuing
354         while [ ! -b "${nsdev}" ]; do sleep 1; done <<< endless loop
355
356         echo "${nsdev}"
357 }

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
2 years agoscsi/003: remove unnecessary out file
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:15 +0000 (10:32 +0900)]
scsi/003: remove unnecessary out file

The test case scsi/003 was removed with the commit 5e803ca0ae99 ("Remove
partition rereading tests for reverted fixes"), but its out file was
left. Remove it.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoscsi/006: skip cache types which disable read cache for SATA drives
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:14 +0000 (10:32 +0900)]
scsi/006: skip cache types which disable read cache for SATA drives

The test case scsi/006 sets four cache types to test target SCSI
devices. Two cache types out of the four, "none" and "write back, no
read (daft)" disable read cache. However, these two types do not work
for SATA drives since SAT specification requires Disable Read Cache is
always set to zero in the caching mode page. It results in invalid
argument error and the test case failure.

To avoid the failure, skip the cache types which disable read cache if
the test devices are SATA drives. To check the device, add a helper
function _test_dev_is_sata in scsi/rc.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoscsi/006: whitelist for zoned mode
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:13 +0000 (10:32 +0900)]
scsi/006: whitelist for zoned mode

Define CAN_BE_ZONED=1 in scsi/006. This test case can be executed
without problem against zoned SCSI devices specified in TEST_DEVS, such
as SMR HDDs.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoblock/027, scsi/004: whitelist scsi_debug test cases for zoned mode
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:12 +0000 (10:32 +0900)]
block/027, scsi/004: whitelist scsi_debug test cases for zoned mode

Define CAN_BE_ZONED=1 in block/027 and scsi/004. These test cases can be
executed in zoned mode without problem against scsi_debug devices in
zoned mode.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/scsi_debug: prepare scsi_debug in zoned mode
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:11 +0000 (10:32 +0900)]
common/scsi_debug: prepare scsi_debug in zoned mode

To allow running tests using scsi_debug device with the zoned mode
disabled (current setup) as well as enabled, modify the _init_scsi_debug
helper function. When RUN_FOR_ZONED is set, specify zbc=host-managed
parameter to scsi_debug module so that the scsi_debug devices are
prepared in zoned mode.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agozbd/008: check no stale page cache after BLKRESETZONE ioctl
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:10 +0000 (10:32 +0900)]
zbd/008: check no stale page cache after BLKRESETZONE ioctl

Run two processes which repeat data read and BLKRESETZONE ioctl, and
check that the race does not leave stale page cache. This allows to
catch the bug fixed with the commit e5113505904e ("block: Discard page
cache of # zone reset target range").

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agonvme tests should use nvme_trtype when setting up passthru target
Alan Adamson [Thu, 31 Mar 2022 21:45:26 +0000 (14:45 -0700)]
nvme tests should use nvme_trtype when setting up passthru target

No matter what was passed in with nvme_trtype, the target was being
set up with trtype as "loop".  This caused several passthru tests
to fail when testing tcp or rdma.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
3 years agoblock/008: check CPU offline failure due to many IRQs
Shin'ichiro Kawasaki [Fri, 28 Jan 2022 09:45:12 +0000 (18:45 +0900)]
block/008: check CPU offline failure due to many IRQs

When systems have more IRQs than a single CPU can handle, the test case
block/008 fails with kernel message such as,

   "CPU 31 has 111 vectors, 90 available. Cannot disable CPU"

The failure cause is that the test case offlined too many CPUs and the
left online CPU can not hold all of the required IRQ vectors. To avoid
this failure, check error message of CPU offline. If CPU offline failure
cause is IRQ vector resource shortage, do not handle it as a failure.
Also keep the actual number of CPUs which can be offlined without the
failure and use this number for the test.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agotests/srp: fix module loading issue during srp tests
Yi Zhang [Mon, 25 Oct 2021 01:24:16 +0000 (09:24 +0800)]
tests/srp: fix module loading issue during srp tests

The ib_isert/ib_srpt modules will be automatically loaded after the first
 time rdma_rxe/siw setup, which will lead srp tests fail.

$ modprobe rdma_rxe
$ echo eno1 >/sys/module/rdma_rxe/parameters/add
$ lsmod | grep -E "ib_srpt|iscsi_target_mod|ib_isert"
ib_srpt               167936  0
ib_isert              139264  0
iscsi_target_mod      843776  1 ib_isert
target_core_mod      1069056  3 iscsi_target_mod,ib_srpt,ib_isert
rdma_cm               315392  5 rpcrdma,ib_srpt,ib_iser,ib_isert,rdma_ucm
ib_cm                 344064  2 rdma_cm,ib_srpt
ib_core              1101824  10 rdma_cm,rdma_rxe,rpcrdma,ib_srpt,iw_cm,ib_iser,ib_isert,rdma_ucm,ib_uverbs,ib_cm

$ ./check srp/001
srp/001 (Create and remove LUNs)                             [failed]
    runtime    ...  3.675s
    --- tests/srp/001.out 2021-10-13 01:18:50.846740093 -0400
    +++ /root/blktests/results/nodev/srp/001.out.bad 2021-10-14 03:24:18.593852208 -0400
    @@ -1,3 +1 @@
    -Configured SRP target driver
    -count_luns(): 3 <> 3
    -Passed
    +insmod: ERROR: could not insert module /lib/modules/5.15.0-rc5.fix+/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko: File exists
modprobe: FATAL: Module iscsi_target_mod is in use.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
3 years agotests/nvme: misc fix and coding style update
Yi Zhang [Wed, 27 Oct 2021 13:50:38 +0000 (21:50 +0800)]
tests/nvme: misc fix and coding style update

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
3 years agotests/scsi/007: Add a test that triggers the SCSI error handler
Bart Van Assche [Mon, 4 Oct 2021 17:35:44 +0000 (10:35 -0700)]
tests/scsi/007: Add a test that triggers the SCSI error handler

Since none of the existing tests guarantee that the SCSI error handler
will be triggered, add a test that guarantees this.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agotests/srp/012: Fix the displayed test status
Bart Van Assche [Mon, 23 Aug 2021 18:10:31 +0000 (11:10 -0700)]
tests/srp/012: Fix the displayed test status

The _have_* scripts set the SKIP_REASON variable. That variable controls
whether the status [passed] or [not run] is displayed. This patch causes
the status [passed] to be displayed instead of [not run] if legacy dm
support is not available.

Fixes: 0a2cbbd1874d ("srp and nvmeof-mp: Check whether legacy dm is supported")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoFix multiple shellcheck warnings
Bart Van Assche [Tue, 16 Nov 2021 18:22:49 +0000 (10:22 -0800)]
Fix multiple shellcheck warnings

The latest version of shellcheck reports the following warnings:

check:307:9: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:505:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:506:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:539:11: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
new:102:19: note: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. [SC2295]
common/rc:272:37: warning: -ne treats this as an arithmetic expression. Use != to compare as string (or expand explicitly with $((expr))). [SC2309]
tests/block/008:65:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
tests/block/008:71:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]

This patch fixes the above warnings.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agotests/block: add the missing _have_fio check for block/029 block/031
Yi Zhang [Wed, 27 Oct 2021 05:56:54 +0000 (13:56 +0800)]
tests/block: add the missing _have_fio check for block/029 block/031

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
3 years agoDocumentation: add document for nvme-rdma nvmeof-mp srp tests
Yi Zhang [Sat, 18 Sep 2021 12:05:31 +0000 (20:05 +0800)]
Documentation: add document for nvme-rdma nvmeof-mp srp tests

Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
3 years agonvmeof-mp/001: fix failure when CONFIG_NVME_HWMON enabled
Yi Zhang [Fri, 17 Sep 2021 03:09:11 +0000 (11:09 +0800)]
nvmeof-mp/001: fix failure when CONFIG_NVME_HWMON enabled

skip checking ng0n1/hwmon5 in count_devices

$ use_siw=1  ./check nvmeof-mp/001
nvmeof-mp/001 (Log in and log out)                           [failed]
    runtime  3.695s  ...  4.002s
    --- tests/nvmeof-mp/001.out 2021-09-12 05:35:17.866892187 -0400
    +++ /root/blktests/results/nodev/nvmeof-mp/001.out.bad 2021-09-12 06:49:25.621880616 -0400
    @@ -1,3 +1,3 @@
     Configured NVMe target driver
    -count_devices(): 1 <> 1
    +count_devices(): 3 <> 1
     Passed
$ ls -l /sys/class/nvme-fabrics/ctl/*/*/device
lrwxrwxrwx. 1 root root 0 Sep 12 06:49 /sys/class/nvme-fabrics/ctl/nvme0/hwmon5/device -> ../../nvme0
lrwxrwxrwx. 1 root root 0 Sep 12 06:49 /sys/class/nvme-fabrics/ctl/nvme0/ng0n1/device -> ../../nvme0
lrwxrwxrwx. 1 root root 0 Sep 12 06:49 /sys/class/nvme-fabrics/ctl/nvme0/nvme0n1/device -> ../../nvme0

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
3 years agoblock/001: don't exit test with pending async scan
Ming Lei [Mon, 30 Aug 2021 02:38:44 +0000 (10:38 +0800)]
block/001: don't exit test with pending async scan

We have to run scan and delete together, otherwise pending async
may prevent scsi_debug from being unloaded, and cause failure of
'modprobe: FATAL: Module scsi_debug is in use.'

Fix the issue by always running both scan and delete together.

Fixes: f3bcd8c ("block/001: wait until device is added")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
3 years agoCreate test name from most recently used test number
Jon Derrick [Tue, 24 Aug 2021 18:46:42 +0000 (12:46 -0600)]
Create test name from most recently used test number

The 'new' script can inadvertently use a test name that was removed, ex
nvme/001, which may create confusion if identically-named tests exist
among different versions. Instead, generate a test name at the numerical
tail end of the test group.

Signed-off-by: Jon Derrick <jonathan.derrick@linux.dev>
3 years agoblock/001: wait until device is added
Ming Lei [Tue, 24 Aug 2021 03:17:53 +0000 (11:17 +0800)]
block/001: wait until device is added

Writing to the scan attribute of scsi host is usually one sync scan, but
devices in this sync scan may be delay added if there is concurrent
asnyc scan.

So wait until the device is added in block/001 for avoiding to fail
the test.

Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Omar: fix quoting and simplify logic]
Signed-off-by: Omar Sandoval <osandov@fb.com>
3 years agozbd/007: Reset test target zones at test end
Shin'ichiro Kawasaki [Tue, 13 Jul 2021 10:12:39 +0000 (19:12 +0900)]
zbd/007: Reset test target zones at test end

The test case zbd/007 checks write pointer mapping between a logical
device and its container device. To do so, it moves write pointers of
the container device by writing data to the container device. When the
logical device is a dm-crypt device, this test case works as expected,
but the data written to the container device is not encrypted, then it
leaves broken data on the logical, dm-crypt device. This results in I/O
errors in the following operations to the dm-crypt device.

To avoid the I/O errors, reset the test target zones of the logical
device at the test case end to wipe out the broken data.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agozbd/rc: Support dm-crypt
Shin'ichiro Kawasaki [Tue, 13 Jul 2021 10:12:38 +0000 (19:12 +0900)]
zbd/rc: Support dm-crypt

Linux kernel 5.9 added zoned block device support to dm-crypt. To test
dm-crypt devices, modify the function _get_dev_container_and_sector().
To handle device-mapper table format difference between dm-crypt and
dm-linear/flakey, add dev_idx and off_idx local variables.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agotests/nvme/031: add the missing steps for loop_dev clean up
Yi Zhang [Mon, 31 May 2021 04:46:21 +0000 (12:46 +0800)]
tests/nvme/031: add the missing steps for loop_dev clean up

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agotests/block/031: Add a test for sharing a tag set across hardware queues
Bart Van Assche [Sun, 28 Mar 2021 23:12:09 +0000 (16:12 -0700)]
tests/block/031: Add a test for sharing a tag set across hardware queues

Support for sharing a tag set across hardware queues has been added
recently to the Linux kernel. See also the BLK_MQ_F_TAG_HCTX_SHARED flag,
Linux kernel commit 32bc15afed04 ("blk-mq: Facilitate a shared sbitmap per
tagset"; v5.10) and commit 0905053bdb5b ("null_blk: Support shared tag
bitmap"; v5.10). Add a test that triggers the shared tag set code in the
block layer core.

Cc: John Garry <john.garry@huawei.com>
Cc: Don Brace<don.brace@microsemi.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agomultipath: work around false shellcheck error
Omar Sandoval [Thu, 22 Apr 2021 17:25:47 +0000 (10:25 -0700)]
multipath: work around false shellcheck error

Shellcheck seems to think that [ -z "$debug" ] is setting the debug
variable and warns:

  common/multipath-over-rdma:190:11: note: Modification of debug is local (to subshell caused by pipeline). [SC2030]
  common/multipath-over-rdma:606:8: note: debug was modified in a subshell. That change might be lost. [SC2031]

Work around this by using test instead.

Signed-off-by: Omar Sandoval <osandov@fb.com>
4 years agotests/block/014: ignore dd error messages
Damien Le Moal [Thu, 8 Apr 2021 04:39:18 +0000 (13:39 +0900)]
tests/block/014: ignore dd error messages

The kernel commit de3510e52b0a ("null_blk: fix command timeout
completion handling") fixed null_blk driver to report ETIMEDOUT errors
for IO operations failed with a timeout. This change causes the dd call
in block/014 case to print the following error message:

dd: error reading '/dev/nullb0': Connection timed out

The presence of this message result in a failure of the test case even
without a kernel crash or hang, which is what the block/014 case is
testing. Avoid this failure by ignoring dd error messages using a
redirection of dd stderr to /dev/null.

Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>