]> www.infradead.org Git - users/sagi/blktests.git/log
users/sagi/blktests.git
2 years agotests/block/007: Rework I/O polling
Bart Van Assche [Wed, 1 Feb 2023 20:31:45 +0000 (12:31 -0800)]
tests/block/007: Rework I/O polling

Linux kernel commit a614dd228035 ("block: don't allow writing to the poll
queue attribute") makes writes into /sys/block/*/queue/io_poll a no-op.
Rework test block/007 such that it no longer uses that attribute.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agoMerge pull request #108 from igaw/fcloop
Shin'ichiro Kawasaki [Mon, 30 Jan 2023 07:06:26 +0000 (16:06 +0900)]
Merge pull request #108 from igaw/fcloop

Enable 'fc' as transport for blktests (v2)

This adds transport type 'fc' to the nvme test group.
A few of the test cases report KASAN messages and need fixes.

2 years agoMerge pull request #105 from bvanassche/master
Shin'ichiro Kawasaki [Fri, 27 Jan 2023 00:11:25 +0000 (09:11 +0900)]
Merge pull request #105 from bvanassche/master

common/null_blk: Do not pass an empty string to modprobe

2 years agocommon/null_blk: Do not pass an empty string to modprobe
Bart Van Assche [Tue, 6 Dec 2022 21:24:27 +0000 (13:24 -0800)]
common/null_blk: Do not pass an empty string to modprobe

_init_null_blk() passes an empty string as last argument to modprobe if
RUN_FOR_ZONED is false. Fix this.

Fixes: e840e1537dc6 ("config: Introduce RUN_ZONED_TESTS variable and CAN_BE_ZONED flag")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agonvme: ignore error messages when running tests
Hannes Reinecke [Tue, 30 Aug 2022 12:36:55 +0000 (14:36 +0200)]
nvme: ignore error messages when running tests

There are subtle differences in the way fc is creating associations,
causing the error messages from 'nvme connect' to be different than
on other transports. As we'll get notified anyway when 'nvme connect'
fails there is not point is specifying the error message in the response
files, so just suppress error messages here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/rc: Enable fcloop
Hannes Reinecke [Tue, 30 Aug 2022 09:11:18 +0000 (11:11 +0200)]
nvme/rc: Enable fcloop

Add functions to allow tests to run on fcloop as a transport.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[dwagner: - fixup shellcheck reports
  - addressed review feedback from Shin'ichiro]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme/45: do not specify 'def_traddr' and 'def_trsvcid'
Hannes Reinecke [Tue, 30 Aug 2022 09:12:35 +0000 (11:12 +0200)]
nvme/45: do not specify 'def_traddr' and 'def_trsvcid'

These are default values which will be set by the functions themselves,
so we should leave them unset to allow to pick up the correct values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/44: do not specify 'def_traddr' and 'def_trsvcid'
Hannes Reinecke [Tue, 30 Aug 2022 09:12:35 +0000 (11:12 +0200)]
nvme/44: do not specify 'def_traddr' and 'def_trsvcid'

These are default values which will be set by the functions themselves,
so we should leave them unset to allow to pick up the correct values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/43: do not specify 'def_traddr' and 'def_trsvcid'
Hannes Reinecke [Tue, 30 Aug 2022 09:12:35 +0000 (11:12 +0200)]
nvme/43: do not specify 'def_traddr' and 'def_trsvcid'

These are default values which will be set by the functions themselves,
so we should leave them unset to allow to pick up the correct values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/42: do not specify 'def_traddr' and 'def_trsvcid'
Hannes Reinecke [Tue, 30 Aug 2022 09:12:35 +0000 (11:12 +0200)]
nvme/42: do not specify 'def_traddr' and 'def_trsvcid'

These are default values which will be set by the functions themselves,
so we should leave them unset to allow to pick up the correct values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agonvme/41: do not specify 'def_traddr' and 'def_trsvcid'
Hannes Reinecke [Tue, 30 Aug 2022 09:12:35 +0000 (11:12 +0200)]
nvme/41: do not specify 'def_traddr' and 'def_trsvcid'

These are default values which will be set by the functions themselves,
so we should leave them unset to allow to pick up the correct values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agoMerge pull request #107 from bvanassche/shellcheck
Shin'ichiro Kawasaki [Thu, 26 Jan 2023 10:59:15 +0000 (19:59 +0900)]
Merge pull request #107 from bvanassche/shellcheck

Fix multiple shellcheck warnings

This avoids warnings shellcheck version 0.9.0 reports. The warnings SC2004, SC2319 and SC2320 are addressed. It also addresses the warning 2119 so that "make check" command runs shellcheck without an exception.

2 years agoDo not suppress any shellcheck warnings
Bart Van Assche [Wed, 25 Jan 2023 17:56:31 +0000 (09:56 -0800)]
Do not suppress any shellcheck warnings

Previous patches fixed all warnings reported by shellcheck, including
SC2119. Hence stop suppressing SC2119.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agotests/zbd/003: Do not leak the test_device() argument into _find_two_contiguous_seq_z...
Bart Van Assche [Wed, 25 Jan 2023 17:54:03 +0000 (09:54 -0800)]
tests/zbd/003: Do not leak the test_device() argument into _find_two_contiguous_seq_zones()

Prevent that the arguments of test_device() are passed to
_find_two_contiguous_seq_zones().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agoDo not leak the test() arguments into _init_scsi_debug()
Bart Van Assche [Wed, 25 Jan 2023 17:51:01 +0000 (09:51 -0800)]
Do not leak the test() arguments into _init_scsi_debug()

Bash does not support not passing the test() arguments to
_init_scsi_debug(). Hence pass a single argument to _init_scsi_debug().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agoReturn 1 instead of $? if a condition test or echo command fails
Bart Van Assche [Wed, 25 Jan 2023 17:46:30 +0000 (09:46 -0800)]
Return 1 instead of $? if a condition test or echo command fails

This patch suppresses the shellcheck warnings of categories SC2319 and
SC2320.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agotests/zbd/rc: Remove unnecessary $ signs
Bart Van Assche [Wed, 25 Jan 2023 17:42:52 +0000 (09:42 -0800)]
tests/zbd/rc: Remove unnecessary $ signs

Change array[$var] into array[var]. This patch suppresses several
shellcheck complaints.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2 years agoblock/017: extend IO inflight duration
Shin'ichiro Kawasaki [Wed, 30 Nov 2022 02:40:12 +0000 (11:40 +0900)]
block/017: extend IO inflight duration

The test case block/017 often fails on slow test systems. When it runs
on QEMU and kernel with LOCKDEP, it fails around 50% by chance with
error message as follows:

block/017 (do I/O and check the inflight counter)            [failed]
    runtime  1.715s  ...  1.726s
    --- tests/block/017.out     2022-11-15 15:30:51.285717678 +0900
    +++ /home/shin/kts/kernel-test-suite/src/blktests/results/nodev/block/017.out.bad   2022-11-25 16:23:50.778747167 +0900
    @@ -6,7 +6,7 @@
     sysfs inflight reads 1
     sysfs inflight writes 1
     sysfs stat 2
    -diskstats 2
    +diskstats 1
     sysfs inflight reads 0
     sysfs inflight writes 0
    ...

The test case issues one read and one write to a null_blk device, and
checks that inflight counters reports correct numbers of inflight IOs.
To keep IOs inflight during test, it prepares null_blk device with
completion_nsec parameter 0.5 second. However, when test system is slow,
inflight counter check takes long time and the read completes before the
check. Hence the failure.

To avoid the failure, extend the inflight duration of IOs. Prepare a
null_blk device without completion_nsec parameter and measure time to
check the inflight counters. Prepare null_blk device again specifying
completion_nsec parameter 0.5 seconds plus the measured time of inflight
counter check.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
2 years agotests/nvme/039: Remove passthrough command tests
Alan Adamson [Wed, 16 Nov 2022 22:39:45 +0000 (14:39 -0800)]
tests/nvme/039: Remove passthrough command tests

Commit d7ac8dca938c ("nvme: quiet user passthrough command errors")
disabled error logging for passthrough commands so the associated
tests should be removed.

When an error logging opt-in mechanism for passthrough commands is
provided, the tests can be added back.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agonvme/012,013,035: change fio I/O size and move size definition place
Yi Zhang [Wed, 2 Nov 2022 02:57:02 +0000 (10:57 +0800)]
nvme/012,013,035: change fio I/O size and move size definition place

Change fio I/O size of nvme/012,013,035 from 950m to 900m, since recent change
increased the xfs log size and it caused fio failure with I/O size 950m.

Also add size parameter to _run_fio_verify_io. This allows to move the fio I/O
size definition from common/xfs to the test case, so that device size and fio
I/O size are both defined at single place.

Link: https://lore.kernel.org/linux-block/20221019051244.810755-1-yi.zhang@redhat.com/
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/rc, nvme/035: add function to check TEST_DEV size requirement
Yi Zhang [Wed, 2 Nov 2022 02:57:01 +0000 (10:57 +0800)]
common/rc, nvme/035: add function to check TEST_DEV size requirement

nvme/035 has minimum TEST_DEV size requirement, add a helper function
to check it

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
[Shin'ichiro: fixed commit title and added "return 0"]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agocommon/xfs: set the minimal log size 64m during mkfs.xfs
Yi Zhang [Wed, 2 Nov 2022 02:57:00 +0000 (10:57 +0800)]
common/xfs: set the minimal log size 64m during mkfs.xfs

Update to use the new minimum xfs log size 64MB which introudced from
xfsprogs v5.19.0:

$ mkfs.xfs -l size=32m -f /dev/nvme0n1
Log size must be at least 64MB.
Usage: mkfs.xfs
/* blocksize */ [-b size=num]
/* config file */ [-c options=xxx]
/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,
    inobtcount=0|1,bigtime=0|1]
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,
    (sunit=value,swidth=value|su=num,sw=num|noalign),
    sectsize=num
/* force overwrite */ [-f]
/* inode size */ [-i perblock=n|size=num,maxpct=n,attr=0|1|2,
    projid32bit=0|1,sparse=0|1,nrext64=0|1]
/* no discard */ [-K]
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n
    sunit=value|su=num,sectsize=num,lazy-count=0|1]
/* label */ [-L label (maximum 12 characters)]
/* naming */ [-n size=num,version=2|ci,ftype=0|1]
/* no-op info only */ [-N]
/* prototype file */ [-p fname]
/* quiet */ [-q]
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */ [-s size=num]
/* version */ [-V]
devicename
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> is xxx (512 byte blocks).

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agotests/nvme: set hostnqn after hostid uuidgen
Yi Zhang [Tue, 18 Oct 2022 13:17:58 +0000 (21:17 +0800)]
tests/nvme: set hostnqn after hostid uuidgen

hostid will not be appended to hostnqn as it was generated after set
hostnqn, so let's set hostnqn after hostid generated.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 years agoMerge pull request #102 from bvanassche/master
Shin'ichiro Kawasaki [Tue, 20 Sep 2022 09:55:57 +0000 (18:55 +0900)]
Merge pull request #102 from bvanassche/master

srp/016: Add a test that triggers RDMA hot-unplug

2 years agocommon/rc: support compressed module files
Shin'ichiro Kawasaki [Mon, 12 Sep 2022 05:46:00 +0000 (14:46 +0900)]
common/rc: support compressed module files

The commit 8017ea524367 ("common/rc: ensure modules are loadable in
_have_modules()") introduced a helper function _module_file_exists()
which assumes module files have extension ".ko". However, the assumption
is not true when module files are compressed. In this case, extensions
of modules files have abbreviations of compression algorithm such as
".ko.xz",".ko.gz" or ".ko.zstd". This results in module file existence
check failure and unexpected test skips.

Fix this by changing module file search condition to cover module file
extensions with the compression algorithm abbreviations.

Fixes: 8017ea524367 ("common/rc: ensure modules are loadable in _have_modules()")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://github.com/osandov/blktests/issues/101
2 years agosrp/016: Add a test that triggers RDMA hot-unplug
Bart Van Assche [Mon, 25 Jul 2022 20:25:19 +0000 (13:25 -0700)]
srp/016: Add a test that triggers RDMA hot-unplug

Kernel commit 8fe4ce5836e9 ("scsi: core: Fix a use-after-free"; v6.0-rc5)
fixes a kernel crash triggered by RDMA hot-unplug. This test triggers
RDMA hot-unplug and also triggers a kernel crash without the
aforementioned kernel commit.

Cc: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agonvme: add dh module requirement for tests that involve dh groups
Sagi Grimberg [Mon, 29 Aug 2022 08:36:14 +0000 (11:36 +0300)]
nvme: add dh module requirement for tests that involve dh groups

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/linux-block/20220829083614.874878-1-sagi@grimberg.me/
3 years agoRevert "nbd/rc: load nbd module explicitly"
Shin'ichiro Kawasaki [Thu, 1 Sep 2022 02:32:17 +0000 (11:32 +0900)]
Revert "nbd/rc: load nbd module explicitly"

This reverts commit 78271b8bb8c939e1d0b9cfa3ea321a4ed06635bd.

Once I thought explicit nbd module load in nbd/rc is required due to the
commit 06a0ba866d90 ("common/rc: avoid module load in _have_driver()").
However, it was not a good solution and _have_driver() was modified
again to load module. Hence, revert explicit nbd module load in nbd/rc.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocheck,common/rc: load module in _have_driver() and unload after test
Shin'ichiro Kawasaki [Thu, 1 Sep 2022 02:19:35 +0000 (11:19 +0900)]
check,common/rc: load module in _have_driver() and unload after test

The commit 06a0ba866d90 ("common/rc: avoid module load in
_have_driver()") removed module load from _have_driver(). However, it
was pointed out no module load in _have_driver() is confusing and adds
complexity [1]. It requires explicit module loads and unloads in number
of test cases. The module unloads must be checked if unload is safe or
not. Also module load error must be handled. To avoid these complexity,
a new helper function would be required, but it will be look like the
_have_driver() with module load.

Then revert back the feature to load module in _have_driver(). To
address the issue that the commit 06a0ba866d90 tried to fix, record the
modules loaded by _have_driver() in MODULES_TO_UNLOAD array. Unload
the recorded modules after each test case processing completed. This
avoids the side-effect by the modules loaded by _have_driver().

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

Fixes: 06a0ba866d90 ("common/rc: avoid module load in _have_driver()")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocheck,common/rc: move _unload_module() from common/rc to check
Shin'ichiro Kawasaki [Thu, 1 Sep 2022 09:01:00 +0000 (18:01 +0900)]
check,common/rc: move _unload_module() from common/rc to check

To use in the 'check' script in the following commit, move the helper
function _unload_module() from 'common/rc' to 'check'.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocommon,tests: rename unload_module() to _unload_module()
Shin'ichiro Kawasaki [Thu, 1 Sep 2022 08:55:07 +0000 (17:55 +0900)]
common,tests: rename unload_module() to _unload_module()

All helper functions in common/rc have underscore prefix except
unload_module(). Add the prefix to it.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocheck: clean up _run_test()
Shin'ichiro Kawasaki [Thu, 1 Sep 2022 02:16:58 +0000 (11:16 +0900)]
check: clean up _run_test()

Avoid duplicated declarations and returns of local variable 'ret' in
_run_test(). This is a preparation for a following commit.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocommon,tests: replace _have_modules() with _have_module()
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:53 +0000 (09:11 +0900)]
common,tests: replace _have_modules() with _have_module()

The helper functions _have_modules() and _have_driver() have similar
roles, but they take different number of arguments. The former takes
multiple module names and the latter takes single module name. To make
their usage consistent, modify _have_modules() to _have_module() to take
single argument. This improves readability by checking one module per
line.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agosrp/rc: allow test with built-in sd_mod and sg drivers
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:52 +0000 (09:11 +0900)]
srp/rc: allow test with built-in sd_mod and sg drivers

The srp test group can be executed with built-in sd_mod and sg drivers.
Check the drivers with _have_driver() in place of _have_modules.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agoblock/001: use _have_driver() in place of _have_modules()
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:51 +0000 (09:11 +0900)]
block/001: use _have_driver() in place of _have_modules()

The drivers sd_mod and sr_mod do not need to be loadable. Replace the
check with _have_driver() and allow test with built-in modules.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 years agocommon/rc: ensure modules are loadable in _have_modules()
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:50 +0000 (09:11 +0900)]
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>
3 years agonbd/rc: load nbd module explicitly
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:49 +0000 (09:11 +0900)]
nbd/rc: load nbd module explicitly

After the commit "common/rc: avoid module load in _have_driver()",
_have_driver() no longer loads specified module. However, nbd test cases
and _have_nbd_netlink() function assume that the module is loaded by
calling _have_driver(). This causes test case failures and unexpected
skips. To fix them, load and unload modules explicitly in functions
_start_nbd_server*(), _stop_nbd_server*() and _have_nbd_netlink().

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
3 years agocommon/rc: avoid module load in _have_driver()
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:48 +0000 (09:11 +0900)]
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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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()

3 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>
3 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>
3 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

3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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.