]> www.infradead.org Git - users/hch/blktests.git/log
users/hch/blktests.git
4 years agonvmeof-mp/rc: fix nvmeof-mp failure when NVME_TARGET_PASSTHRU enabled
Yi Zhang [Sun, 24 Jan 2021 05:26:44 +0000 (13:26 +0800)]
nvmeof-mp/rc: fix nvmeof-mp failure when NVME_TARGET_PASSTHRU enabled

$ ./check nvmeof-mp/001
nvmeof-mp/001 (Log in and log out)                           [passed]
    runtime  0.400s  ...  0.457s
rmdir: failed to remove 'subsystems/nvme-test/passthru/admin_timeout': Not a directory
rmdir: failed to remove 'subsystems/nvme-test/passthru/device_path': Not a directory
rmdir: failed to remove 'subsystems/nvme-test/passthru/enable': Not a directory
rmdir: failed to remove 'subsystems/nvme-test/passthru/io_timeout': Not a directory

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agozbd/005: Provide max_active/open_zones limit to fio command
Shin'ichiro Kawasaki [Tue, 29 Dec 2020 00:44:34 +0000 (09:44 +0900)]
zbd/005: Provide max_active/open_zones limit to fio command

When test target zoned block devices have max_open_zones or
max_active_zones limit, high queue depth sequential write in the test
case zbd/005 may result in parallel writes to number of zones beyond the
limit. This causes I/O errors.

To avoid the errors, specify the limit to fio command in the test case.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
4 years agocommon/rc: Check both max_active_zones and max_open_zones
Shin'ichiro Kawasaki [Tue, 29 Dec 2020 00:44:33 +0000 (09:44 +0900)]
common/rc: Check both max_active_zones and max_open_zones

Linux kernel 5.9 introduced new sysfs attributes max_active_zones and
max_open_zones for zoned block devices. Max_open_zones is the limit of
number of zones in open status. Max_active_zones is the limit of number
of zones in open or closed status. Currently, the helper function
_test_dev_max_active_zones() checks only max_active_zones, but it is not
enough. When the device has max_open_zones, check for max_active_zones
can not avoid the errors for write operations.

To avoid the error, improve the function _test_dev_max_active_zones() to
check the limits both. Rename it to _test_dev_max_open_active_zones().
When one of the limits is available for the test target device, return
it. If both limits are available, return smaller limit.

Also modify block/004 and zbd/003 to call the renamed helper function
and update comment description.

Fixes: e6981bb2d9ce ("common/rc: Add _test_dev_max_active_zones() helper function")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
4 years agocommon/rc: confirm pcie hotplug capabilities
Keith Busch [Wed, 25 Nov 2020 15:49:52 +0000 (07:49 -0800)]
common/rc: confirm pcie hotplug capabilities

It turns out some PCIe slots report hotplug surprise but are not hotplug
capable. Despite the contridiction, the spec seems to allow that.

The linux pciehp driver needs hotplug capable to bind to the slot, and
the block/019 test requires hotplug surprise to handle the unannounced
link-down. Verify both bits in the slot capabilities register are set.

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agocommon/multipath-over-rdma: allow to set use_siw
Yi Zhang [Thu, 26 Nov 2020 08:35:32 +0000 (16:35 +0800)]
common/multipath-over-rdma: allow to set use_siw

With this change, we can change to use siw for nvme-rdma/nvmeof-mp/srp
testing from cmdline:

$ use_siw=1 nvme-trtype=rdma ./check nvme/
$ use_siw=1 ./check nvmeof-mp/
$ use_siw=1 ./check srp/

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agocommon/rc: _have_iproute2 fix for "ip -V" change
Yi Zhang [Thu, 26 Nov 2020 08:35:31 +0000 (16:35 +0800)]
common/rc: _have_iproute2 fix for "ip -V" change

With below commit, the version will be updated base on the tag
fbef6555 replace SNAPSHOT with auto-generated version string

To reproduce it:
$ ./check srp/015
common/rc: line 98: [: ip utility, iproute2-5.9.0: integer expression expected

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agonvmeof-mp/012, srp/012: fix the scheduler list
Yi Zhang [Thu, 26 Nov 2020 08:35:30 +0000 (16:35 +0800)]
nvmeof-mp/012, srp/012: fix the scheduler list

There is no cfq scheduler and new added kyber scheduler in lastest kernel,
introduce get_scheduler_list and fix nvmeof-mp/012 srp/012

To reproduce it:
$ ./check nvmeof-mp/012
nvmeof-mp/012 (dm-mpath on top of multiple I/O schedulers)   [passed]
    runtime  5.922s  ...  8.804s

$ cat results/nodev/nvmeof-mp/012.full  | grep -n "Changing scheduler"
31:Changing scheduler of dm-3 from mq-deadline kyber [bfq] none into cfq failed
47:Changing scheduler of dm-3 from mq-deadline kyber [bfq] none into cfq failed

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agotests/nvmeof-mp/rc: run nvmeof-mp tests if we set multipath=N
Yi Zhang [Thu, 26 Nov 2020 08:35:29 +0000 (16:35 +0800)]
tests/nvmeof-mp/rc: run nvmeof-mp tests if we set multipath=N

To enable it, just do bellow step before we run it:
$ echo "options nvme_core multipath=N" >/etc/modprobe.d/nvme.conf

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agotests/srp/rc: update the ib_srpt module name
Yi Zhang [Thu, 26 Nov 2020 08:35:28 +0000 (16:35 +0800)]
tests/srp/rc: update the ib_srpt module name

Fix the ib_srpt module insmod failure as the module in some distros are
end with .xz, like bellow on fedora:
/lib/modules/$(uname -r)/kernel/drivers/infiniband/ulp/srpt/ib_srpt.ko.xz

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agoMigrate to GitHub Actions
Omar Sandoval [Mon, 4 Jan 2021 21:59:26 +0000 (13:59 -0800)]
Migrate to GitHub Actions

Travis CI is no longer offering free open source CI, so migrate to
GitHub Actions.

Signed-off-by: Omar Sandoval <osandov@fb.com>
4 years agonvme/038: Test removal of un-enabled subsystem and ports
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:24 +0000 (10:40 -0600)]
nvme/038: Test removal of un-enabled subsystem and ports

Test that we can remove a subsystem that has not been enabled by
passthru or any ns. Do the same for ports while we are at it.

This was an issue in the original passthru patches and is
not commonly tested. So this test will ensure we don't regress this.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme/037: Add test which loops passthru connect and disconnect
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:23 +0000 (10:40 -0600)]
nvme/037: Add test which loops passthru connect and disconnect

Similar to test nvme/031 except for passthru controllers.

Note: it's normal to get I/O errors in this test as when the controller
disconnects it races with the partition table read.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme/036: Add test for testing reset command on nvme-passthru
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:22 +0000 (10:40 -0600)]
nvme/036: Add test for testing reset command on nvme-passthru

Similar to test 022 but for passthru controllers.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme/035: Add test to verify passthru controller with a filesystem
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:21 +0000 (10:40 -0600)]
nvme/035: Add test to verify passthru controller with a filesystem

This is a similar test as nvme/012 and nvme/013, except with a
passthru controller.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme/034: Add test for passthru data verification
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:20 +0000 (10:40 -0600)]
nvme/034: Add test for passthru data verification

Similar to test nvme/010 and nvme/011 but for a passthru controller

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme/033: Simple test to create and connect to a passthru target
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:19 +0000 (10:40 -0600)]
nvme/033: Simple test to create and connect to a passthru target

This tests creates and connects to a passthru controller backed
by a test NVMe namespace. It then verifies that some common fields
in id-ctrl and id-ns are the same in the target and the orginial
device.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme: Add common helpers for passthru tests
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:18 +0000 (10:40 -0600)]
nvme: Add common helpers for passthru tests

Add some simple helpers to setup a passthru target that passes through
to a nvme test device.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agonvme: Search for specific subsysnqn in _find_nvme_loop_dev
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:17 +0000 (10:40 -0600)]
nvme: Search for specific subsysnqn in _find_nvme_loop_dev

This ensures we find the correct nvme loop device if others exist on a
given system (which is generally not expected on test systems).

Additionally, this will be required in the upcomming test nvme/037 which
will have controllers racing with ones being destroyed.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agocommon/xfs: Create common helper to verify block device with xfs
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:16 +0000 (10:40 -0600)]
common/xfs: Create common helper to verify block device with xfs

Make a common helper from the code in tests nvme/012 and nvme/013
to run an fio verify on a XFS file system backed by the
specified block device.

While we are at it, all the output is redirected to $FULL instead of
/dev/null.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agocommon/xfs: Create common helper to check for XFS support
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:15 +0000 (10:40 -0600)]
common/xfs: Create common helper to check for XFS support

Two nvme tests create and mount XFS filesystems and check for mkfs.xfs.

They should also check for XFS support in the kernel so create a common
helper for this.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
4 years agocommon/fio: Remove state file in common helper
Logan Gunthorpe [Thu, 8 Oct 2020 16:40:14 +0000 (10:40 -0600)]
common/fio: Remove state file in common helper

Instead of each individual test removing this file, just do it
in the common helper.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
4 years agozbd/003: Reset zones when the test device has max_active_zones limit
Shin'ichiro Kawasaki [Thu, 1 Oct 2020 10:15:31 +0000 (19:15 +0900)]
zbd/003: Reset zones when the test device has max_active_zones limit

When the test target device has the max_active_zones limit, write
operations by test case zbd/003 may open zones beyond the limit and
trigger write failures.

To avoid the failure, check max_active_zones limit of the test target
device. If the limit is valid, reset all zones of the device at test
start to ensure that number of open zones does not exceed the limit.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agoblock/004: Provide max_active_zones to fio command
Shin'ichiro Kawasaki [Thu, 1 Oct 2020 10:15:30 +0000 (19:15 +0900)]
block/004: Provide max_active_zones to fio command

If the test target devices is a zoned block device with max_active_zones
limit, the fio command in block/004 opens zones beyond the limit and
fails with I/O errors.

To avoid the failure, pass the limit value to fio using --max_open_zones
option. This option, which was introduced to fio together with
zonemode=zbd, keeps the number of open zones within the specified value.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agocommon/rc: Add _test_dev_max_active_zones() helper function
Shin'ichiro Kawasaki [Thu, 1 Oct 2020 10:15:29 +0000 (19:15 +0900)]
common/rc: Add _test_dev_max_active_zones() helper function

Linux kernel 5.9 introduced a new sysfs attribute "max_active_zones". It
is an attribute of zoned block devices which indicates the limit of zones
in open or close status. To refer the attribute from test cases,
introduce the helper function _test_dev_max_active_zones(). If the
attribute is available, the function returns the attribute value.
Otherwise, returns 0 to indicate that the device does not have the limit.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agonvme: support rdma transport type
Sagi Grimberg [Thu, 3 Sep 2020 23:53:37 +0000 (16:53 -0700)]
nvme: support rdma transport type

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agocommon: move module_unload to common
Sagi Grimberg [Thu, 3 Sep 2020 23:53:36 +0000 (16:53 -0700)]
common: move module_unload to common

It creates a dependency between multipath-over-rdma and test/nvmeof/rc
(and test/srp/rc) which is not a natural home for it.

Move it to common helpers.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agonvme: support nvme-tcp when runinng tests
Sagi Grimberg [Thu, 3 Sep 2020 23:53:35 +0000 (16:53 -0700)]
nvme: support nvme-tcp when runinng tests

run with: nvme_trtype=tcp ./check nvme

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agotests/nvme: restrict tests to specific transports
Sagi Grimberg [Thu, 3 Sep 2020 23:53:34 +0000 (16:53 -0700)]
tests/nvme: restrict tests to specific transports

Protect against running tests with the wrong transport type. Most tests
cannot have nvme_trtype=nvme and discovery tests expect the $trtype to
be written and verified in the .out file. Adding a couple of helpers
to restrict the transport types in tests.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agonvme: make tests transport type agnostic
Sagi Grimberg [Thu, 3 Sep 2020 23:53:33 +0000 (16:53 -0700)]
nvme: make tests transport type agnostic

Pass in nvme_trtype to common routines that can
support multiple transport types.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agonvme: consolidate some nvme-cli utility functions
Sagi Grimberg [Thu, 3 Sep 2020 23:53:32 +0000 (16:53 -0700)]
nvme: consolidate some nvme-cli utility functions

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agonvme: consolidate nvme requirements based on transport type
Sagi Grimberg [Thu, 3 Sep 2020 23:53:31 +0000 (16:53 -0700)]
nvme: consolidate nvme requirements based on transport type

Right now, only pci and loop have tests, hence these are
the only ones that are allowed. The user can pass an env
variable nvme_trtype and check for the necessary modules.

This allows prepares us to support other transport types.

Note that test 031 is designed to run only with nvme, hence
it overrides the environment variable to nvme_trtype=pci.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
4 years agonvme/005: add the missing _have_program nvme
Yi Zhang [Wed, 2 Sep 2020 07:27:57 +0000 (15:27 +0800)]
nvme/005: add the missing _have_program nvme

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
4 years agocommon/multipath-over-rdma: make block scheduler directory optional
Luis Chamberlain [Wed, 29 Jul 2020 15:21:13 +0000 (15:21 +0000)]
common/multipath-over-rdma: make block scheduler directory optional

We currently fail if the following tests if the directory
/lib/modules/$(uname -r)/kernel/block does not exist. Just make
this optional. Older distributions won't have this directory.

srp/001
srp/002
srp/013
srp/014

Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
4 years agozbd/002: Check write pointers only when zones have valid conditions
Shin'ichiro Kawasaki [Tue, 28 Jul 2020 10:14:52 +0000 (19:14 +0900)]
zbd/002: Check write pointers only when zones have valid conditions

Per ZBC, ZAC and ZNS specifications, when zones have condition "read
only", "full" or "offline", the zones may not have valid write pointers.
In such a case, do not check validity of write pointers.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agozbd/005: Enable zonemode=zbd when zone capacity is less than zone size
Shin'ichiro Kawasaki [Tue, 28 Jul 2020 10:14:51 +0000 (19:14 +0900)]
zbd/005: Enable zonemode=zbd when zone capacity is less than zone size

The test case zbd/005 runs fio to issue sequential write requests with
high queue depth. This workload does not require zonemode=zbd for zones
with zone capacity same as zone length. However, when the zone has
smaller zone capacity than zone size, it issues write beyond zone
capacity and triggers write errors.

To allow fio skipping the writes beyond zone capacity, specify the option
zonemode=zbd to fio when the test target zone has zone capacity smaller
than zone size.

Also remove unused sysfs access in the test case.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agozbd/004: Check zone boundary writes using zones without zone capacity gap
Shin'ichiro Kawasaki [Tue, 28 Jul 2020 10:14:50 +0000 (19:14 +0900)]
zbd/004: Check zone boundary writes using zones without zone capacity gap

The test case zbd/004 checks zone boundary write handling by block layer
using two contiguous sequential write required zones. This test is valid
when the first zone has same zone capacity as zone size. However, if the
zone has zone capacity smaller than zone size, the write in the zone
beyond zone capacity limit causes write error and the test fails.

To avoid the write error, find the two zones with first zone that has
zone capacity same as zone size. If such zones are not found, skip the
test case.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agozbd/002: Check validity of zone capacity
Shin'ichiro Kawasaki [Tue, 28 Jul 2020 10:14:49 +0000 (19:14 +0900)]
zbd/002: Check validity of zone capacity

Linux kernel 5.9 zone descriptor interface added the new zone capacity
field defining the range of sectors usable within a zone. Add a check to
ensure that the zone capacity is smaller than or equal to the zone size.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agozbd/rc: Support zone capacity report by blkzone
Shin'ichiro Kawasaki [Tue, 28 Jul 2020 10:14:48 +0000 (19:14 +0900)]
zbd/rc: Support zone capacity report by blkzone

Linux kernel 5.9 zone descriptor interface added the new zone capacity
field defining the range of sectors usable within a zone. The blkzone
tool recently supported the zone capacity in its report zone feature.
Modify the helper function _get_blkzone_report() to support the zone
capacity field.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agoRemove partition rereading tests for reverted fixes
Omar Sandoval [Tue, 4 Aug 2020 19:29:01 +0000 (12:29 -0700)]
Remove partition rereading tests for reverted fixes

The change that block/013 tested for was reverted in Linux kernel commit
10c70d95c0f2 ("block: remove the bd_openers checks in
blk_drop_partitions"). To quote Christoph:

"That check only catches file systems that use a single block device
(e.g. not btrfs multi-device or XFS or ext4 with log devices) and also
doesn't catch non-filesystem users. I first tried to generalized it,
but that ran into a chain of other problems. And there really isn't
much of a problem re-reading partitions on a mounted file system - it is
pointless but not actually harmful."

So, we shouldn't expect that check to come back. Let's remove the
test.

Similarly, the change that scsi/003 tested for was reverted in Linux
kernel commit 8acf608e602f ("Revert "scsi: sd: Keep disk read-only when
re-reading partition""). According to that commit, this can be fixed, so
when that happens we can reintroduce the test.

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
4 years agotests/srp/rc: Separate login parameters with a comma
Bart Van Assche [Tue, 19 May 2020 02:17:07 +0000 (19:17 -0700)]
tests/srp/rc: Separate login parameters with a comma

This patch fixes a syntax error in the SRP login string.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agosrp tests: Use _{init,exit}_scsi_debug() instead of duplicating these functions
Bart Van Assche [Tue, 19 May 2020 00:52:53 +0000 (17:52 -0700)]
srp tests: Use _{init,exit}_scsi_debug() instead of duplicating these functions

This patch does not change any functionality but reduces code duplication.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agocommon/multipath-over-rdma: Log mkfs output
Bart Van Assche [Tue, 19 May 2020 00:33:46 +0000 (17:33 -0700)]
common/multipath-over-rdma: Log mkfs output

The mkfs output is important, hence log it in $FULL.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agosrp, nvmeof-mp: Use no_path_retry instead of queue_if_no_path
Bart Van Assche [Mon, 18 May 2020 23:15:34 +0000 (16:15 -0700)]
srp, nvmeof-mp: Use no_path_retry instead of queue_if_no_path

queue_if_no_path has been deprecated, hence use no_path_retry instead.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agotests/nvmeof-mp/rc: Make login failures easier to debug
Bart Van Assche [Mon, 18 May 2020 21:54:24 +0000 (14:54 -0700)]
tests/nvmeof-mp/rc: Make login failures easier to debug

Record the login parameters in $FULL.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoblock/012: add comment explaning second --setro
Omar Sandoval [Tue, 4 Aug 2020 18:38:28 +0000 (11:38 -0700)]
block/012: add comment explaning second --setro

Closes #73.

Signed-off-by: Omar Sandoval <osandov@fb.com>
4 years agotests/srp/rc: Fix a shellcheck warning
Bart Van Assche [Thu, 16 Jul 2020 19:04:54 +0000 (12:04 -0700)]
tests/srp/rc: Fix a shellcheck warning

Fix the following shellcheck warning:

tests/srp/rc:519:11: warning: The = here is literal. To assign by index, use
( [index]=value ) with no spaces. To keep as literal, quote it. [SC2191]

Reported-by: Shin'ichiro Kawasaki
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agotests: mark tests with CAN_BE_ZONED=1
Klaus Jensen [Tue, 30 Jun 2020 09:19:25 +0000 (11:19 +0200)]
tests: mark tests with CAN_BE_ZONED=1

Zoned devices should have no issues running block/{008,019} and
nvme/032, so mark the tests with CAN_BE_ZONED=1.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
4 years agocommon/cpuhotplug: fix ALL_CPUS
Omar Sandoval [Fri, 19 Jun 2020 21:15:42 +0000 (14:15 -0700)]
common/cpuhotplug: fix ALL_CPUS

_have_cpu_hotplug needs to set cpu before adding it to ALL_CPUS.

Closes #68.

4 years agotests/srp/rc: Do not pass an empty string to dd
Bart Van Assche [Tue, 9 Jun 2020 17:28:13 +0000 (10:28 -0700)]
tests/srp/rc: Do not pass an empty string to dd

Instead of passing an empty string as argument to dd, do not pass any
argument when not using direct I/O.

Fixes: 577caa7d2b4a ("Fix unquoted integer shellcheck errors")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agozbd/007: Add --force option to blkzone reset
Shin'ichiro Kawasaki [Mon, 8 Jun 2020 02:44:58 +0000 (11:44 +0900)]
zbd/007: Add --force option to blkzone reset

The test case zbd/007 utilizes blkzone command from util-linux project
to reset zones of test target devices. Recently, blkzone was modified to
report EBUSY error when it was called to change zone status of devices
used by the system. This avoids unintended zone status change by mistake
and good for most of use cases.

However this change triggered failure of the test case zbd/007 with the
EBUSY error. The test case executes blkzone to reset zones of block devices
which the system maps to container devices such as dm-linear.

To avoid this failure, modify zbd/007 to check if blkzone supports --force
option. And if it is supported, add it to blkzone command line. This option
was introduced to blkzone to allow zone status change of devices even when
the system use them.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
4 years agoFix ./check: line 275: LAST_TEST_RUN["$key"]: unbound variable
Li Zhijian [Tue, 9 Jun 2020 08:48:53 +0000 (16:48 +0800)]
Fix ./check: line 275: LAST_TEST_RUN["$key"]: unbound variable

for the srp first run where /path/to/blktests/results is empty, it will
throw errors like:

$ ./check srp/001 srp/002 srp/003 srp/004 srp/005 srp/006 srp/007 srp/008 srp/009 srp/010 srp/011 srp/012 srp/013 srp/015
srp/001 (Create and remove LUNs)----------------------------
srp/001 (Create and remove LUNs)                             [failed]

==> /tmp/stderr <==
./check: line 275: LAST_TEST_RUN["$key"]: unbound variable

==> /tmp/stdout <==
    --- tests/srp/001.out>------2020-06-09 13:44:19.000000000 +0800
    +++ /lkp/benchmarks/blktests/results/nodev/srp/001.out.bad>-2020-06-09 16:18:22.594012394 +0800
    @@ -1,3 +1,4 @@
     Configured SRP target driver
    +tests/srp/rc: line 105: use_blk_mq: Permission denied
     count_luns(): 3 <> 3
     Passed

Signed-off-by: Li Zhijian <zhijianx.li@intel.com>
4 years agoFix unquoted integer shellcheck errors
Omar Sandoval [Mon, 15 Jun 2020 22:40:26 +0000 (15:40 -0700)]
Fix unquoted integer shellcheck errors

Shellcheck apparently got stricter about SC2086 ("Double quote to
prevent globbing and word splitting") because now it is warning about
unquoted integers.

4 years agotravis: update shellcheck URL
Omar Sandoval [Mon, 15 Jun 2020 22:33:21 +0000 (15:33 -0700)]
travis: update shellcheck URL

The latest build failed with this error:

```
You are downloading ShellCheck from an outdated URL!
Please update to the new URL:
https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz
For more information, see:
https://github.com/koalaman/shellcheck/issues/1871
PS: Sorry for breaking your build :(
```

4 years agotests/srp/rc: Make the SRP tests pass against kernel v5.7
Bart Van Assche [Sat, 16 May 2020 00:00:45 +0000 (17:00 -0700)]
tests/srp/rc: Make the SRP tests pass against kernel v5.7

Linux kernel commit 569334014370 ("scsi: core: Delete scsi_use_blk_mq")
removed the use_blk_mq sysfs attribute. Hence only write into the
use_blk_mq sysfs attribute if it exists.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoAdd $DESCRIPTION to the TEST_RUN
Sebastian Chlad [Thu, 30 Apr 2020 11:15:18 +0000 (13:15 +0200)]
Add $DESCRIPTION to the TEST_RUN

Signed-off-by: Sebastian Chlad <schlad@suse.de>
4 years agoFix unintentional skipping of tests
Klaus Jensen [Wed, 22 Apr 2020 07:44:36 +0000 (09:44 +0200)]
Fix unintentional skipping of tests

cd11d001fe86 ("Support skipping tests from test{,_device}()") breaks a
good handful of tests.

For example, block/005 uses _test_dev_is_rotational to check if the
device is rotational and uses the result to size up the fio run. As a
side-effect, _test_dev_is_rotational also sets SKIP_REASON, which (since
commit cd11d001fe86) causes the test to print out a "[not run]" even
through the test actually ran successfully.

Fix this by renaming the existing helpers to _require_foo (e.g. a
_require_test_dev_is_rotational) and add the non-_require variant where
needed.

Fixes: cd11d001fe86 ("Support skipping tests from test{,_device}()")
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
[Omar: simplify new _test_dev helpers]
Signed-off-by: Omar Sandoval <osandov@fb.com>
5 years agoAdd a test that triggers the blk_mq_realloc_hw_ctxs() error path
Bart Van Assche [Sat, 28 Mar 2020 18:22:51 +0000 (11:22 -0700)]
Add a test that triggers the blk_mq_realloc_hw_ctxs() error path

Add a test that triggers the code touched by commit d0930bb8f46b ("blk-mq:
Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()"). This
test only runs if a recently added fault injection feature is available,
namely commit 596444e75705 ("null_blk: Add support for init_hctx() fault
injection").

Cc: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoIntroduce the function _configure_null_blk()
Bart Van Assche [Sat, 28 Mar 2020 18:22:50 +0000 (11:22 -0700)]
Introduce the function _configure_null_blk()

Introduce a function for creating a null_blk device instance through
configfs.

Suggested-by: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoUse _{init,exit}_null_blk instead of open-coding these functions
Bart Van Assche [Sat, 28 Mar 2020 18:22:49 +0000 (11:22 -0700)]
Use _{init,exit}_null_blk instead of open-coding these functions

This patch reduces code duplication.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoMake _exit_null_blk remove all null_blk device instances
Bart Van Assche [Sat, 28 Mar 2020 18:22:48 +0000 (11:22 -0700)]
Make _exit_null_blk remove all null_blk device instances

Instead of making every test remove null_blk device instances before calling
_exit_null_blk(), move the null_blk device instance removal code into
_exit_null_blk().

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agocommon/fio: do not use norandommap with verify
Klaus Jensen [Thu, 30 Jan 2020 08:49:41 +0000 (09:49 +0100)]
common/fio: do not use norandommap with verify

As per the fio documentation, using norandommap with an async I/O engine
and I/O depth > 1, can cause verification errors.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
5 years agoSupport skipping tests from test{,_device}()
Omar Sandoval [Thu, 5 Mar 2020 01:21:51 +0000 (17:21 -0800)]
Support skipping tests from test{,_device}()

Most of the time, test requirements can be checked without much setup.
However, in some cases, it's not possible to know if the test can be run
until we're halfway through the test. Allow setting SKIP_REASON from the
test function. This should only be used as a last resort.

5 years agoShow last run for skipped tests
Omar Sandoval [Thu, 5 Mar 2020 01:08:51 +0000 (17:08 -0800)]
Show last run for skipped tests

When we support skipping from test{,_device}, we will show the last run
information and then skip the test. This is inconsistent with how we
currently show skipped tests, which doesn't display any information. For
consistency, consolidate on always showing the last run (and for device
tests, showing the skipped message for each device).

5 years agoSkip tests based on SKIP_REASON, not return value
Omar Sandoval [Thu, 5 Mar 2020 00:27:38 +0000 (16:27 -0800)]
Skip tests based on SKIP_REASON, not return value

Currently, {,group_,device_}requires are required to both set
SKIP_REASON and return non-zero. This is somewhat redundant, and will be
inconsistent with skipping from test{,_device} that is about to be
implemented. Let's ignore the return value and always skip the test if
SKIP_REASON is set. The _have_foo and _test_dev_foo helpers should still
return so that they can be chained together.

5 years agonbd/003: fix compiling error with gcc version 4.8.5
Yi Zhang [Thu, 20 Feb 2020 14:46:49 +0000 (22:46 +0800)]
nbd/003: fix compiling error with gcc version 4.8.5

cc  -O2 -Wall -Wshadow   -o mount_clear_sock mount_clear_sock.c
mount_clear_sock.c: In function ‘main’:
mount_clear_sock.c:39:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < loops; i++) {
  ^
mount_clear_sock.c:39:2: note: use option -std=c99 or -std=gnu99 to compile your code

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
5 years agonbd/003:add mount and clear_sock test for nbd
Sun Ke [Mon, 23 Dec 2019 03:18:29 +0000 (11:18 +0800)]
nbd/003:add mount and clear_sock test for nbd

Add the test case to check nbd device. This test case catches regressions
fixed by commit 92b5c8f0063e4 "nbd: replace kill_bdev() with
__invalidate_device() again".

Establish the nbd connection. Run two processes. The first one do mount
and umount, and the other one do clear_sock ioctl.

Signed-off-by: Sun Ke <sunke32@huawei.com>
[Omar: simplify]
Signed-off-by: Omar Sandoval <osandov@fb.com>
5 years agonvme/018: Reword misleading error message
Daniel Wagner [Mon, 3 Feb 2020 16:40:49 +0000 (17:40 +0100)]
nvme/018: Reword misleading error message

'nvme read' is expected to fail, though the error message "ERROR:
Successfully..." is misleading. Reword the error text to clarify the
real intent of the test and what failed.

Reported-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
5 years agonvme/018: Ignore message generated by nvme read
Daniel Wagner [Mon, 3 Feb 2020 16:40:48 +0000 (17:40 +0100)]
nvme/018: Ignore message generated by nvme read

nvme-cli writes 'CAP_EXCEEDED' message also on stdout not just
stderr. This lets the test fail as well.

Fixes: 1aee5f430b30 ("nvme/018: Ignore error message generated by nvme read")
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
5 years agotests/srp/015: Add a test that uses the SoftiWARP (siw) driver
Bart Van Assche [Fri, 13 Dec 2019 14:32:32 +0000 (09:32 -0500)]
tests/srp/015: Add a test that uses the SoftiWARP (siw) driver

Recently support has been added in the SRP initiator and target drivers
for the SoftiWARP driver. Add a test for SRP over SoftiWARP.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agocommon/multipath-over-rdma, tests/srp: Make it easy to use siw instead of rdma_rxe
Bart Van Assche [Fri, 13 Dec 2019 14:32:31 +0000 (09:32 -0500)]
common/multipath-over-rdma, tests/srp: Make it easy to use siw instead of rdma_rxe

Make all_primary_gids() return GIDs with zero suffix since SoftiWARP
GIDs have such a suffix. Add SoftiWARP support in start_soft_rdma() and
stop_soft_rdma(). Make do_rdma_cm_login() submit the source IP address
and scope ID to the SRP initiator driver since that information is
essential to establish an IPv6 connection between link-local addresses.
Iterate over RDMA ports instead of UMAD device nodes in log_in() since
no UMAD device node is associated with SoftiWARP ports. In start_lio_srpt(),
use the GID format to identify SoftiWARP ports since the GID suffix for
these ports is zero.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agocommon/multipath-over-rdma: Rename two functions
Bart Van Assche [Fri, 13 Dec 2019 14:32:30 +0000 (09:32 -0500)]
common/multipath-over-rdma: Rename two functions

Since the meaning of this functions will change, make sure that the
function name will match the new meaning.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agocommon/multipath-over-rdma: Fix expand_ipv6_addr()
Bart Van Assche [Fri, 13 Dec 2019 14:32:29 +0000 (09:32 -0500)]
common/multipath-over-rdma: Fix expand_ipv6_addr()

For IPv6 address ::1, instead of returning
0:0000:0000:0000:0000:0000:0000:0000:0001, return
0000:0000:0000:0000:0000:0000:0000:0001.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoblock/013: Fix check for blockdev output
André Almeida [Tue, 22 Oct 2019 14:26:15 +0000 (11:26 -0300)]
block/013: Fix check for blockdev output

In some systems the operator "<<<" may not behave as expected. Replace
this operator by a more canonical approach to grep content from a
variable.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
5 years agoblock/013: Finish removing obsolete license header
André Almeida [Tue, 22 Oct 2019 14:17:23 +0000 (11:17 -0300)]
block/013: Finish removing obsolete license header

Commit e9ffecc "Convert license headers to SPDX tags" remove extensive
license description and replace with a SPDX tag. However, one line was
left behind. Remove this line.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
5 years agocheck: Add configuration file option
André Almeida [Wed, 30 Oct 2019 22:27:06 +0000 (19:27 -0300)]
check: Add configuration file option

Add an option to be possible to use a different configuration file
rather than the default "config" file.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
[Omar: rework so command line options still take precedence over config,
 document precedence]
Signed-off-by: Omar Sandoval <osandov@fb.com>
5 years agocheck: Make "device-only" option a valid option
André Almeida [Wed, 30 Oct 2019 22:27:05 +0000 (19:27 -0300)]
check: Make "device-only" option a valid option

"--device-only" option is described at the "Usage" help message and it's
even parsed as an option by the main code. However, since it's not a
parameter of getopt, when trying to use it will trigger a "unrecognized
option". Fix that to allow usage of this option.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
5 years agoAdd a test that triggers blk_mq_update_nr_hw_queues()
Bart Van Assche [Thu, 24 Oct 2019 21:03:52 +0000 (14:03 -0700)]
Add a test that triggers blk_mq_update_nr_hw_queues()

Note: the newly added test script only triggers blk_mq_update_nr_hw_queues()
for kernel versions that include commit 45919fbfe1c4 ("null_blk: Enable
modifying 'submit_queues' after an instance has been configured").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoMove and rename uptime_s()
Bart Van Assche [Thu, 24 Oct 2019 21:03:51 +0000 (14:03 -0700)]
Move and rename uptime_s()

Make it easy to use the uptime_s() function from block tests. Change the
implementation of this function into something that is easier to read.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoRemove unnecessary linux/kvm.h include in sg syzkaller test (#53)
jrrk [Fri, 18 Oct 2019 21:48:17 +0000 (22:48 +0100)]
Remove unnecessary linux/kvm.h include in sg syzkaller test (#53)

5 years agoMerge pull request #52 from andrealmeid/fix-readme
Omar Sandoval [Tue, 15 Oct 2019 23:46:13 +0000 (16:46 -0700)]
Merge pull request #52 from andrealmeid/fix-readme

README: stress warning and add "multipath-tools" information

5 years agonvme: Add new test case about nvme rescan/reset/remove during IO
Yi Zhang [Wed, 11 Sep 2019 08:53:43 +0000 (16:53 +0800)]
nvme: Add new test case about nvme rescan/reset/remove during IO

Add one test to cover NVMe SSD rescan/reset/remove operation during
IO, the steps found several issues during my previous testing, check
them here:
http://lists.infradead.org/pipermail/linux-nvme/2017-February/008358.html
http://lists.infradead.org/pipermail/linux-nvme/2017-May/010259.html

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
[Omar: allow all attributes to be missing and check for directory
 existence]
Signed-off-by: Omar Sandoval <osandov@fb.com>
5 years agonvme/031: Add test to check controller deletion after setup
Logan Gunthorpe [Wed, 11 Sep 2019 17:20:21 +0000 (11:20 -0600)]
nvme/031: Add test to check controller deletion after setup

A number of bug fixes have been submitted to the kernel to
fix bugs when a controller is removed immediately after it is
set up. This new test ensures this doesn't regress.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
5 years agoblock/027: remove duplicate --group_reporting=1
Yi Zhang [Mon, 9 Sep 2019 16:55:06 +0000 (00:55 +0800)]
block/027: remove duplicate --group_reporting=1

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
5 years agoREADME: Specify which package name Arch Linux uses
André Almeida [Tue, 8 Oct 2019 02:01:32 +0000 (23:01 -0300)]
README: Specify which package name Arch Linux uses

As showed by pacman, the proper name of the multipath dependence at Arch
Linux's repositories is "multipath-tools".

$ pacman -Ss multipath
community/multipath-tools 0.8.2-1
    Multipath tools for Linux (including kpartx)

Signed-off-by: André Almeida <andrealmeid@collabora.com>
5 years agoREADME: Stress warning about destructive actions
André Almeida [Tue, 8 Oct 2019 00:36:06 +0000 (21:36 -0300)]
README: Stress warning about destructive actions

The information that an action can cause potentially data loss should be
displayed before the command, not after. Change the order and stress the
warning.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
5 years agotests/srp/014: Add a test that triggers a SCSI reset while I/O is ongoing
Bart Van Assche [Thu, 8 Aug 2019 20:05:06 +0000 (13:05 -0700)]
tests/srp/014: Add a test that triggers a SCSI reset while I/O is ongoing

This test triggers the task management function handling code in the SRP
initiator and target drivers.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agotests/nvmeof-mp/rc: Make the NVMeOF multipath tests more reliable
Bart Van Assche [Thu, 8 Aug 2019 20:05:05 +0000 (13:05 -0700)]
tests/nvmeof-mp/rc: Make the NVMeOF multipath tests more reliable

Fix the following failure for tests 002, 003, 004 and 011:

+tests/nvmeof-mp/rc: line 99: echo: write error: Operation already in progress

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agotests/nvmeof-mp/rc: Make simulate_network_failure_loop() more robust
Bart Van Assche [Thu, 8 Aug 2019 20:05:04 +0000 (13:05 -0700)]
tests/nvmeof-mp/rc: Make simulate_network_failure_loop() more robust

Avoid that the following is logged in the nvmeof-mp .full log files:

ls: cannot access '/sys/class/nvme/*/device/*/nvme0n1/reset_controller': No such
file or directory
tests/nvmeof-mp/rc: line 124: : No such file or directory

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agotests/nvme/rc: Modify the approach for disabling and re-enabling Ctrl-C
Bart Van Assche [Thu, 8 Aug 2019 20:05:03 +0000 (13:05 -0700)]
tests/nvme/rc: Modify the approach for disabling and re-enabling Ctrl-C

Avoid that the following error messages are reported when redirecting stdin:

stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device

Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Fixes: a987b10bc179 ("nvme: Ensure all ports and subsystems are removed on cleanup")
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoMake the NVMe tests more reliable
Bart Van Assche [Mon, 5 Aug 2019 23:25:12 +0000 (16:25 -0700)]
Make the NVMe tests more reliable

When running blktests with kernel debugging enabled it can happen that
_find_nvme_loop_dev() returns before the NVMe block device has appeared
in sysfs. This patch avoids that the NVMe tests fail as follows:

+cat: /sys/block/nvme1n1/uuid: No such file or directory
+cat: /sys/block/nvme1n1/wwid: No such file or directory

Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agonvme: Ignore errors when removing modules
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:59 +0000 (11:12 -0600)]
nvme: Ignore errors when removing modules

It is no longer important for correct test functionality to
remove the modules between tests. Therefore, we ignore errors
if the modules are not removed (ie. if they are builtin).

With this patch, it is now safe to run the tests with the nvmet
modules built-in. This will be more convienent for developers
that want to run the tests in a simple VM.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agocommon: Use sysfs instead of modinfo for _have_module_param()
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:58 +0000 (11:12 -0600)]
common: Use sysfs instead of modinfo for _have_module_param()

Using modinfo fails if the given module is built-in.

Instead, if the module is already in the kernel, check for the
parameter in sysfs.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme: Ensure all ports and subsystems are removed on cleanup
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:57 +0000 (11:12 -0600)]
nvme: Ensure all ports and subsystems are removed on cleanup

This ensures any test that fails or is interrupted will cleanup
their subsystems. This will prevent the system from being left
in an inconsistent state that will fail subsequent tests.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme: Cleanup modprobe lines into helper functions
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:56 +0000 (11:12 -0600)]
nvme: Cleanup modprobe lines into helper functions

Move all the lines to modprobe nvmet and nvme-loop
into _setup_nvmet() and _cleanup_nvmet() helper functions
and call _cleanup_nvmet() using _register_test_cleanup()
to ensure it's always called after the test terminates.

This will allow us to improve the cleanup of these tests and
not leave the system in an inconsistent state when tests
are aborted.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agocheck: Add the ability to call a cleanup function after a test ends
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:55 +0000 (11:12 -0600)]
check: Add the ability to call a cleanup function after a test ends

In order to ensure tests properly clean themselves up, even if
they are subject to interruption, add the ability to call a test
specified function at cleanup time.

Any test can call _register_test_cleanup with the first argument
as a function to call after the test ends or is interrupted
(similar to using 'trap <func> EXIT').

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme/018: Ignore error message generated by nvme read
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:54 +0000 (11:12 -0600)]
nvme/018: Ignore error message generated by nvme read

nvme-cli at some point started printing the error message:

  NVMe status: CAP_EXCEEDED: The execution of the command has caused the
capacity of the namespace to be exceeded(0x6081)

This was not accounted for by test 018 and caused it to fail.

This test does not need to test the error message content, it's
only important that a read past the end of the file fails. Therefore,
pipe stderr of nvme-cli to $FULL.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme/015: Ensure the namespace is flushed not the char device
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:53 +0000 (11:12 -0600)]
nvme/015: Ensure the namespace is flushed not the char device

Flushing the char device now results in the warning:

   nvme nvme1: using deprecated NVME_IOCTL_IO_CMD ioctl on the char
device!

Instead, call the flush on the namespace.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme/005: Don't rely on modprobing to set the multipath paramater
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:52 +0000 (11:12 -0600)]
nvme/005: Don't rely on modprobing to set the multipath paramater

On test systems with existing nvme drives or built-in modules it may not
be possible to remove nvme-core in order to re-probe it with
multipath=1.

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

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

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme/003,004: Add missing calls to nvme disconnect
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:51 +0000 (11:12 -0600)]
nvme/003,004: Add missing calls to nvme disconnect

Tests 003 and 004 do not call  nvme disconnect. In most cases it is
cleaned up by removing the modules but it should be made explicit.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agonvme: Add new test to verify the generation counter
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:50 +0000 (11:12 -0600)]
nvme: Add new test to verify the generation counter

Now that the other discovery tests ignore the generation counter value,
create a new test to specifically check that it increments when
subsystems are added or removed from ports and when allow_any_host
is set/unset.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>