Bart Van Assche [Tue, 3 Oct 2023 21:46:37 +0000 (14:46 -0700)]
scsi/008: Test SCSI disk data lifetime support
SCSI disk data lifetime support is available since kernel v6.9-rc1.
See also https://lore.kernel.org/linux-scsi/3b789eacddd6265921be9da6e15257908f29b186.camel@HansenPartnership.com/.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Yi Zhang [Sun, 7 Apr 2024 03:17:52 +0000 (11:17 +0800)]
nvme/rc: fix shellcheck warning SC2086
tests/nvme/rc:1056:7: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvme/rc:1057:7: note: Double quote to prevent globbing and word splitting. [SC2086]
The warnings are observed with ShellCheck version 0.8.0. They are not
observed with ShellCheck version 0.9.0 and 0.10.0.
Fixes: 369d310 ("nvme: Add passthru error logging tests to nvme/039") Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
[Shin'ichiro: noted ShellCheck version dependency] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:14:01 +0000 (14:14 +0100)]
nvme: don't assume namespace id
The tests assume that the namespace id is always 1. This might not be
correct in future (e.g. running real targets), thus harden the test by
using the uuid to lookup the correct namespace id.
The passthru test already do this, so it makes also sense to update the
other tests as well.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:59 +0000 (14:13 +0100)]
nvme: drop default subsysnqn argument from _nvmet_passthru_target_connect
Remove the last positional argument for _nvmet_passthru_target_connect
which most test pass in the default subsysnqn anyway. There is little
point in cluttering all the test textual noise.
While at it, also use subsysnqn as variable name everywhere, instead of
subsys_name.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:58 +0000 (14:13 +0100)]
nvme: drop default subsysnqn argument from _nvme_passthru_target_{setup|cleanup}
Remove the last positional argument for
_nvme_passthrue_target_{setup|cleanup} which most test pass in the
default subsysnqn anyway. There is little point in cluttering all the
test textual noise.
While at it, also use subsysnqn as variable name everywhere, instead of
subsys_name.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
[Shin'ichiro: dropped the change for _nvme_disconnect_subsys in nvme/037] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:57 +0000 (14:13 +0100)]
nvme: drop default subsysnqn argument from _nvme_{connect|disconnect}_subsys
Remove the last positional argument for
_nvme_{connect|disconnect}_subsys which most test pass in the default
subsysnqn anyway. There is little point in cluttering all the test
textual noise.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:56 +0000 (14:13 +0100)]
nvme: drop default trtype argument for _nvmet_passthru_target_connect
Every invocation of _nvmet_passthru_target_connect passes in the default
nvme_trtype argument. The argument is not evaluated anymore, thus just
remove it.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:55 +0000 (14:13 +0100)]
nvme: drop default trtype argument for _nvmet_connect_subsys
Every invocation of _nvmet_connect_subsys passes in the default
nvme_trtype argument. nvme/rc also assumes the test is always using
nvme_trtype for trtype (e.g. cleanup code paths), thus just drop
this argument.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:46 +0000 (14:13 +0100)]
common/xfs: propagate errors from _xfs_run_fio_verify_io
If _xfs_mkfs_and_mount fails _xfs_run_fio_verify_io will continue to
execute and fio will run against the local file system instead against
the block device.
Propagate all errors back to the caller.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:45 +0000 (14:13 +0100)]
nvme/rc: log error if stale configuration is found
It's possible that a previous run of blktest left some stale
configuration left. E.g. when the module unload doesn't work (the bug
might in the kernel we are testing). In this case error out and avoid
confusion.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Tue, 26 Mar 2024 13:13:44 +0000 (14:13 +0100)]
nvme/rc: silence fcloop cleanup failures
When the ctl file is missing we are logging
tests/nvme/rc: line 265: /sys/class/fcloop/ctl/del_target_port: No such file or directory
tests/nvme/rc: line 257: /sys/class/fcloop/ctl/del_local_port: No such file or directory
tests/nvme/rc: line 249: /sys/class/fcloop/ctl/del_remote_port: No such file or directory
because the first redirect operator fails. Also it's not possible to
redirect the 'echo' error to /dev/null, because it's a builtin command
which escapes the stderr redirect operator (why?).
Anyway, the simplest way to catch this error is to first check if the
control file exists before attempting to write to it.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Mon, 4 Mar 2024 13:48:26 +0000 (14:48 +0100)]
nvme/048: make queue count check retry-able
We are racing with the reset path of the controller. That means, when we
set a new queue count, we might not observe the resetting state in time.
Thus, first check if we see the correct queue count and then the
controller state.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
[Shin'ichiro: removed unnecessary if block in nvmf_check_queue_count()] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Christoph Hellwig [Thu, 29 Feb 2024 14:34:27 +0000 (06:34 -0800)]
nbd/001: wait for the device node to show up before running parted
The parted call can happen before the device is settled and thus fail.
Currently this happens very rarely for me (about 1 in 500 runs), but
a pending change to freeze the queues for updating the limits will make
it much more likely to hit.
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Alan Adamson [Wed, 21 Feb 2024 18:36:40 +0000 (10:36 -0800)]
nvme: Add passthru error logging tests to nvme/039
Tests the ability to enable and disable error logging for passthru admin
commands issued to the controller and passthru IO commands issued to a
namespace.
These tests will only be run on kernels that export the
passthru_err_log_enabled attribute.
Daniel Wagner [Wed, 21 Feb 2024 07:43:53 +0000 (08:43 +0100)]
nvme/029: reserve hugepages for lager allocations
The test is issuing larger IO workload. This depends on being able to
allocate larger chunks of linear memory. nvme-cli used to use libhugetlb
to automatically allocate the HugeTLB pool. Though nvme-cli dropped the
dependency on the library, thus the test should try to provision the
system accordingly.
Link: https://github.com/linux-nvme/nvme-cli/issues/2218 Reported-by: Yi Zhang <yi.zhang@redhat.com> Tested-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Yi Zhang [Tue, 20 Feb 2024 14:55:52 +0000 (22:55 +0800)]
nbd/001: change to use lsblk raw output format
lsblk -n ouput format changed due to the substantial changes
in libsmartcols, which lsblk relies on for generating output,
fix it by using the raw format
Fixes: #132 Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Daniel Wagner [Mon, 12 Feb 2024 10:40:46 +0000 (11:40 +0100)]
nvme/rc: revert nvme-cli context tracking
This feature is not needed anymore, after fixing nvmet-fc. The nvmet
target code is able to handle parallel operations and doesn't crash
anymore. Furthermore, it can't prevent from discovery controller created
by the udev rules, so let's rip it out.
Daniel Wagner [Mon, 12 Feb 2024 10:40:45 +0000 (11:40 +0100)]
nvme/rc: do not issue errors when disconnecting when using fc transport
When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running.
The cleanup code expects that all devices are under blktests control,
but this isn't the case. Thus filter out disconnect failures as well.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Mon, 12 Feb 2024 10:40:44 +0000 (11:40 +0100)]
nvme/rc: do not issue warnings on cleanup when using fc transport
When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running.
The cleanup code expects that all devices are under blktests control,
but this isn't the case. So just disable the warning as it is reporting
a lot of false positives.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Mon, 12 Feb 2024 10:40:43 +0000 (11:40 +0100)]
nvme/rc: filter out errors from cat when reading files
When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running. This races with the cleanup code and also the
_find_nvme_dev() which iterates over all device entries and tries to
read the connect of transport and subsysnqn sysfs attributes. Since
these steps are not locked in anyway, the resources can go away in
between.
Thus filter out 'cat' reporting non existing subsysnqn or transport
attributes. The tests will still fail if they can't find the device etc.
But without filtering these errors out the tests fail randomly.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Mon, 12 Feb 2024 10:40:42 +0000 (11:40 +0100)]
nvme/029: fix local variable declarations
The syntax for local variables declarations uses whitespace as separator
and not commas:
tests/nvme/029: line 24: local: `bs,': not a valid identifier
tests/nvme/029: line 24: local: `size,': not a valid identifier
tests/nvme/029: line 24: local: `img,': not a valid identifier
Shin'ichiro Kawasaki [Fri, 26 Jan 2024 06:10:37 +0000 (15:10 +0900)]
nvme/046: change nvme io-passthru command option from -o to --opcode
A recent commit in nvme-cli v2.6 changed the single letter of the
--opcode option from -o to -O. This caused the failure of nvme/046. To
make the test case work regardless of the nvme-cli version, replace -o
with --opcode.
Shin'ichiro Kawasaki [Thu, 11 Jan 2024 09:00:38 +0000 (18:00 +0900)]
block/031: allow to run with built-in null_blk driver
The test case block/031 sets the null_blk parameter shared_tag_bitmap=1
for testing. The parameter has been set as a module parameter, so the
null_blk driver must be loadable. However, null_blk allows you to set
shared_tag_bitmap as a configfs parameter since the kernel commit 7012eef520cb ("null_blk: add configfs variables for 2 options"). The
test case can now be run with the built-in null_blk driver by specifying
shared_tag_bitmap through configfs.
Modify the test case for that purpose. Refer to the null_blk feature
list and check if shared_tag_bitmap can be specified through configfs.
If so, specify the parameter as an option of _configure_null_blk and set
it through configfs. If not, check in requires() that shared_tag_bitmap
can be specified as a module parameter. Then call _init_null_blk() in
test() and specify shared_tag_bitmap=1 at null_blk module load.
Also, change the null_blk device name from nullb0 to nullb1 since the
default null_blk device name nullb0 is not usable with the built-in
null_blk driver.
Shin'ichiro Kawasaki [Thu, 11 Jan 2024 09:00:37 +0000 (18:00 +0900)]
common/null_blk: introduce _have_null_blk_feature
Introduce a helper function _have_null_blk_feature which checks
/sys/kernel/config/features. It allows test cases to adapt to null_blk
feature support status.
Shin'ichiro Kawasaki [Wed, 13 Dec 2023 08:46:19 +0000 (17:46 +0900)]
block/007: skip hybrid polling tests when kernel does not support it
Since the kernel commit 54bdd67d0f88 ("blk-mq: remove hybrid polling"),
kernel does not support hybrid polling. The test case block/007
specifies auto-hybrid and fixed-hybrid polling for testing. But it is
confusing and meaningless when kernel does not support it. Check if
kernel supports hybrid polling. If not, skip the hybrid polling tests.
Shin'ichiro Kawasaki [Tue, 31 Oct 2023 00:19:13 +0000 (09:19 +0900)]
block/011: set default timeout to 20 minutes
The test case runs fio while disabling and enabling PCI device of the
test target block device. Depending on the device type, it takes very
long time to re-enable the device. At worst case, it takes 4 hours to
complete the test case.
To avoid the meaningless long test runtime, set default timeout limit. I
ran the test case on various devices: real NVME SSD, QEMU NVME
emulation, HDDs with AHCI, HDDs with SAS-HBA. Many of them takes less
than 20 minutes to complete and pass the test case. Hence, choose 20
minutes as the timeout duration.
Shin'ichiro Kawasaki [Mon, 30 Oct 2023 00:44:10 +0000 (09:44 +0900)]
block/011: recover test target devices to online or live status
The test case runs fio while disabling and enabling PCI device of the
test target block device. This often leaves the devices in offline or
dead status. For example, when the block device is a HDD connected to
HBA, kernel makes the device into offline mode with this message:
sd x:x:x:x Device offlined - not ready after error recovery
This causes following test cases to fail. To avoid the failure, remove
and rescan the devices to get them back to online or live status. This
improvement is similar as the commit f8f33218eca7 ("block/011: recover
test target NVME device capacity"). While at this change, improve code
comments for the commit f8f33218eca7, and add missing local variable
declarations.
Of note is that the added rescan operation triggers a lockdep WARN if
the system has devices which depend on P2SB [1].
Shin'ichiro Kawasaki [Wed, 29 Nov 2023 11:36:15 +0000 (20:36 +0900)]
loop/009: require --option of udevadm control command
The test case loop/009 calls udevadm control command with --ping option.
When systemd version is prior to 241, udevadm control command does not
support the option, and the test case fails. Check availability of the
option to avoid the failure.
Shin'ichiro Kawasaki [Mon, 20 Nov 2023 02:49:31 +0000 (11:49 +0900)]
nvme/{041,042,043,044,045}: check dhchap_ctrl_secret support by nvme-fabrics
The kernel commit d68006348288 ("nvme: rework NVME_AUTH Kconfig
selection") in v6.7-rc1 introduced a new kernel config option
NVME_HOST_AUTH. When the option is disabled, nvme test cases from 041 to
045 fail because nvme-fabrics module does not support the feature
dhchap_ctrl_secret.
To check the requirement, add _require_kernel_nvme_fabrics_feature()
which refers /dev/nvme-fabrics and checks if the specified feature
string is found or not. Call it to check dhchap_ctrl_secret support in
require() of the test cases.
This change relies on the kernel commit 1697d7d4c5ef ("nvme: blank out
authentication fabrics options if not configured").
Suggested-by: Daniel Wagner <dwagner@suse.de> Suggested-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Hannes Reinecke [Fri, 17 Nov 2023 12:05:50 +0000 (21:05 +0900)]
nvme: do not print subsystem NQN to stdout
The subsystem NQN might be changed from the default value, but
that shouldn't cause the tests to fail. So don't register the
subsystem NQN in the 'out' files to avoid a false positive.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: remove only subsystem NQN from nvme disconnect message] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Hannes Reinecke [Fri, 17 Nov 2023 12:05:49 +0000 (21:05 +0900)]
nvme: do not print UUID to log files
The UUID/wwid of a namespace might be assigned externally, so
we shouldn't register it in the 'out' files.
The current checks for UUID/wwid are just there to ensure that
if a UUID is present is should match the wwid setting.
So rather add a function _check_uuid() which does exactly that
and don't register the actual UUID in the 'out' files.
[Shin'ichiro: added check against def_subsys_uuid in _check_uuid()]
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Ming Lei [Mon, 13 Nov 2023 13:35:03 +0000 (21:35 +0800)]
common/ublk: allow to run ublk test without building miniublk
Now `rublk` is enough for supporting ublk test, not necessary to build
miniublk any more.
Convert ublk common helpers into ${UBLK_PROG}.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Shin'ichiro: fixed a shellcheck warning] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Akinobu Mita [Sat, 4 Nov 2023 12:17:42 +0000 (21:17 +0900)]
src/miniublk: fix logical block size setting
The miniublk always sets the logical block size to 512 bytes when setting
a regular file-backed loop target.
A test fails if the regular file is on a filesystem built on a block
device with a logical block size of 4KB.
The logical block size of the ublk block device is set to 512 bytes,
so a request that is not 4KB aligned may occur, and the miniublk will
attempt to process it with direct IO and fail.
The original ublk program already fixed this problem by determining
the logical block size to set based on the block device to which the
target regular file belongs.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Thu, 12 Oct 2023 02:11:51 +0000 (11:11 +0900)]
nvme/{rc,017,031}: replace def_file_path with _nvme_def_file_path()
The commit b6356f6 ("nvme/rc: Add common file_path name define") defined
a global variable 'def_file_path' in nvme/rc, which refers TMPDIR.
However, when nvme/rc is sourced and def_file_path is defined for the
nvme test group, TMPDIR is not yet defined since TMPDIR is defined for
each test case. Then an unexpected path is set to def_file_path and
temporary files are created at the unexpected path.
Fix this by replacing the global variable def_file_path with a helper
function _nvme_def_file_path(). This helper function allows to refer
TMPDIR not at nvme/rc source timing but in test() or test_device()
context of each test case.
Reported-by: Yi Zhang <yi.zhang@redhat.com> Fixes: b6356f6 ("nvme/rc: Add common file_path name define") Reviewed-by: Daniel Wagner <dwagern@suse.de> Reviewed-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Thu, 5 Oct 2023 08:02:42 +0000 (17:02 +0900)]
nvme/rc: fix rdma driver check
Since the commit 4824ac3f5c4a ("Skip tests based on SKIP_REASON, not
return value"), blktests no longer checks return values of _have_foo
helpers. Instead, it checks if _have_foo helpers set SKIP_REASON, which
was renamed to SKIP_REASONS later, to judge test case skip. If two
_have_foo helpers are chained with ||, the skip check does not work as
expected since one of the helper may set SKIP_REASONS even when the
other does not set. Such chain with || is done in _nvme_requires() to
check rdma drivers.
To fix the check, do not chain the helper functions with || operator.
Instead, refer $use_rxe to call only the required function.
Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
The test case nbd/004 disconnects /dev/nbd0 in most cases, but sometimes
leaves it in connected status. The test case stops the nbd server then
/dev/nbd0 does not work even when it is in connected status. This makes
"udevadm settle" command to wait for nbd udev events infinitely and
causes failures of following test cases.
There are two causes of the left connection. The first cause is left
nbd-client process. The test case waits for completion of its child
process connect_and_disconnect. However, it does not wait for completion
of nbd-client process that connect_and_disconnect spawns. After the test
case end, the left nbd-client process establishes the connection of
/dev/nbd0. The second cause is missing disconnect operation. The
connect_and_disconnect process repeats _netlink_connect and
_netlink_disconnect. When this process is killed after _netlink_connect
and before _netlink_disconnect, the connected status is left.
To avoid the left connection, wait for nbd-client process completion
and call _netlink_disconnect at the test case end.
Bart Van Assche [Tue, 22 Aug 2023 16:57:07 +0000 (09:57 -0700)]
Change the default RDMA driver from rdma_rxe to siw
Since the siw driver is more stable than the rdma_rxe driver, change the
default into siw. See e.g.
https://lore.kernel.org/all/c3d1a966-b9b0-d015-38ec-86270b5045fc@acm.org/.
Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Bart Van Assche [Wed, 23 Aug 2023 17:57:50 +0000 (10:57 -0700)]
tests/srp/rc: Reduce the number of channels
Login failures have been observed with the default number of channels
(ch_count) and dynamic debug enabled on a system with a large number of
CPU cores (72). Hence reduce the number of channels.
Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Thu, 31 Aug 2023 06:25:45 +0000 (15:25 +0900)]
block/002,scsi/007,zbd/003: remove options for shellcheck SC2119
The commits 852996fea4f1 and 45b203cce8ba added options of a few
function calls to avoid the shellcheck warning SC2119. After that,
SC2119 was disabled with the commit 3d1c0fe2677d. Then the added options
are no longer needed. Remove them to clean up.
Daniel Wagner [Wed, 30 Aug 2023 09:20:18 +0000 (11:20 +0200)]
nvme/{033,034,035,036,37}: drop port handle between passthru target setup and cleanup
The passthru nvmet setup and cleanup helpers are using the port as
handle to track resources.
Instead returning the port from the setup call, we figure out in the
cleanup code which resources have been allocated. This avoids passing
around awkward handles.
The commit enabled the shellcheck warning SC2119 based on the
understanding that bash would pass arguments list "$@" from caller to
callee when functions are called without arguments. However, it was not
correct then merit of SC2119 is not so important. On the other hand,
SC2119 reports false positive warning when bash functions take optional
arguments and they are called without arguments.
Per discussion on the list [1], we concluded that the merit of optional
arguments is larger than that of SC2119. Hence, disable SC2119 again.
Shin'ichiro Kawasaki [Thu, 17 Aug 2023 05:21:30 +0000 (14:21 +0900)]
nvme: remove "udevadm settle" after _nvme_connect_subsys
The previous commit introduced "udevadm settle" command at the end of
_nvme_connect_subsys. Then the command is no longer required after
calling _nvme_connect_subsys in test cases.
Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Thu, 10 Aug 2023 11:17:51 +0000 (20:17 +0900)]
nvme/rc: fix nvme device readiness check after _nvme_connect_subsys
The helper function _nvme_connect_subsys() creates a nvme device. It may
take some time after the function call until the device gets ready for
I/O. So it is expected that the test cases call _find_nvme_dev() after
_nvme_connect_subsys() before I/O. _find_nvme_dev() returns the path of
the created device, and it also waits for uuid and wwid sysfs attributes
of the created device get ready. This wait works as the wait for the
device I/O readiness.
However, this wait by _find_nvme_dev() has two problems. The first
problem is missing call of _find_nvme_dev(). The test case nvme/047
calls _nvme_connect_subsys() twice, but _find_nvme_dev() is called only
for the first _nvme_connect_subsys() call. This causes too early I/O to
the device with tcp transport [1]. Fix this by moving the wait for the
device readiness from _find_nvme_dev() to _nvme_connect_subsys(). Also
add --no-wait option to _nvme_connect_subsys(). It allows to skip the
wait in _nvmet_passthru_target_connect() which has its own wait for
device readiness.
The second problem is wrong paths for the sysfs attributes. The paths
do not include namespace index, so the check for the attributes always
fail. Still _find_nvme_dev() does 1 second wait and allows the device
get ready for I/O in most cases, but this is not intended behavior.
Fix this by checking sysfs paths with the namespace index. Get list of
namespace indices for the sub-system and do the check for all indices.
On top of the checks for sysfs attributes, add 'udevadm settle' and a
check for the created device file. These ensures that the create device
is ready for I/O.
Daniel Wagner [Fri, 11 Aug 2023 09:36:13 +0000 (11:36 +0200)]
nvme: Add explicitly host to allow_host list
Only allow to connect to our setup target with the correct hostnqn.
Thus we have to explicitly add the test hostnqn to the test subsysnqn
allow_host list.
In nvme/030 the genctr is updated as side effect by writing the
attr_allow_any_host variable. Though writting to attr_allow_any_host is
not allowed after switching to the allow_host list. We can achieve the
same effect by adding and removing the host to the allow_host list.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Fri, 11 Aug 2023 09:36:07 +0000 (11:36 +0200)]
nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid
Commit acc408477e85 ("nvme/{041,042,043,044,045,048}: Use default
hostnqn and hostid") switched the test over to use the default
hostnqn. It missed the change to remove the local variable and
use the def_hostnqn/def_hostid directly.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Daniel Wagner [Fri, 11 Aug 2023 09:36:02 +0000 (11:36 +0200)]
nvme/{003,004,005,013,046,049}: Group all variables declarations
Group all variable declarations together at the beginning of the
function. Many of the nvme tests do this but not all. Thus make these
tests use the same style. This allows to spot the odd balls in the
refactoring of the tests.
Signed-off-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Fri, 4 Aug 2023 12:20:07 +0000 (21:20 +0900)]
block/004: reset zones of TEST_DEV before fio operation
When test target is a zoned block device with max_active_zones limit
larger than max_open_zones, fio write operation may fail depending on
zone conditions. To avoid the failure, reset zones of the device before
the fio run.
CONTRIBUTING, README: recommend patch post for contributions
There are voices that blktests changes through GitHub pull requests are
not visible to relevant block sub-system kernel developers who
communicate through linux-block mailing list. Some GitHub pull requests
in the past needed additional discussion in the linux-block mailing list
again to confirm that the changes were good for the kernel developers.
To reduce the repeated discussion in the mailing list and GitHub,
clarify that contribution by patch post to linux-block is preferred to
GitHub pull request. Still GitHub pull requests are open mainly for
quick, minor fixes.
The knowledge required to implement blktests test cases are documented
in './new' script which generates test case script template. This is
handy when we implement new test cases. However, it is difficult to
refer the documentation when we do not implement new test cases.
To help to refer the documentation, add a pointer to it and describe
what it documents.
It was guided for test statements in blktests scripts to use double
square brackets [[ ]] form instead of single square brackets [ ] form.
However, a number of patch contributors use [ ]. It is not productive to
replace them with [[ ]] and discouraging contributions. To avoid those
drawbacks, allow both forms and still keep [[ ]] as the preferred form.
While at it, fix a typo.
Theodore Ts'o [Thu, 3 Aug 2023 21:20:52 +0000 (17:20 -0400)]
src/Makefile: fix static linking of miniublk
When using static linking, the libraries need to be placed after the
.o or .c files so they are searched. Otherwise, the build will fail:
cc -O2 -Wall -Wshadow -DHAVE_LINUX_BLKZONED_H -D_GNU_SOURCE -lpthread -luring -o miniublk miniublk.c
/bin/ld: /tmp/ccfjiUvb.o: in function `ublk_ctrl_init':
miniublk.c:(.text+0xaeb): undefined reference to `io_uring_queue_init_params'
/bin/ld: /tmp/ccfjiUvb.o: in function `ublk_queue_deinit':
miniublk.c:(.text+0xb73): undefined reference to `io_uring_unregister_ring_fd'
/bin/ld: miniublk.c:(.text+0xb85): undefined reference to `io_uring_unregister_files'
/bin/ld: /tmp/ccfjiUvb.o: in function `ublk_io_handler_fn':
miniublk.c:(.text+0xd62): undefined reference to `io_uring_queue_init_params'
/bin/ld: miniublk.c:(.text+0xd77): undefined reference to `io_uring_register_ring_fd'
/bin/ld: miniublk.c:(.text+0xd8c): undefined reference to `io_uring_register_files'
/bin/ld: miniublk.c:(.text+0xe94): undefined reference to `io_uring_submit_and_wait_timeout'
/bin/ld: /tmp/ccfjiUvb.o: in function `__ublk_ctrl_cmd':
miniublk.c:(.text+0x14a6): undefined reference to `io_uring_submit'
/bin/ld: miniublk.c:(.text+0x1533): undefined reference to `__io_uring_get_cqe'
collect2: error: ld returned 1 exit status
make: *** [Makefile:61: miniublk] Error 1
Bart Van Assche [Mon, 12 Jun 2023 19:52:28 +0000 (19:52 +0000)]
common/scsi_debug: Use _unload_module() instead of modprobe -r
It may happen that unloading the scsi_debug kernel module fails a few
times before it finally succeeds. Fix this by using _unload_module
instead of modprobe -r.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
The test cases block/004, zbd/005 and zbd/006 do write to zoned block
devices which require mq-deadline scheduler. When TEST_DEV is a bio
based device-mapper, mq-deadline scheduler shall be set to destination
devices. For this purpose, call _test_dev_set_scheduler instead of
_test_dev_queue_set.
The test case block/005 requires TEST_DEV to have the queue/scheduler
sysfs attribute. However, kernel no longer provides the attribute since
version 6.5. Add the helper function _require_test_dev_sysfs to check
the requirement.
common/{rc,dm}: introduce functions to set scheduler of dm destinations
Since version v6.5, kernel no longer provides scheduler sysfs attribute
of bio based device-mapper. If TEST_DEV is a bio based device-mapper and
the test case requires specific scheduler, it is required to modify
sysfs attributes of destination devices instead of TEST_DEV.
To set scheduler to the sysfs attribute of destination devices, add the
helper function _dm_destination_dev_set_scheduler. It saves the original
scheduler value in the associative array SYSFS_QUEUE_SAVED so that it is
restored at each test case end. Also add _test_dev_set_scheduler which
sets scheduler regardless whether TEST_DEV is a bio based device-mapper
or not.
Current implementation saves sysfs attributes under queue/ directory
in the associative array TEST_DEV_QUEUE_SAVED using attribute file names
as keys. The saved attributes are restored after each test case run.
When TEST_DEV is a device-mapper, this attribute restore does not cover
attributes of device-mapper destination devices. As a preparation to
cover the destination devices, use path of the attributes as keys
instead of file names. Also rename the associative array
TEST_DEV_QUEUE_SAVED to SYSFS_QUEUE_SAVED.
common/ublk: avoid modprobe failure for built-in ublk_drv
When ublk_drv driver is not a loadable module but a built-in module,
modprobe for the driver fails in _init_ublk. This results in unexpected
test case skips with the message "requires ublk_drv".
To not skip the test cases with built-in ublk_drv, call modprobe only
when the driver is loadable and its module file exists. Also, do not set
SKIP_REASONS to handle modprobe failure as test case failure.
Fixes: 840ccf1fc33e ("block/033: add test to cover gendisk leak") Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>