]> www.infradead.org Git - users/hch/blktests.git/log
users/hch/blktests.git
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>
5 years agonvme: More agressively filter the discovery output
Logan Gunthorpe [Wed, 17 Jul 2019 17:12:49 +0000 (11:12 -0600)]
nvme: More agressively filter the discovery output

Comparing the entire output of nvme-cli for discovery is fragile
and error prone as things change. There's already been the
long standing issue of the generation counter mismatching
and also some versions of nvme-cli print an extra "sq flow control
disable supported" text[1].

Instead, filter out all but a few key values from the discovery
text which should still be sufficient for this test and much
less likely to be subject to churn.

[1] https://lore.kernel.org/linux-block/20190505150611.15776-4-minwoo.im.dev@gmail.com/

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agoAdd filter function for nvme discover
Michael Moese [Wed, 17 Jul 2019 17:12:48 +0000 (11:12 -0600)]
Add filter function for nvme discover

Several NVMe tests (002, 016, 017) used a pipe to a sed call filtering
the output. This call is moved to a new filter function nvme/rc and
the calls to sed are replaced by this function.

Additionally, the test nvme/016 failed for me due to the Generation
counter being greater than 1, so the new filter function was expanded to
replace the Generation counter with 'X'.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Michael Moese <mmoese@suse.de>
[logang@deltatee.com: added missing changes to 002.out and 017.out]
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
5 years agoblock: add freeze/unfreeze sequence test
Bob Liu [Mon, 10 Jun 2019 23:35:06 +0000 (07:35 +0800)]
block: add freeze/unfreeze sequence test

Reproduce the hang fixed by
7996a8b5511a ("blk-mq: fix hang caused by freeze/unfreeze sequence").

--
v2:
- Add 022.out

Signed-off-by: Bob Liu <bob.liu@oracle.com>
5 years agozbd/007: Add zone mapping test for logical devices
Shin'ichiro Kawasaki [Fri, 7 Jun 2019 12:19:55 +0000 (21:19 +0900)]
zbd/007: Add zone mapping test for logical devices

Add the test case to check zones sector mapping of logical devices
This test case requires that such a logical device be specified in
TEST_DEVS in config. The test is skipped for devices that are identified
as not logically created. This test case catches regressions of complex
zone remapping problem fixed by commit 9864cd5dc54c "dm: fix report zone
remapping to account for partition offset".

To test that the zone mapping is correct, select a few sequential write
required zones of the logical device and move the write pointers of
these zones through the container device of the logical device, using
the physical sector mapping of the zones. The write pointers position of
the selected zones is then checked through a zone report of the logical
device using the logical sector mapping of the zones. The test reports a
success if the position of the zone write pointers relative to the zone
start sector must be identical for both the logical and physical
locations of the zones.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
5 years agozbd/rc: Introduce helper functions for zone mapping test
Shin'ichiro Kawasaki [Fri, 7 Jun 2019 12:19:54 +0000 (21:19 +0900)]
zbd/rc: Introduce helper functions for zone mapping test

As a preparation for the zone mapping test case, add several helper
functions. _find_last_sequential_zone() and
_find_sequential_zone_in_middle() help to select test target zones.
_test_dev_is_logical() checks TEST_DEV is the valid test target.
_test_dev_has_dm_map() helps to check that the dm target is linear or
flakey. _get_dev_container_and_sector() helps to get the container device
and sector mappings.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
5 years agoblock/005,008: do exit if fio did not finish within timeout
Xiao Liang [Sat, 11 May 2019 15:36:51 +0000 (23:36 +0800)]
block/005,008: do exit if fio did not finish within timeout

In some bad situation, fio needs taking over several hours to complete
random read operations with specified size. The test may skip out in such
cases and does not block other cases run.

With this patch, the case will be ended within $TIMEOUT(if set) or 900s.
block/005 => nvme1n1 (switch schedulers while doing IO)      [failed]
    runtime      ...  1800.477s
    read iops    ...
    --- tests/block/005.out 2019-03-31 14:29:39.905449312 +0000
    +++ /home/ec2-user/blktests/results/nvme1n1/block/005.out.bad 2019-05-07 04:10:16.026681842 +0000
    @@ -1,2 +1,4 @@
     Running block/005
    +fio did not finish after 900 seconds which probably caused by
    +lower disk performance
     Test complete

Reviewed-by: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Signed-off-by: Xiao Liang <xiliang@redhat.com>
[Omar: add some headroom for explicit timeouts]
Signed-off-by: Omar Sandoval <osandov@osandov.com>
5 years agoblock/027: fix shellcheck errors
Omar Sandoval [Mon, 6 May 2019 21:24:53 +0000 (14:24 -0700)]
block/027: fix shellcheck errors

tests/block/027:59:35: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/block/027:59:48: note: Double quote to prevent globbing and word splitting. [SC2086]

Signed-off-by: Omar Sandoval <osandov@fb.com>
5 years agoblock: fix fio jobs for 027 and add cgroup support
Dennis Zhou [Wed, 1 May 2019 19:48:38 +0000 (15:48 -0400)]
block: fix fio jobs for 027 and add cgroup support

Previously, the test was broken as "$fio_jobs" was considered as a
string instead of additional parameters. This is fixed here.

Second, there was an issue with earlier kernels when request lists
existed such that request_queues were never being cleaned up because
non-root blkgs took a reference on the queue. However, blkgs were being
cleaned up after the last reference to the request_queue was put back.
This creates a blktest cgroup for the fio jobs to utilize and should be
useful for catching this scenario in the future.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
5 years agoblktests: Use old variable check for Bash <4.2
Jon Derrick [Fri, 3 May 2019 18:28:28 +0000 (12:28 -0600)]
blktests: Use old variable check for Bash <4.2

Bash 4.2 and above supports -v variable checks, which returns true for
set or null. Instead use an older bashism that is compatible with bash
4.1 and earlier but only returns true if the variable is set non-null.
This inherently adds a sanity check in case of null variables.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
5 years agoblock/028: check if T10 verification fails
Ming Lei [Fri, 26 Apr 2019 02:39:37 +0000 (10:39 +0800)]
block/028: check if T10 verification fails

When T10 verification fails, the error code of BLK_STS_PROTECTION
may not be propagated to user space, see mpage_end_io().

So seems the only reliable way for detecting the failure is to
check dmesg.

Cc: Martin K . Petersen <martin.petersen@oracle.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Omar: use DMESG_FILTER]
Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agonvme/012 & 013: avoid extremely slow xfs IO
Ming Lei [Mon, 15 Apr 2019 01:22:29 +0000 (09:22 +0800)]
nvme/012 & 013: avoid extremely slow xfs IO

It is observed that nvme/012 may take ~17 minutes to complete on aarch64,
even worse it may trigger IO timeout on nvme-loop.

Eric and Dave replied that it is because of too small log size on small
disk.

So pass '-l size=32m' to avoid the issue.

With this patch, nvme/012 can be completed in one minute.

Cc: Eric Sandeen <esandeen@redhat.com>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
6 years agoblock/020: dynamically change iodepth if test aio-nr lager than aio-max-nr
Xiao Liang [Sat, 6 Apr 2019 14:27:22 +0000 (22:27 +0800)]
block/020: dynamically change iodepth if test aio-nr lager than aio-max-nr

When system has large count of cpus(eg. 96), the test failed as aio-nr over
aio-max-nr limitation.

This patch continues to use 1024 as default iodepth, but change it if
iodepth*$(nproc) > aio-max-nr.

Signed-off-by: Xiao Liang <xiliang@redhat.com>
6 years agocheck: add zoned sysfs node checking in _test_dev_is_zoned
Yi Zhang [Fri, 22 Mar 2019 08:12:28 +0000 (16:12 +0800)]
check: add zoned sysfs node checking in _test_dev_is_zoned

Some kernel may not have zoned sysfs node, e.g. RHEL7, checking if
it exists first in _test_dev_is_zoned.

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
[Omar: wrap line]
Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoblktests: add userspace IO test
Ming Lei [Tue, 5 Mar 2019 01:50:26 +0000 (09:50 +0800)]
blktests: add userspace IO test

Add one test to cover changes on block passthrough IO interface,
such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
and blk_rq_map_kern().

Signed-off-by: Ming Lei <ming.lei@redhat.com>
6 years agoloop/001: verify all partitions are removed
Dongli Zhang [Thu, 14 Mar 2019 11:45:17 +0000 (19:45 +0800)]
loop/001: verify all partitions are removed

loop/001 does not test whether all partitions are removed successfully
during loop device partition scanning. As a result, the regression
introduced by 0da03cab87e6 ("loop: Fix deadlock when calling
blkdev_reread_part()") can not be detected.

The regression will generate below message in dmesg:

[  464.414043] __loop_clr_fd: partition scan of loop0 failed (rc=-22)

and leave orphan partitions like below:

- /dev/loop0p1
- /sys/block/loop0/loop0p1

This patch verifies all partitions are removed by checking if there is
/sys/block/loopX/loopXpY left. The expected number of partitions left is 0.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
[Omar: check devices and sysfs for both before and after]
Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoloop/001: fix typo 'paritition' to 'partition'
Dongli Zhang [Thu, 14 Mar 2019 11:45:16 +0000 (19:45 +0800)]
loop/001: fix typo 'paritition' to 'partition'

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
6 years agozbd/006: Test revalidate during other I/O requests
Shin'ichiro Kawasaki [Thu, 14 Mar 2019 03:46:33 +0000 (12:46 +0900)]
zbd/006: Test revalidate during other I/O requests

Since SCSI scanning occurs asynchronously, the kernel function
blk_revalidate_disk_zones() called from sd_revalidate_disk() may be
executed while write I/Os are ongoing. As a result,
blk_revalidate_disk_zones() must not cause write I/O errors by changing
zone related parameters of the device queue unless the disk has changed.
This patch allows checking this behavior and catch regressions such as
fixed by commit ccce20fc7968 ("scsi: sd_zbc: Avoid that resetting a zone
fails sporadically").

To trigger disk revalidate, fio is executed with the --loops option
causing the target device file to be closed and reopen at each loop. The
file close triggers disk revalidate and fio starts issuing I/Os before
revalidate completes, resulting in the desired simultaneous parallel
execution of write I/Os and blk_revalidate_disk_zones().

Also move the _find_first_sequential_zone() helper function from zbd/005
to zbd/rc and reuse it in the new test case for target zone selection.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
6 years agoadd checking nvmet module in nvme 002,003,004,015,018 test
Xiao Liang [Wed, 13 Mar 2019 07:13:17 +0000 (15:13 +0800)]
add checking nvmet module in nvme 002,003,004,015,018 test

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Xiao Liang <xiliang@redhat.com>
6 years agoFix checking multiple modules error in _have_modules()
Xiao Liang [Wed, 13 Mar 2019 07:05:11 +0000 (15:05 +0800)]
Fix checking multiple modules error in _have_modules()

Signed-off-by: Xiao Liang <xiliang@redhat.com>
6 years agonvme: test out-of-range I/O access (file backend)
Sagi Grimberg [Mon, 11 Mar 2019 22:18:55 +0000 (15:18 -0700)]
nvme: test out-of-range I/O access (file backend)

Test that we correctly fail an out-of-range access
with a proper NVMe status code.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
6 years agonvme: add udevadm settle before disconnecting
Sagi Grimberg [Wed, 6 Mar 2019 09:46:42 +0000 (01:46 -0800)]
nvme: add udevadm settle before disconnecting

otherwise we can see some I/O failures as udev didn't get enough time
to do its thing.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
6 years agoFix the failure case which will exit with 0
Yi Zhang [Tue, 5 Mar 2019 03:33:19 +0000 (11:33 +0800)]
Fix the failure case which will exit with 0

The return value of a failing test was masked by the zoned test check.
Make sure to return either the original or zoned run failed value.

Fixes: e840e1537dc6 ("config: Introduce RUN_ZONED_TESTS variable and CAN_BE_ZONED flag")
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
6 years agozbd: Change sysfs path for partition devices
Shin'ichiro Kawasaki [Tue, 5 Mar 2019 05:24:47 +0000 (14:24 +0900)]
zbd: Change sysfs path for partition devices

zbd/001 and zbd/002 test cases fail for partition devices because of
sysfs path difference between partition devices and their holder
devices. The size parameter in sysfs path is different between the
partition devices and their holder devices. The holder devices have
nr_zones parameter in sysfs but the partition devices do not.

Utilize _test_dev_is_partition() helper function and TEST_DEV_PART_SYSFS
variable to refer correct sysfs size parameter for the partition devices.
Do not refer sysfs nr_zones parameter for the partition devices. Instead,
calculate the expected nr_zones from device capacity and zone size.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
6 years agocommon: Add _test_dev_is_partition() helper function
Shin'ichiro Kawasaki [Tue, 5 Mar 2019 05:24:46 +0000 (14:24 +0900)]
common: Add _test_dev_is_partition() helper function

To control test conditions unique for partition devices, introduce the
_test_dev_is_partition() helper function. Refer TEST_DEV_PART_SYSFS
variable to tell if the TEST_DEV is a partition device or not.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
6 years agocheck: Add TEST_DEV_PART_SYSFS variable
Shin'ichiro Kawasaki [Tue, 5 Mar 2019 05:24:45 +0000 (14:24 +0900)]
check: Add TEST_DEV_PART_SYSFS variable

When partition devices are specified in TEST_DEV, TEST_DEV_SYSFS
variable points to the sysfs paths of holder devices of the partition
devices (e.g., /sys/block/sda). This sysfs path is different from the
sysfs path of the partition devices (e.g., /sys/block/sda/sda1). For
example, size parameters exist in both the holder device sysfs and
the partition device sysfs with different values.

To allow test cases to access sysfs path of the partition devices,
add TEST_DEV_PART_SYSFS variable. TEST_DEV_SYSFS is set as is to refer
the sysfs path of the holder devices. If the TEST_DEV is not a partition
device, an empty string is set to the TEST_DEV_PART_SYSFS variable.

Rename _find_sysfs_dir() function to _find_sysfs_dirs() and make it find
holder device sysfs as well as the partition device sysfs. The function
obtains the canonical sysfs path, and if the device is a partition
device, the function cuts the last device name in the canonical sysfs
path to obtain the holder device sysfs path.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
6 years agonvme/028: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:48 +0000 (20:42 -0800)]
nvme/028: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/027: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:47 +0000 (20:42 -0800)]
nvme/027: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/026: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:46 +0000 (20:42 -0800)]
nvme/026: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/025: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:45 +0000 (20:42 -0800)]
nvme/025: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/024: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:44 +0000 (20:42 -0800)]
nvme/024: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/023: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:43 +0000 (20:42 -0800)]
nvme/023: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/022: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:42 +0000 (20:42 -0800)]
nvme/022: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme/021: use consistent coding style
Chaitanya Kulkarni [Thu, 21 Feb 2019 04:42:41 +0000 (20:42 -0800)]
nvme/021: use consistent coding style

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agocheck: default CAN_BE_ZONED to 0
Omar Sandoval [Wed, 27 Feb 2019 19:21:10 +0000 (11:21 -0800)]
check: default CAN_BE_ZONED to 0

Otherwise, the srp tests print:

./check: line 433: CAN_BE_ZONED: unbound variable

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoMerge pull request #47 from bvanassche/master
Omar Sandoval [Wed, 27 Feb 2019 19:20:41 +0000 (11:20 -0800)]
Merge pull request #47 from bvanassche/master

srp and nvmeof-mp test improvements

6 years agotests/srp/rc: Avoid triggering "QP creation failed" error messages
Bart Van Assche [Fri, 22 Feb 2019 22:53:14 +0000 (14:53 -0800)]
tests/srp/rc: Avoid triggering "QP creation failed" error messages

Instead of trying to log in to each target port from each initiator
port, only log in to the target ports associated with the RDMA HCA
from which the log in request is sent. This avoids that the SRP
initiator driver logs the following error message when e.g.
attempting to log in to interface lo from an Ethernet interface:
"QP creation failed".

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agotests/srp/rc: Consider all network interfaces
Bart Van Assche [Fri, 22 Feb 2019 22:21:10 +0000 (14:21 -0800)]
tests/srp/rc: Consider all network interfaces

Instead of giving up if a login attempt fails, try all network interfaces.
This patch ensures that login succeeds if the first network interface that
is encountered is down and another network interface is up.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agotests/srp/rc: Simplify log_in()
Bart Van Assche [Fri, 22 Feb 2019 22:05:47 +0000 (14:05 -0800)]
tests/srp/rc: Simplify log_in()

Since the 'sysfsdir' variable is identical to the 'd' variable, leave
out 'sysfsdir' and use 'd' instead. This patch does not change any
functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agotests/srp/rc: Make the output of srp_single_login() less confusing
Bart Van Assche [Fri, 22 Feb 2019 22:17:42 +0000 (14:17 -0800)]
tests/srp/rc: Make the output of srp_single_login() less confusing

Displaying $PWD is not useful inside srp_single_login(). Hence leave
$PWD out.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agotests/srp/rc: Make debugging do_rdma_cm_login() easier
Bart Van Assche [Fri, 22 Feb 2019 22:08:27 +0000 (14:08 -0800)]
tests/srp/rc: Make debugging do_rdma_cm_login() easier

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agonvmeof-mp, srp: Check multipathd version
Bart Van Assche [Thu, 21 Feb 2019 23:18:58 +0000 (15:18 -0800)]
nvmeof-mp, srp: Check multipathd version

The srp tests reliably report data corruption with multipathd versions
before 0.7.0 due to a multipathd bug. Hence verify that the multipathd
version is at least 0.7.0.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agoloop/004: Need to wait for drop caches if block_size is changed
zhengbin [Wed, 20 Feb 2019 09:38:06 +0000 (17:38 +0800)]
loop/004: Need to wait for drop caches if block_size is changed

When i test blktests, loop/004 will be fail. The Key test steps
are as follows:
1. losetup -f --show  /dev/sda
2. src/loblksize /dev/loop0 4096

step 1 will create /dev/loop0. after that, daemon systemd-udevd
will visit and close /dev/loop0 who will add and delete
i_mapping->nrpages.
PS: the operation of systemd-udevd is in the background.

step 2 will set /dev/loop0 block size, linux kernel function
loop_set_block_size has been changed since commit 5db470e229e2
("loop: drop caches if offset or block_size are changed")
+ if (lo->lo_queue->limits.logical_block_size != arg &&
+     lo->lo_device->bd_inode->i_mapping->nrpages) {
+               err = -EAGAIN;
+               pr_warn("%s: loop%d (%s) has still dirty pages\n",
+                       __func__, lo->lo_number, lo->lo_file_name,
+                       lo->lo_device->bd_inode->i_mapping->nrpages);
+               goto out_unfreeze;
+       }
--->maybe systemd-udevd just visited /dev/loop0, this leads to failure

Add a step between 1 and 2.

Signed-off-by: zhengbin <zhengbin13@huawei.com>
6 years agozbd/004: Add zone condition "Closed" for sequential write required zones
Shin'ichiro Kawasaki [Wed, 20 Feb 2019 08:12:28 +0000 (17:12 +0900)]
zbd/004: Add zone condition "Closed" for sequential write required zones

The test case zbd/004 executes write operations for two sequential write
required zones across the zone boundary between them. After the write
operation, the second zone has non-zero write pointer. At that status,
the zone can have not only "Implicit Open" condition but also "Closed"
condition based on zone status management logic of the block zoned device.

Add "Closed" condition to the zone condition check logic in zbd/004. Add
ZONE_COND_CLOSED constant definition in zbd/rc.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
6 years agoblock/024: Increase I/O time
Masato Suzuki [Wed, 20 Feb 2019 08:12:27 +0000 (17:12 +0900)]
block/024: Increase I/O time

The total time spent on write I/Os for the 3 dd executions will be at most
1500 * 3 * 0.5ms = 2250ms, that is, 2.25s. Due to system overhead and
timer triggers, a total write I/O time larger than this value is generally
reported through I/O stat. However, for a system with very low overhead
and/or very precise timers, the reported value can be under 2.5s, leading
to a rounded value equal to 2s, and not the 3s expected.

To avoid the test to fail due to this problem, increase the number of write
I/Os executed so that the total exact I/O time exceeds 2.5s, leading to a
rounded value equal to 3s. The change increases the number of I/Os of the
second and third dd calls to 1800, leading to an exact write I/O time of
(1500 + 1800 * 2) * 0.5 ms = 2.55s.

Signed-off-by: Masato Suzuki <masato.suzuki@wdc.com>
6 years agotravis: streamline config
Omar Sandoval [Wed, 13 Feb 2019 20:56:48 +0000 (12:56 -0800)]
travis: streamline config

- Reorder the testing matrix to more or less the order of importance.
- Don't install libc and libstdc++ explicitly; it's not necessary and
  for some reason it installs a bunch of other packages.
- We only test on Linux, so get rid of the conditional.
- Don't error out if apt update fails, since that seems to happen every
  now and then because some repository changed keys.

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agotravis: run make check
Omar Sandoval [Wed, 13 Feb 2019 20:05:51 +0000 (12:05 -0800)]
travis: run make check

We want to run shellcheck and the other sanity checks on all pushes.
Install the latest stable version of shellcheck, as old versions are
known to have false positives.

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoCONTRIBUTING: add my email address
Omar Sandoval [Wed, 13 Feb 2019 19:47:59 +0000 (11:47 -0800)]
CONTRIBUTING: add my email address

Most people cc me on blktests patches, but let's document it, too, since
I'm not always watching the block mailing list.

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agosrc: check if header exists with -E
Omar Sandoval [Wed, 13 Feb 2019 19:42:02 +0000 (11:42 -0800)]
src: check if header exists with -E

The current HAVE_C_HEADER function creates a -.o file. We don't need to
compile, just run the C preprocessor, so use -E instead of -c.

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoREADME: add Travis status badge
Omar Sandoval [Wed, 13 Feb 2019 19:06:54 +0000 (11:06 -0800)]
README: add Travis status badge

Now that Travis is set up for the repository, let's make it easily
discoverable.

Signed-off-by: Omar Sandoval <osandov@fb.com>
6 years agoMerge pull request #44 from bvanassche/master
Omar Sandoval [Wed, 13 Feb 2019 18:47:22 +0000 (10:47 -0800)]
Merge pull request #44 from bvanassche/master

Multiple srp and nvmeof-mp patches