@@ -35,7 +35,7 @@ test() {
nvme connect -t loop -n blktests-subsystem-1
local nvmedev
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "blktests-subsystem-1")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -36,7 +36,7 @@ test() {
nvme connect -t loop -n blktests-subsystem-1
local nvmedev
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "blktests-subsystem-1")
udevadm settle
@@ -36,7 +36,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -32,7 +32,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -36,7 +36,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -35,7 +35,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -36,7 +36,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -32,7 +32,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -38,7 +38,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -36,7 +36,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -69,7 +69,7 @@ test() {
nvme connect -t loop -n "${subsys_name}"
- nvmedev="$(_find_nvme_loop_dev)"
+ nvmedev=$(_find_nvme_loop_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -162,12 +162,13 @@ _remove_nvmet_subsystem_from_port() {
}
_find_nvme_loop_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" == "loop" ]]; 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/036 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(-)