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.
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.
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>
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>
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>
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>
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>
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>
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>
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.
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.
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 :(
```
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>
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>
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>
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>
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.
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).
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.
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
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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>
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.
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.
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>
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]
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.
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>
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>
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>
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().
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>
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.
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.
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.
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.