Message ID | 20200930185422.11494-5-logang@deltatee.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | NVMe Target Passthru Block Tests | expand |
On 9/30/20 11:54, Logan Gunthorpe wrote: > 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 <logang@deltatee.com> 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 ?
On 2020-10-06 5:55 p.m., Chaitanya Kulkarni wrote: > On 9/30/20 11:54, Logan Gunthorpe wrote: >> 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 <logang@deltatee.com> > > 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 ? 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
On 2020-10-06 6:24 p.m., Chaitanya Kulkarni wrote: > On 10/6/20 17:10, Logan Gunthorpe wrote: >>> 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 >> > 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. > 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
diff --git a/tests/nvme/004 b/tests/nvme/004 index dfca79aab20c..4b0b7ae50a5e 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -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" diff --git a/tests/nvme/005 b/tests/nvme/005 index 0d5801868bc0..9f3e388dc695 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -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 diff --git a/tests/nvme/008 b/tests/nvme/008 index 8616617ad398..219fe9b0ca6a 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -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" diff --git a/tests/nvme/009 b/tests/nvme/009 index e91d79065cb1..2814c79164ee 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -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" diff --git a/tests/nvme/010 b/tests/nvme/010 index 0188e842213e..150a4e540f3e 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -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" diff --git a/tests/nvme/011 b/tests/nvme/011 index 543dbe840874..4bfe9af084e4 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -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" diff --git a/tests/nvme/012 b/tests/nvme/012 index a13cd08ce6bf..c4e75b09796a 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -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" diff --git a/tests/nvme/013 b/tests/nvme/013 index 1ac725ea83f2..265b6968fd34 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -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" diff --git a/tests/nvme/014 b/tests/nvme/014 index e3c70364e332..48f8caaec0b3 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -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" diff --git a/tests/nvme/015 b/tests/nvme/015 index 46fa4f605749..e33cfde5d72e 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -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" diff --git a/tests/nvme/018 b/tests/nvme/018 index 6d7934d09d99..7f407da2ce19 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -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" diff --git a/tests/nvme/019 b/tests/nvme/019 index 486b5acff713..8259e2e0c157 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -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" diff --git a/tests/nvme/020 b/tests/nvme/020 index c8053f440e2e..16fdfcc94918 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -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" diff --git a/tests/nvme/021 b/tests/nvme/021 index f543a1d8fd92..fb77f9cbd99f 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -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" diff --git a/tests/nvme/022 b/tests/nvme/022 index e824ed31f6f0..62c4690e35fe 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -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" diff --git a/tests/nvme/023 b/tests/nvme/023 index bdef3dc8abca..bce21b56c9f1 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -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" diff --git a/tests/nvme/024 b/tests/nvme/024 index 78f779e8a08a..ffec36cf3333 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -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" diff --git a/tests/nvme/025 b/tests/nvme/025 index 223430965d7e..3d3f01bc45fd 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -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" diff --git a/tests/nvme/026 b/tests/nvme/026 index 7f82284d9c57..2f5607793cd3 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -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" diff --git a/tests/nvme/027 b/tests/nvme/027 index da96e6c5008d..53f06646a3d0 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -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" diff --git a/tests/nvme/028 b/tests/nvme/028 index f826b67623f1..3d9084f18636 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -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" diff --git a/tests/nvme/029 b/tests/nvme/029 index 5bed9b8e70ae..960e5f5a63bf 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -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" diff --git a/tests/nvme/rc b/tests/nvme/rc index 4c5b2e8edf0d..dfa57a299625 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -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 &&
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 <logang@deltatee.com> --- 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(-)