NVMe Target Passthru Block Tests
Subsystems (2)
v2 cover NVMe Target Passthru Block Tests
Hi,
This series adds blktests for the nvmet passthru feature that was merged for 5.9. It's been reconciled with Sagi's blktest series that Omar recently merged.
This series is based off of the current blktests master and a git repo is available for this here:
https://github.com/Eideticom/blktests nvmet_passthru_v2
Thanks,
Logan
--
Changes in v2:
- Rebased on latest blktests master and changed to use the common helpers Sagi introduced in his series
- Collected Chaitanya's reviewed-by tag
--
Logan Gunthorpe (11):
common/fio: Remove state file in common helper common/xfs: Create common helper to check for XFS support common/xfs: Create common helper to verify block device with xfs
nvme: Search for specific subsysnqn in _find_nvme_loop_dev
nvme: Add common helpers for passthru tests
nvme/033: Simple test to create and connect to a passthru target nvme/034: Add test for passthru data verification nvme/035: Add test to verify passthru controller with a filesystem nvme/036: Add test for testing reset command on nvme-passthru nvme/037: Add test which loops passthru connect and disconnect nvme/038: Test removal of un-enabled subsystem and ports
common/fio | 1 + common/rc | 8 +++++ common/xfs | 33 ++++++++++++++++++ tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/008 | 2 +- tests/nvme/009 | 2 +- tests/nvme/010 | 3 +- tests/nvme/011 | 3 +- tests/nvme/012 | 23 ++++--------- tests/nvme/013 | 21 +++--------- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/018 | 2 +- tests/nvme/019 | 2 +- tests/nvme/020 | 2 +- tests/nvme/021 | 2 +- tests/nvme/022 | 2 +- tests/nvme/023 | 2 +- tests/nvme/024 | 2 +- tests/nvme/025 | 2 +- tests/nvme/026 | 2 +- tests/nvme/027 | 2 +- tests/nvme/028 | 2 +- tests/nvme/029 | 2 +- tests/nvme/033 | 67 +++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 7 ++++ tests/nvme/034 | 35 +++++++++++++++++++ tests/nvme/034.out | 3 ++ tests/nvme/035 | 37 +++++++++++++++++++++ tests/nvme/035.out | 3 ++ tests/nvme/036 | 37 +++++++++++++++++++++ tests/nvme/036.out | 3 ++ tests/nvme/037 | 35 +++++++++++++++++++ tests/nvme/037.out | 2 ++ tests/nvme/038 | 36 ++++++++++++++++++++ tests/nvme/038.out | 2 ++ tests/nvme/rc | 83 ++++++++++++++++++++++++++++++++++++++++++++-- 38 files changed, 420 insertions(+), 58 deletions(-) create mode 100644 common/xfs create mode 100755 tests/nvme/033 create mode 100644 tests/nvme/033.out create mode 100755 tests/nvme/034 create mode 100644 tests/nvme/034.out create mode 100755 tests/nvme/035 create mode 100644 tests/nvme/035.out create mode 100755 tests/nvme/036 create mode 100644 tests/nvme/036.out create mode 100755 tests/nvme/037 create mode 100644 tests/nvme/037.out create mode 100755 tests/nvme/038 create mode 100644 tests/nvme/038.out
base-commit: 20445c5eb6456addca9131ec6917d2a2d7414e04 --
2.20.1
PATCH v2 1/11 common/fio: Remove state file in common helper
Instead of each individual test removing this file, just do it in the common helper.
--- common/fio | 1 + tests/nvme/010 | 1 - tests/nvme/011 | 1 - tests/nvme/012 | 1 - tests/nvme/013 | 1 - 5 files changed, 1 insertion(+), 4 deletions(-)
common/fio +1 -0
@@ -181,6 +181,7 @@ _run_fio_rand_io() { _run_fio_verify_io() { _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=4k \ --iodepth=16 --verify=crc32c "$@" + rm -f local*verify*state } _fio_perf_report() {
tests/nvme/010 +0 -1
@@ -52,7 +52,6 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -f local*verify*state echo "Test complete" }
tests/nvme/011 +0 -1
@@ -48,7 +48,6 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -f local-write-and-verify*state echo "Test complete" }
tests/nvme/012 +0 -1
@@ -63,7 +63,6 @@ test() { losetup -d "${loop_dev}" - rm -f local*verify*state rm "${file_path}" rm -fr "${mount_dir}"
tests/nvme/013 +0 -1
@@ -58,7 +58,6 @@ test() { _remove_nvmet_subsystem "${subsys_name}" _remove_nvmet_port "${port}" - rm -f local*verify*state rm "${file_path}" rm -fr "${mount_dir}"
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH v2 2/11 common/xfs: Create common helper to check for XFS support
In reply to Logan GunthorpeTwo nvme tests create and mount XFS filesystems and check for mkfs.xfs.
They should also check for XFS support in the kernel so create a common helper for this.
--- common/rc | 8 ++++++++ common/xfs | 11 +++++++++++ tests/nvme/012 | 6 ++++-- tests/nvme/013 | 4 +++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 common/xfs
common/rc +8 -0
@@ -181,6 +181,14 @@ _have_tracepoint() { return 0 } +_have_fs() { + modprobe "$1" >/dev/null 2>&1 + if [[ ! -d "/sys/fs/$1" ]]; then + SKIP_REASON="kernel does not support filesystem $1" + return 1 + fi +} + _test_dev_is_rotational() { [[ $(cat "${TEST_DEV_SYSFS}/queue/rotational") -ne 0 ]] }
common/xfs new file +11 -0
@@ -0,0 +1,11 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2017 Omar Sandoval +# +# fio helper functions. + +. common/shellcheck + +_have_xfs() { + _have_fs xfs && _have_program mkfs.xfs +}
tests/nvme/012 +4 -2
@@ -5,14 +5,16 @@ # Test mkfs with data verification for block device backed ns. . tests/nvme/rc +. common/xfs DESCRIPTION="run mkfs and data verification fio job on NVMeOF block device-backed ns" TIMED=1 requires() { _nvme_requires - _have_program mkfs.xfs && _have_program fio && \ - _have_modules loop + _have_xfs + _have_program fio + _have_modules loop _require_nvme_trtype_is_fabrics }
tests/nvme/013 +3 -1
@@ -5,13 +5,15 @@ # Test mkfs with data verification for file backed ns. . tests/nvme/rc +. common/xfs DESCRIPTION="run mkfs and data verification fio job on NVMeOF file-backed ns" TIMED=1 requires() { _nvme_requires - _have_program mkfs.xfs && _have_fio + _have_xfs + _have_fio _require_nvme_trtype_is_fabrics }
Signature · 1 line
2.20.1
Re: [PATCH blktests v2 02/11] common/xfs: Create common helper to check for XFS support
tests/nvme/013 line 16
Quoted 6 lines · Logan Gunthorpe
requires(){tests/nvme/013 +2
-1_nvme_requires - _have_program mkfs.xfs && _have_fio + _have_xfs + _have_fio
Can you make _have_xfs return true false ? so it can be used with && ?
Re: [PATCH blktests v2 02/11] common/xfs: Create common helper to check for XFS support
Quoted 8 lines · Chaitanya Kulkarni
tests/nvme/013 line 16
Quoted 6 lines · Logan Gunthorpe
requires(){tests/nvme/013 +2
-1_nvme_requires - _have_program mkfs.xfs && _have_fio + _have_xfs + _have_fioCan you make
_have_xfsreturn true false ? so it can be used with && ?
_have_xfs() does return true/false and can be used with && or in a conditional.
Per [1], my opinion is that using && in the requires() function where the return value is ignored is confusing so I prefer not to do it in new code.
If we want to reconsider this we, should add a check to ensure the return value of requires() matches the expectation of the global variable it uses.
Logan
[1]
https://lore.kernel.org/linux-block/[email protected]/
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH blktests v2 02/11] common/xfs: Create common helper to check for XFS support
Quoted 7 lines · Logan Gunthorpe
_have_xfs()does return true/false and can be used with && or in a conditional.Per [1], my opinion is that using && in the
requires()function where the return value is ignored is confusing so I prefer not to do it in new code.
Quoted 8 lines
If we want to reconsider this we, should add a check to ensure the return value of
requires()matches the expectation of the global variable it uses.Logan
Make sense to me, lets not change this, thanks for pointing that out.
PATCH v2 3/11 common/xfs: Create common helper to verify block device with xfs
In reply to Logan GunthorpeMake a common helper from the code in tests nvme/012 and nvme/013 to run an fio verify on a XFS file system backed by the specified block device.
While we are at it, all the output is redirected to $FULL instead of /dev/null.
--- common/xfs | 22 ++++++++++++++++++++++ tests/nvme/012 | 14 +------------- tests/nvme/013 | 14 +------------- 3 files changed, 24 insertions(+), 26 deletions(-)
common/xfs +22 -0
@@ -9,3 +9,25 @@ _have_xfs() { _have_fs xfs && _have_program mkfs.xfs } + +_xfs_mkfs_and_mount() { + local bdev=$1 + local mount_dir=$2 + + mkdir -p "${mount_dir}" + umount "${mount_dir}" + mkfs.xfs -l size=32m -f "${bdev}" + mount "${bdev}" "${mount_dir}" +} + +_xfs_run_fio_verify_io() { + local mount_dir="/mnt/blktests" + local bdev=$1 + + _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1 + + _run_fio_verify_io --size=950m --directory="${mount_dir}/" + + umount "${mount_dir}" >> "${FULL}" 2>&1 + rm -fr "${mount_dir}" +}
tests/nvme/012 +1 -13
@@ -26,12 +26,9 @@ test() { local port local nvmedev local loop_dev - local mount_dir="/mnt/blktests" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" loop_dev="$(losetup -f --show "${file_path}")"
@@ -47,15 +44,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=950m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" _nvme_disconnect_subsys "${subsys_name}"
@@ -66,7 +55,6 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" }
tests/nvme/013 +1 -13
@@ -24,13 +24,10 @@ test() { local port local nvmedev - local mount_dir="/mnt/blktests/" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \
@@ -44,15 +41,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=800m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" _nvme_disconnect_subsys "${subsys_name}"
@@ -61,7 +50,6 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" }
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH blktests v2 03/11] common/xfs: Create common helper to verify block device with xfs
Quoted 7 lines · Logan Gunthorpe
Make a common helper from the code in tests nvme/012 and nvme/013 to run an fio verify on a XFS file system backed by the specified block device.
While we are at it, all the output is redirected to $FULL instead of
/dev/null.
Quoted 6 lines
Signed-off-by Logan Gunthorpe <[email protected]>--- common/xfs | 22 ++++++++++++++++++++++ tests/nvme/012 | 14 +------------- tests/nvme/013 | 14 +------------- 3 files changed, 24 insertions(+), 26 deletions(-)
The common namespace is getting cluttered. Can you please create
a subdirectory common/fs/xfs ?
Quoted 12 lines
common/xfs +3
-0@@ -9,3 +9,25 @@ _have_xfs() { _have_fs xfs && _have_program mkfs.xfs } + +_xfs_mkfs_and_mount() { + local bdev=$1
common/xfs line 24
Quoted 10 lines
common/xfs +10
-0+ local mount_dir=$2 + + mkdir -p "${mount_dir}" + umount "${mount_dir}" + mkfs.xfs -l size=32m -f "${bdev}" + mount "${bdev}" "${mount_dir}" +} + +_xfs_run_fio_verify_io() { + local mount_dir="/mnt/blktests"
The mount dir should be a parameter and not the hardcode value
to make it reusable.
Quoted 87 lines
common/xfs +9
-0+ local bdev=$1 + + _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1 + + _run_fio_verify_io --size=950m --directory="${mount_dir}/" + + umount "${mount_dir}" >> "${FULL}" 2>&1 + rm -fr "${mount_dir}" +}tests/nvme/012 +1
-13@@ -26,12 +26,9 @@ test() { local port local nvmedev local loop_dev - local mount_dir="/mnt/blktests" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" loop_dev="$(losetup -f --show "${file_path}")"@@ -47,15 +44,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=950m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" _nvme_disconnect_subsys "${subsys_name}"@@ -66,7 +55,6 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" }tests/nvme/013 +1
-12@@ -24,13 +24,10 @@ test() { local port local nvmedev - local mount_dir="/mnt/blktests/" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \@@ -44,15 +41,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=800m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" _nvme_disconnect_subsys "${subsys_name}"
tests/nvme/013 test() { · line 55
Quoted 7 lines
tests/nvme/013 +0
-1@@ -61,7 +50,6 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" }
rest looks good
Re: [PATCH blktests v2 03/11] common/xfs: Create common helper to verify block device with xfs
Quoted 15 lines · Chaitanya Kulkarni
Quoted 7 lines · Logan Gunthorpe
Make a common helper from the code in tests nvme/012 and nvme/013 to run an fio verify on a XFS file system backed by the specified block device.
While we are at it, all the output is redirected to $FULL instead of
/dev/null.Quoted 6 lines
Signed-off-by Logan Gunthorpe <[email protected]>--- common/xfs | 22 ++++++++++++++++++++++ tests/nvme/012 | 14 +------------- tests/nvme/013 | 14 +------------- 3 files changed, 24 insertions(+), 26 deletions(-)
Quoted 3 lines
The common namespace is getting cluttered. Can you please create
a subdirectory common/fs/xfs ?
I disagree. The common directory only has 9 files. And given there appear to be no other files to add to the fs directory I don't think now is the time to create a directory. We can do so if and when a number of other fs helpers show up and there's a reason to group them together.
Quoted 17 lines
Quoted 17 lines
common/xfs +8
-0@@ -9,3 +9,25 @@ _have_xfs() { _have_fs xfs && _have_program mkfs.xfs } + +_xfs_mkfs_and_mount() { + local bdev=$1 + local mount_dir=$2 + + mkdir -p "${mount_dir}" + umount "${mount_dir}" + mkfs.xfs -l size=32m -f "${bdev}"
Quoted 8 lines
common/xfs line 24
Quoted 5 lines
common/xfs +5
-0+ mount "${bdev}" "${mount_dir}" +} + +_xfs_run_fio_verify_io() { + local mount_dir="/mnt/blktests"The mount dir should be a parameter and not the hardcode value to make it reusable.
I also disagree here. It is already reusable and is used in a number of places; none of those places require changing the mount directory. If and when a use comes up that requires a different directory (not sure what that would be), a parameter can be added. It is typically standard practice in the Linux community to not add features that have no users as it's confusing to people reading the code.
Logan
A message that is not in the archive (sent off-list or not yet received): BYAPR04MB49652338A4FE3805F9394A88860A0@BYAPR04MB4965.namprd04.prod.outlook.com
Re: [PATCH blktests v2 03/11] common/xfs: Create common helper to verify block device with xfs
Quoted 10 lines · Chaitanya Kulkarni
Quoted 9 lines · Logan Gunthorpe
Quoted 2 lines
The mount dir should be a parameter and not the hardcode value to make it reusable.
I also disagree here. It is already reusable and is used in a number of places; none of those places require changing the mount directory. If and when a use comes up that requires a different directory (not sure what that would be), a parameter can be added. It is typically standard practice in the Linux community to not add features that have no users as it's confusing to people reading the code.
Quoted 3 lines
Quoted 2 lines
Logan
Well if you are making a helper it should be generic if you have a usecase,
"Generic" isn't a binary yes/no quality. Why add the mount option (that nobody is using) and not a size option as well that nobody uses? For that matter, fio has a ton of options we could expose. (think io-method, read/write pattern, etc, etc). The criteria we decide upon which options get exposed as arguments is what the code that's actually using it needs -- not what's available or what you imagine future use cases might be. If there are no users in the code it should not be exposed. If a use case comes along, an argument can easily be added when the new test is added to the code base.
Quoted 3 lines
mounted on different mount points not just one which is important testcase,
that will require a prep patch.
So? That's normal.
Quoted 1 line
Why can't we do that right now when we have a clear usecase ?
We don't have a clear use case that's being added to the code though... We have an imagined use case that hasn't been written. Add the feature when you add this use case.
Logan
PATCH v2 4/11 nvme: Search for specific subsysnqn in _find_nvme_loop_dev
In reply to Logan GunthorpeThis ensures we find the correct nvme loop device if others exist on a given system (which is generally not expected on test systems).
Additionally, this will be required in the upcomming test nvme/037 which will have controllers racing with ones being destroyed.
--- tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/008 | 2 +- tests/nvme/009 | 2 +- tests/nvme/010 | 2 +- tests/nvme/011 | 2 +- tests/nvme/012 | 2 +- tests/nvme/013 | 2 +- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/018 | 2 +- tests/nvme/019 | 2 +- tests/nvme/020 | 2 +- tests/nvme/021 | 2 +- tests/nvme/022 | 2 +- tests/nvme/023 | 2 +- tests/nvme/024 | 2 +- tests/nvme/025 | 2 +- tests/nvme/026 | 2 +- tests/nvme/027 | 2 +- tests/nvme/028 | 2 +- tests/nvme/029 | 2 +- tests/nvme/rc | 7 ++++--- 23 files changed, 26 insertions(+), 25 deletions(-)
tests/nvme/004 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 local nvmedev - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "blktests-subsystem-1") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/005 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 local nvmedev - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "blktests-subsystem-1") udevadm settle
tests/nvme/008 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/009 +1 -1
@@ -33,7 +33,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/010 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/011 +1 -1
@@ -35,7 +35,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/012 +1 -1
@@ -40,7 +40,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/013 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/014 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/015 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/018 +1 -1
@@ -35,7 +35,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/019 +1 -1
@@ -39,7 +39,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/020 +1 -1
@@ -35,7 +35,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/021 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/022 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/023 +1 -1
@@ -37,7 +37,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/024 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/025 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/026 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/027 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/028 +1 -1
@@ -34,7 +34,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/029 +1 -1
@@ -70,7 +70,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" - nvmedev="$(_find_nvme_dev)" + nvmedev=$(_find_nvme_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
tests/nvme/rc +4 -3
@@ -273,12 +273,13 @@ _remove_nvmet_subsystem_from_port() { } _find_nvme_dev() { + local subsys=$1 + local subsysnqn local dev - local transport for dev in /sys/class/nvme/nvme*; do dev="$(basename "$dev")" - transport="$(cat "/sys/class/nvme/${dev}/transport")" - if [[ "$transport" == "${nvme_trtype}" ]]; then + subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn")" + if [[ "$subsysnqn" == "$subsys" ]]; then echo "$dev" for ((i = 0; i < 10; i++)); do if [[ -e /sys/block/$dev/uuid &&
Signature · 1 line
2.20.1
Re: [PATCH blktests v2 04/11] nvme: Search for specific subsysnqn in _find_nvme_loop_dev
Quoted 7 lines · Logan Gunthorpe
This ensures we find the correct nvme loop device if others exist on a given system (which is generally not expected on test systems).
Additionally, this will be required in the upcomming test nvme/037 which will have controllers racing with ones being destroyed.
Signed-off-by Logan Gunthorpe <[email protected]>
If I create a passthru testcase with :-
1. Create nvme-loop based nvme ctrl backed by null_blk say /dev/nvme1
2. Create a nvme-loop based passthru ctrl backed by /dev/nvme1 say nvme2.
With this patch or this series will I be able to write the testcase ?
Re: [PATCH blktests v2 04/11] nvme: Search for specific subsysnqn in _find_nvme_loop_dev
Quoted 9 lines · Chaitanya Kulkarni
Quoted 7 lines · Logan Gunthorpe
This ensures we find the correct nvme loop device if others exist on a given system (which is generally not expected on test systems).
Additionally, this will be required in the upcomming test nvme/037 which will have controllers racing with ones being destroyed.
Signed-off-by Logan Gunthorpe <[email protected]>
Quoted 8 lines
If I create a passthru testcase with :-
1. Create nvme-loop based nvme ctrl backed by
null_blksay/dev/nvme12. Create a nvme-loop based passthru ctrl backed by
/dev/nvme1say nvme2.With this patch or this series will I be able to write the testcase ?
This patch helps with that but other helpers introduced in this series would require minor changes.
As far as I can see, you'd only have to adjust _create_nvmet_passthru() to take an optional argument because, presently, it always uses $_test_dev_nvme_ctrl for the backing device.
This can easily be done if and when someone writes such a test.
However, I'm not even sure right now if that test would pass in the kernel as is -- it seems like an odd thing to do.
Logan
A message that is not in the archive (sent off-list or not yet received): BYAPR04MB49650C6419A84705D04FFE63860A0@BYAPR04MB4965.namprd04.prod.outlook.com
Re: [PATCH blktests v2 04/11] nvme: Search for specific subsysnqn in _find_nvme_loop_dev
Quoted 11 lines · Chaitanya Kulkarni
Quoted 10 lines · Logan Gunthorpe
Quoted 1 line
With this patch or this series will I be able to write the testcase ?
This patch helps with that but other helpers introduced in this series would require minor changes.
As far as I can see, you'd only have to adjust
_create_nvmet_passthru()to take an optional argument because, presently, it always uses $_test_dev_nvme_ctrl for the backing device.This can easily be done if and when someone writes such a test.
Quoted 8 lines
Quoted 5 lines
However, I'm not even sure right now if that test would pass in the kernel as is -- it seems like an odd thing to do.
Logan
This test should pass if I remember the code correctly where we don't
have any PCIe specific checks for the passthru controller and it is an
Yes, there's no explicit restrictions, but that doesn't mean there are no bugs with that particular stack.
Quoted 3 lines
important to support this scenario in order to write device independent
testcases as rest of the testcases are.
Ok, feel free to write a test for this. It's not important to me.
Logan
PATCH v2 5/11 nvme: Add common helpers for passthru tests
In reply to Logan GunthorpeAdd some simple helpers to setup a passthru target that passes through to a nvme test device.
--- tests/nvme/rc | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
tests/nvme/rc +76 -0
@@ -73,6 +73,17 @@ _require_nvme_trtype_is_fabrics() { return 0 } +_test_dev_nvme_ctrl() { + local dev + + dev=$(cat "${TEST_DEV_SYSFS}/device/dev") + echo "/dev/char/${dev}" +} + +_test_dev_nvme_nsid() { + cat "${TEST_DEV_SYSFS}/nsid" +} + _cleanup_nvmet() { local dev local port
@@ -257,6 +268,27 @@ _remove_nvmet_subsystem() { rmdir "${subsys_path}" } +_create_nvmet_passthru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + mkdir -p "${subsys_path}" + printf 1 > "${subsys_path}/attr_allow_any_host" + + printf "%s" "$(_test_dev_nvme_ctrl)" > "${passthru_path}/device_path" + printf 1 > "${passthru_path}/enable" +} + +_remove_nvmet_passhtru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + printf 0 > "${passthru_path}/enable" + rmdir "${subsys_path}" +} + _add_nvmet_subsys_to_port() { local port="$1" local nvmet_subsystem="$2"
@@ -292,6 +324,50 @@ _find_nvme_dev() { done } +_find_nvme_passthru_loop_dev() { + local subsys=$1 + local nsid + local dev + + dev=$(_find_nvme_dev "${subsys}") + nsid=$(_test_dev_nvme_nsid) + echo "/dev/${dev}n${nsid}" +} + +_nvmet_passthru_target_setup() { + local subsys_name=$1 + + _create_nvmet_passthru "${subsys_name}" + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + echo "$port" +} + +_nvmet_passthru_target_connect() { + local trtype=$1 + local subsys_name=$2 + + _nvme_connect_subsys "${trtype}" "${subsys_name}" + nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}") + + # The following tests can race with the creation + # of the device so ensure the block device exists + # before continuing + while [ ! -b "${nsdev}" ]; do sleep 1; done + + echo "${nsdev}" +} + +_nvmet_passthru_target_cleanup() { + local port=$1 + local subsys_name=$2 + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_port "${port}" + _remove_nvmet_passhtru "${subsys_name}" +} + _filter_discovery() { sed -n -r -e "s/Generation counter [0-9]+/Generation counter X/" \ -e '/Discovery Log Number|Log Entry|trtype|subnqn/p'
Signature · 1 line
2.20.1
Re: [PATCH blktests v2 05/11] nvme: Add common helpers for passthru tests
Quoted 13 lines · Logan Gunthorpe
Add some simple helpers to setup a passthru target that passes through to a nvme test device.
Signed-off-by Logan Gunthorpe <[email protected]>--- tests/nvme/rc | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)tests/nvme/rc +0
-0
tests/nvme/rc _require_nvme_trtype_is_fabrics() { · line 79
Quoted 7 lines
tests/nvme/rc +4
-0@@ -73,6 +73,17 @@ _require_nvme_trtype_is_fabrics() { return 0 } +_test_dev_nvme_ctrl() { + local dev + + dev=$(cat "${TEST_DEV_SYSFS}/device/dev")
can you initialize dev this at the time of declaration ?
Quoted 14 lines
tests/nvme/rc +7
-0+ echo "/dev/char/${dev}" +} + +_test_dev_nvme_nsid() { + cat "${TEST_DEV_SYSFS}/nsid" +} + _cleanup_nvmet() { local dev local port@@ -257,6 +268,27 @@ _remove_nvmet_subsystem() { rmdir "${subsys_path}" }
tests/nvme/rc _remove_nvmet_subsystem() { · line 280
Quoted 10 lines
tests/nvme/rc +10
-0+_create_nvmet_passthru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + mkdir -p "${subsys_path}" + printf 1 > "${subsys_path}/attr_allow_any_host" + + printf "%s" "$(_test_dev_nvme_ctrl)" > "${passthru_path}/device_path" + printf 1 > "${passthru_path}/enable"
can you please echo in general and printf only when it is needed ?
I know existing code is a bit inconsistent I'll send a clenup to make it uniform.
Quoted 65 lines
tests/nvme/rc +55
-0+} + +_remove_nvmet_passhtru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + printf 0 > "${passthru_path}/enable" + rmdir "${subsys_path}" +} + _add_nvmet_subsys_to_port() { local port="$1" local nvmet_subsystem="$2"@@ -292,6 +324,50 @@ _find_nvme_dev() { done } +_find_nvme_passthru_loop_dev() { + local subsys=$1 + local nsid + local dev + + dev=$(_find_nvme_dev "${subsys}") + nsid=$(_test_dev_nvme_nsid) + echo "/dev/${dev}n${nsid}" +} + +_nvmet_passthru_target_setup() { + local subsys_name=$1 + + _create_nvmet_passthru "${subsys_name}" + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + echo "$port" +} + +_nvmet_passthru_target_connect() { + local trtype=$1 + local subsys_name=$2 + + _nvme_connect_subsys "${trtype}" "${subsys_name}" + nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}") + + # The following tests can race with the creation + # of the device so ensure the block device exists + # before continuing + while [ ! -b "${nsdev}" ]; do sleep 1; done + + echo "${nsdev}" +} + +_nvmet_passthru_target_cleanup() { + local port=$1 + local subsys_name=$2 + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_port "${port}" + _remove_nvmet_passhtru "${subsys_name}" +} + _filter_discovery() { sed -n -r -e "s/Generation counter [0-9]+/Generation counter X/" \ -e '/Discovery Log Number|Log Entry|trtype|subnqn/p'
Re: [PATCH blktests v2 05/11] nvme: Add common helpers for passthru tests
Quoted 17 lines · Chaitanya Kulkarni
Quoted 16 lines · Logan Gunthorpe
Add some simple helpers to setup a passthru target that passes through to a nvme test device.
Signed-off-by Logan Gunthorpe <[email protected]>--- tests/nvme/rc | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)tests/nvme/rc +0
-0@@ -73,6 +73,17 @@ _require_nvme_trtype_is_fabrics() { return 0 }
Quoted 5 lines
tests/nvme/rc _require_nvme_trtype_is_fabrics() { · line 79
Quoted 4 lines
tests/nvme/rc +4
-0+_test_dev_nvme_ctrl() { + local dev + + dev=$(cat "${TEST_DEV_SYSFS}/device/dev")can you initialize dev this at the time of declaration ?
Yup, will fix.
Quoted 14 lines
Quoted 14 lines
tests/nvme/rc +7
-0+ echo "/dev/char/${dev}" +} + +_test_dev_nvme_nsid() { + cat "${TEST_DEV_SYSFS}/nsid" +} + _cleanup_nvmet() { local dev local port@@ -257,6 +268,27 @@ _remove_nvmet_subsystem() { rmdir "${subsys_path}" }
Quoted 14 lines
tests/nvme/rc _remove_nvmet_subsystem() { · line 280
Quoted 10 lines
tests/nvme/rc +10
-0+_create_nvmet_passthru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + mkdir -p "${subsys_path}" + printf 1 > "${subsys_path}/attr_allow_any_host" + + printf "%s" "$(_test_dev_nvme_ctrl)" > "${passthru_path}/device_path" + printf 1 > "${passthru_path}/enable"can you please echo in general and printf only when it is needed ?> I know existing code is a bit inconsistent I'll send a clenup to make it uniform.
Yes, I agree. I will it fix in v3.
Thanks,
Logan
PATCH v2 6/11 nvme/033: Simple test to create and connect to a passthru target
In reply to Logan GunthorpeThis tests creates and connects to a passthru controller backed by a test NVMe namespace. It then verifies that some common fields in id-ctrl and id-ns are the same in the target and the orginial device.
--- tests/nvme/033 | 67 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 7 +++++ 2 files changed, 74 insertions(+) create mode 100755 tests/nvme/033 create mode 100644 tests/nvme/033.out
tests/nvme/033 new file +67 -0
@@ -0,0 +1,67 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="create and connect to an NVMeOF target with a passthru controller" +QUICK=1 + +requires() { + _nvme_requires + _have_kernel_option NVME_TARGET_PASSTHRU +} + +nvme_info() { + local ns=$1 + + nvme id-ctrl "${ns}" | grep -E '^(vid|sn|mn|fr) ' + nvme id-ns "${ns}" | grep -E '^(nsze|ncap) ' +} + +compare_dev_info() { + local passthru_dev=$1 + local testdev_info + local passthru_info + + testdev_info=$(nvme_info "${TEST_DEV}") + passthru_info=$(nvme_info "${passthru_dev}") + + cat >> "${FULL}" <<- EOF + + Test Device ${TEST_DEV} Info: + $testdev_info + + Passthru Device ${passthru_dev} Info: + $passthru_info + + EOF + + diff -u <(echo "${testdev_info}") <(echo "${passthru_info}") + if [[ "${testdev_info}" != "${passthru_info}" ]]; then + echo "ERROR: Device information does not match! (See ${FULL})" + fi +} + +test_device() { + local subsys="blktests-subsystem-1" + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "${subsys}") + + _nvme_discover "${nvme_trtype}" | _filter_discovery + + nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") + + compare_dev_info "${nsdev}" + + _nvme_disconnect_subsys "${subsys}" + _nvmet_passthru_target_cleanup "${port}" "${subsys}" + + echo "Test complete" +}
tests/nvme/033.out new file +7 -0
@@ -0,0 +1,7 @@ +Running nvme/033 +Discovery Log Number of Records 1, Generation counter X +=====Discovery Log Entry 0====== +trtype: loop +subnqn: blktests-subsystem-1 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete
Signature · 1 line
2.20.1
PATCH v2 7/11 nvme/034: Add test for passthru data verification
In reply to Logan GunthorpeSimilar to test nvme/010 and nvme/011 but for a passthru controller
--- tests/nvme/034 | 35 +++++++++++++++++++++++++++++++++++ tests/nvme/034.out | 3 +++ 2 files changed, 38 insertions(+) create mode 100755 tests/nvme/034 create mode 100644 tests/nvme/034.out
tests/nvme/034 new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="run data verification fio job on an NVMeOF passthru controller" +TIMED=1 + +requires() { + _nvme_requires + _have_kernel_option NVME_TARGET_PASSTHRU + _have_fio +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "${subsys}") + nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") + + _run_fio_verify_io --size=950m --filename="${nsdev}" + + _nvme_disconnect_subsys "${subsys}" + _nvmet_passthru_target_cleanup "${port}" "${subsys}" + + echo "Test complete" +}
tests/nvme/034.out new file +3 -0
@@ -0,0 +1,3 @@ +Running nvme/034 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete
Signature · 1 line
2.20.1
PATCH v2 8/11 nvme/035: Add test to verify passthru controller with a filesystem
In reply to Logan GunthorpeThis is a similar test as nvme/012 and nvme/013, except with a passthru controller.
--- tests/nvme/035 | 37 +++++++++++++++++++++++++++++++++++++ tests/nvme/035.out | 3 +++ 2 files changed, 40 insertions(+) create mode 100755 tests/nvme/035 create mode 100644 tests/nvme/035.out
tests/nvme/035 new file +37 -0
@@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc +. common/xfs + +DESCRIPTION="run mkfs and data verification fio job on an NVMeOF passthru controller" +TIMED=1 + +requires() { + _nvme_requires + _have_kernel_option NVME_TARGET_PASSTHRU + _have_xfs + _have_fio +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "${subsys}") + nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") + + _xfs_run_fio_verify_io "${nsdev}" + + _nvme_disconnect_subsys "${subsys}" + _nvmet_passthru_target_cleanup "${port}" "${subsys}" + + echo "Test complete" +}
tests/nvme/035.out new file +3 -0
@@ -0,0 +1,3 @@ +Running nvme/035 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete
Signature · 1 line
2.20.1
PATCH v2 9/11 nvme/036: Add test for testing reset command on nvme-passthru
In reply to Logan GunthorpeSimilar to test 022 but for passthru controllers.
--- tests/nvme/036 | 37 +++++++++++++++++++++++++++++++++++++ tests/nvme/036.out | 3 +++ 2 files changed, 40 insertions(+) create mode 100755 tests/nvme/036 create mode 100644 tests/nvme/036.out
tests/nvme/036 new file +37 -0
@@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="test NVMe reset command on an NVMeOF target with a passthru controller" +QUICK=1 + +requires() { + _nvme_requires + _have_kernel_option NVME_TARGET_PASSTHRU +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "${subsys}") + nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") + + ctrldev=$(_find_nvme_dev "${subsys}") + + if ! nvme reset "/dev/${ctrldev}" >> "$FULL" 2>&1; then + echo "ERROR: reset failed" + fi + + _nvme_disconnect_subsys "${subsys}" + _nvmet_passthru_target_cleanup "${port}" "${subsys}" + + echo "Test complete" +}
tests/nvme/036.out new file +3 -0
@@ -0,0 +1,3 @@ +Running nvme/036 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete
Signature · 1 line
2.20.1
PATCH v2 10/11 nvme/037: Add test which loops passthru connect and disconnect
In reply to Logan GunthorpeSimilar to test nvme/031 except for passthru controllers.
Note: it's normal to get I/O errors in this test as when the controller disconnects it races with the partition table read.
--- tests/nvme/037 | 35 +++++++++++++++++++++++++++++++++++ tests/nvme/037.out | 2 ++ 2 files changed, 37 insertions(+) create mode 100755 tests/nvme/037 create mode 100644 tests/nvme/037.out
tests/nvme/037 new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="test deletion of NVMeOF passthru controllers immediately after setup" + +requires() { + _nvme_requires + _have_kernel_option NVME_TARGET_PASSTHRU +} + +test_device() { + local subsys="blktests-subsystem-" + local iterations=10 + local ctrldev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + for ((i = 0; i < iterations; i++)); do + port=$(_nvmet_passthru_target_setup "${subsys}${i}") + nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" \ + "${subsys}${i}") + + _nvme_disconnect_subsys "${subsys}${i}" >>"${FULL}" 2>&1 + _nvmet_passthru_target_cleanup "${port}" "${subsys}${i}" + done + + echo "Test complete" +}
tests/nvme/037.out new file +2 -0
@@ -0,0 +1,2 @@ +Running nvme/037 +Test complete
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH v2 11/11 nvme/038: Test removal of un-enabled subsystem and ports
In reply to Logan GunthorpeTest that we can remove a subsystem that has not been enabled by passthru or any ns. Do the same for ports while we are at it.
This was an issue in the original passthru patches and is not commonly tested. So this test will ensure we don't regress this.
--- tests/nvme/038 | 36 ++++++++++++++++++++++++++++++++++++ tests/nvme/038.out | 2 ++ 2 files changed, 38 insertions(+) create mode 100755 tests/nvme/038 create mode 100644 tests/nvme/038.out
tests/nvme/038 new file +36 -0
@@ -0,0 +1,36 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. +# +# Test that we can remove a subsystem that has not been enabled by +# passthru or any ns. Do the same for ports while we are at it. +# +# This was an issue in the original passthru patches and is +# not commonly tested. So this test will ensure we don't regress this. +# +. tests/nvme/rc + +DESCRIPTION="test deletion of NVMeOF subsystem without enabling" +QUICK=1 + +requires() { + _nvme_requires +} + +test() { + local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + mkdir -p "${subsys_path}" + rmdir "${subsys_path}" + + port=$(_create_nvmet_port loop) + _remove_nvmet_port "${port}" + + echo "Test complete" +}
tests/nvme/038.out new file +2 -0
@@ -0,0 +1,2 @@ +Running nvme/038 +Test complete
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme