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>
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>
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>
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>
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
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.
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.
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.
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.
Bart Van Assche [Wed, 2 Jan 2019 03:14:37 +0000 (19:14 -0800)]
tests/srp/rc: Increase maximum request size
A new feature for the SRP initiator and target drivers in kernel v5.0-rc1
is that both the initiator and target drivers support immediate data.
Since the default maximum immediate data size is 8 KB, increase the target
maximum request size such that the SRP initiator can send write requests
with up to 8 KB of immediate data.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Thu, 13 Dec 2018 21:49:20 +0000 (13:49 -0800)]
common/multipath-over-rdma: Skip teardown if $debug has been set
A convenient way to debug the srp and nvmeof-mp tests scripts is to set
the debug variable in common/multipath-over-rdma. Examining what went
wrong during a test is only possible if teardown() is skipped after a
test failure. Make sure that this is the case.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Mon, 11 Feb 2019 16:24:39 +0000 (08:24 -0800)]
Unbreak the continuous integration build
The Travis environment in which the continous integration build is run
does not have the <linux/blkzoned.h> header file. Make sure that the
zbdioctl.c source file builds fine without that header file.
Masato Suzuki [Mon, 28 Jan 2019 13:14:55 +0000 (22:14 +0900)]
zbd/005: Test write ordering
Run a high queue depth direct sequential write fio job to check that
write requests are not being reordered when the deadline scheduler is
used. This test allowed to catch a bug fixed with commit 80e02039721 "block: mq-deadline: Fix write completion handling".
Masato Suzuki [Mon, 28 Jan 2019 13:14:53 +0000 (22:14 +0900)]
zbd/003: Test sequential zones reset
Test zone reset operation to make sure that the BLKRESETZONE ioctl call
works as expected but also that the zone sector remapping that may be
done for logical devices (partitions or dm-linear devices) is correct.
Masato Suzuki [Mon, 28 Jan 2019 13:14:50 +0000 (22:14 +0900)]
tests: Introduce zbd test group
The zoned block device (zbd) test group is used to gather all tests
specific to zoned block devices (null_blk device with zoned mode enabled,
SMR disks, dm-linear on top of zoned devices, etc). Execution of this group
requires that the kernel be compiled with the block layer
CONFIG_BLK_DEV_ZONED option enabled and also requires the null_blk driver
to have zoned mode support (added in kernel 4.19).
This group rc script implements _fallback_null_blk_zoned() helper function
which initailize a null_blk device with zoned mode. Each of the zbd group
test cases calls it in fallback_device() function. This allows the zbd
group test cases fallback to the null_blk device even if the TEST_DEVS
is empty. With this, all tests scripts can be written by only defining
the test_device() function while allowing operation on both null_blk and
user specified devices.
Shin'ichiro Kawasaki [Mon, 28 Jan 2019 13:14:49 +0000 (22:14 +0900)]
src: Introduce zbdioctl program
zbdioctl implements calls to zoned block devices ioctls that are not
supported currently by sys-utils blkzone utility, namely BLKGETZONESZ
and BLKGETNRZONES.
Shin'ichiro Kawasaki [Mon, 28 Jan 2019 13:14:48 +0000 (22:14 +0900)]
check: Introduce fallback_device() and cleanup_fallback_device()
These optional functions can be defined by a test case script. When
defined and TEST_DEVS is empty, the fallback_device() is executed before
runing the test case. The fallback_device() function intializes a virtual
device to run the test case and return the device to be set in TEST_DEVS.
After running the test case, cleanup_fallback_device() is executed to
clean up the device.
This feature allows to run test cases with test_device() function even if
TEST_DEVS is not set in the config, using virtaul devices such as null_blk.
Define CAN_BE_ZONED=1 in block/005, block/006, block/010, block/011,
block/016, block/017, block/020, block/021 and block/023 as all these
tests should execute without any problem against null_blk with zoned
mode enabled or zoned block devices specified in TEST_DEVS.
Shin'ichiro Kawasaki [Mon, 28 Jan 2019 13:14:46 +0000 (22:14 +0900)]
block/004: Adjust fio conditions for zoned block devices
For a random write pattern to a zoned block device, fio requires --direct=1
and --zonemode=zbd options as well as deadline I/O scheduler to be
specified. Specify these options and set the I/O scheduler if the target
device is a zoned block device. Before doing that, also make sure that the
deadline scheduler is available and that fio supports the zbd zone mode.
Set CAN_BE_ZONED flag to run this test case for zoned block devices.
Shin'ichiro Kawasaki [Mon, 28 Jan 2019 13:14:45 +0000 (22:14 +0900)]
common: Introduce _have_fio_zbd_zonemode() helper function
Fio zbd zone mode is necessary for zoned block devices. Introduce the
helper function _have_fio_zbd_zonemode() to check that the installed
fio version supports the option --zonemode=zbd.
Shin'ichiro Kawasaki [Mon, 28 Jan 2019 13:14:44 +0000 (22:14 +0900)]
config: Introduce RUN_ZONED_TESTS variable and CAN_BE_ZONED flag
To allow running tests using a null_blk device with the zoned mode
disabled (current setup) as well as enabled, introduce the config
the RUN_ZONED_TESTS config variable and the per-test flag CAN_BE_ZONED.
RUN_ZONED_TESTS=1 indicates that tests run against null_blk will be
executed twice, first with null_blk as a regular block device
(RUN_FOR_ZONED=0) and a second time with null_blk set as a zoned block
device (RUN_FOR_ZONED=1). This applies only to tests cases that have the
variable CAN_BE_ZONED set to 1, indicating that the test case applies to
zoned block devices. If CAN_BE_ZONED is not defined by a test case, the
test is executed only with the regular null_blk device.
_init_null_blk is modified to prepare null_blk as a zoned blocked device
if RUN_FOR_ZONED is set and as a regular block device otherwise. To avoid
"modprobe -r null_blk" failures, rmdir calls on all sysfs nullbX
directories is added.
When a zoned block device is specified in TEST_DEVS, failures of test
cases that do not set CAN_BE_ZONED are avoided by automatically skipping
the test. The new helper function _test_dev_is_zoned() is introduced to
implement this.
The use of the RUN_ZONED_TESTS variable requires that the kernel be
compiled with CONFIG_BLK_DEV_ZONED enabled.
Jan Kara [Mon, 21 Jan 2019 12:02:03 +0000 (13:02 +0100)]
loop: Add test for changing capacity when filesystem is mounted
Add test for changing capacity of a loop device when a filesystem with
non-default block size is mounted on it. This is a regression test for
"blockdev: Fix livelocks on loop device".
Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
[Omar: mount under $TMPDIR] Signed-off-by: Omar Sandoval <osandov@fb.com>
Theodore Ts'o [Mon, 7 Jan 2019 21:09:31 +0000 (16:09 -0500)]
src/sg/syzkaller1.c: fix portability problem for syscall(__NR_mmap, ...)
How mmap is mapped to a raw system call varies across different
architectures. On some architectures (such as 32-bit ARM), __NR_mmap
may not exist at all; glibc will use __NR_mmap2 to implement mmap(2).
Syzkaller is using mmap() as a non-portable version of malloc(3), so
it should be safe to use the glibc's mmap wrapper instead of trying to
directly call the system call.
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Dennis Zhou [Thu, 20 Dec 2018 18:18:26 +0000 (12:18 -0600)]
blktests: add Ming Lei's scsi-stress-remove
This test exposed a race condiiton when shutting down a request_queue
with active IO against it and blkg association for the IOs [1]. The
issue ended up being that while the request_queue will just start
failing requests, blkg destruction sets the q->root_blkg to %NULL. This
caused a NPE. This was fixed in [2].
So to help prevent this from happening again, integrate Ming's test into
blktests so that it can more easily be ran. Here I've ported it to fit
better into the blktests framework.
Dennis Zhou [Thu, 20 Dec 2018 18:18:25 +0000 (12:18 -0600)]
blktests: split out cgroup2 controller and file check
This is a prep patch for a new test that will race blkg association and
request_queue cleanup. As blkg association is a underlying cgroup io
controller feature, we need the ability to check if the controller is
available.
Josef Bacik [Wed, 5 Dec 2018 15:34:03 +0000 (10:34 -0500)]
blktests: add cgroup2 infrastructure
In order to test io.latency and other cgroup related things we need some
supporting helpers to setup and tear down cgroup2. This adds support
for checking that we can even configure cgroup2 things, set them up if
need be, and then add the cleanup stuff to the main cleanup function so
everything is always in a clean state.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[Omar: split into separate file, fix shellcheck errors, rework
cleanup/exit] Signed-off-by: Omar Sandoval <osandov@fb.com>
Omar Sandoval [Tue, 18 Dec 2018 20:15:56 +0000 (12:15 -0800)]
scsi/006: allow changing cache_type to fail
Some devices don't support all cache types. Allow setting the cache type
to fail with EINVAL. On success, make sure it was changed to the desired
value.
Bart Van Assche [Tue, 27 Nov 2018 20:57:11 +0000 (12:57 -0800)]
common/multipath-over-rdma: Retry unloading rdma_rxe if necessary
If any context, e.g. queued work, holds a reference on an rdma_rxe
device then it can happen that the first unload attempt fails. Try
several times to unload that kernel module if the first unload
attempt fails.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Thu, 1 Nov 2018 15:25:27 +0000 (08:25 -0700)]
src/sg/syzkaller1.c: Fix a 32-bit compiler warning
Avoid that clang reports the following warning when building in 32-bit mode:
sg/syzkaller1.c:405:34: error: implicit conversion from 'unsigned long long' to
'uintptr_t' (aka 'unsigned int') changes value from 18446744073709551615
to 4294967295 [-Werror,-Wconstant-conversion]
0x32ul, 0xfffffffffffffffful, 0x0ul, 0, 0, 0);
^~~~~~~~~~~~~~~~~~~~
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Mon, 29 Oct 2018 21:34:00 +0000 (14:34 -0700)]
src/discontiguous-io: Do not shadow variables
Avoid using variables in an inner scope with the same name as variables in
an outer scope. Enable the -Wshadow compiler flag for C and C++ source
files such that in the future the compiler will complain about shadowing.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Theodore Ts'o [Tue, 30 Oct 2018 14:36:49 +0000 (10:36 -0400)]
Fix build failure for discontiguous-io on 32-bit platforms
Avoid that building with a 32-bit compiler fails as follows:
discontiguous-io.cpp:294:34: error: no matching function for call to 'min(long unsigned int, size_t)'
std::min(4ul, len - i * 4));
^ Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bvanassche: elaborated commit message] Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Jan Kara [Thu, 18 Oct 2018 10:31:47 +0000 (12:31 +0200)]
loop/006: Add test for oops during backing file verification
Add regression test for patch "block/loop: Use global lock for ioctl()
operation." where we can oops while traversing list of loop devices
backing newly created device.
Signed-off-by: Jan Kara <jack@suse.cz>
[Omar: rename to 006, change description] Signed-off-by: Omar Sandoval <osandov@fb.com>
Jens Axboe [Thu, 25 Oct 2018 20:49:04 +0000 (14:49 -0600)]
blktest: remove instances of null_blk queue_mode=1
This is no longer supported in recent kernels, get rid of any testing of
queue_mode=1. queue_mode=1 tested the legacy IO path, which is going
away completely. As such, there's no point in doing anymore testing with
it.
Add a series of tests for the NVMeOF drivers on top of the dm-mpath
driver. These tests are similar to the tests under tests/srp. Both
tests use the dm-mpath driver for multipath and the loopback
functionality of the rdma_rxe driver. The only difference is that the
nvmeof-mp tests use the NVMeOF initiator and target drivers instead
of the SRP initiator and target drivers.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
tests/srp: Remove /etc/multipath.conf after a test has finished
Instead of removing /etc/multipath.conf before a test starts, remove it
after a test has finished. This change is needed to let the nvmeof-mp
tests run after the srp tests have been run.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Linux kernel commit ca4b2a011948 ("null_blk: add zone support") broke
null_blk queue_mode=0. None of the existing tests use bio mode, so add a
test which does a very basic test of all modes.
Omar Sandoval [Fri, 10 Aug 2018 18:07:59 +0000 (11:07 -0700)]
Delete nvme/001
Johannes pointed out that the format of this tracepoint is going to
change in 4.19, which will make this test fail. Now that we have a slew
of real NVMe tests, we can do without this one. We can always add it
back if we decide it's useful later.