make nvme/048 checks more robust
Subsystems (2)
cover make nvme/048 checks more robust
The nvme/048 tests fails with the fc transport because the check logic is racing with the reset code in the target. By making the checks a bit more robust in blktests, this test passes for all transports.
Daniel Wagner (2):
nvme/048: remove unused argument for set_qid_max nvme/048: make queue count check retry-able
tests/nvme/048 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.2
PATCH 1/2 nvme/048: remove unused argument for set_qid_max
The port is argument is unsed, thus remove it.
--- tests/nvme/048 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tests/nvme/048 +4 -5
@@ -69,9 +69,8 @@ set_nvmet_attr_qid_max() { } set_qid_max() { - local port="$1" - local subsys_name="$2" - local qid_max="$3" + local subsys_name="$1" + local qid_max="$2" set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}" nvmf_wait_for_state "${subsys_name}" "live" || return 1
@@ -100,8 +99,8 @@ test() { if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then echo FAIL else - set_qid_max "${port}" "${def_subsysnqn}" 1 || echo FAIL - set_qid_max "${port}" "${def_subsysnqn}" 2 || echo FAIL + set_qid_max "${def_subsysnqn}" 1 || echo FAIL + set_qid_max "${def_subsysnqn}" 2 || echo FAIL fi _nvme_disconnect_subsys "${def_subsysnqn}"
Signature · 1 line
2.43.2
Re: [PATCH blktests 1/2] nvme/048: remove unused argument for set_qid_max
Quoted 5 lines · Daniel Wagner
The port is argument is unsed, thus remove it.
Signed-off-by Daniel Wagner <[email protected]>---
Looks good.
-ck
PATCH 2/2 nvme/048: make queue count check retry-able
In reply to Daniel WagnerWe 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.
--- tests/nvme/048 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
tests/nvme/048 +14 -2
@@ -47,11 +47,23 @@ nvmf_check_queue_count() { local queue_count="$2" local nvmedev local queue_count_file + local retries nvmedev=$(_find_nvme_dev "${subsys_name}") + queue_count=$((queue_count + 1)) + retries=5 + queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) + while [[ "${queue_count}" -ne "${queue_count_file}" ]]; do + if [[ "${retries}" == 0 ]]; then + break; + fi + retries=$((retries - 1)) + sleep 1 + + queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) + done - queue_count=$((queue_count + 1)) if [[ "${queue_count}" -ne "${queue_count_file}" ]]; then echo "expected queue count ${queue_count} not set" return 1
@@ -73,8 +85,8 @@ set_qid_max() { local qid_max="$2" set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}" - nvmf_wait_for_state "${subsys_name}" "live" || return 1 nvmf_check_queue_count "${subsys_name}" "${qid_max}" || return 1 + nvmf_wait_for_state "${subsys_name}" "live" || return 1 return 0 }
Signature · 1 line
2.43.2
Re: [PATCH blktests 2/2] nvme/048: make queue count check retry-able
Quoted 8 lines · Daniel Wagner
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.
Signed-off-by Daniel Wagner <[email protected]>---
Looks good.
-ck
Re: [PATCH blktests 2/2] nvme/048: make queue count check retry-able
In reply to Daniel WagnerQuoted 6 lines · Daniel Wagner
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.
Signed-off-by Daniel Wagner <[email protected]>
Hi Daniel, thanks for the patches. I did a trial run with fc transport and confirmed that this patch avoids the nvme/048 failure. Good.
Please find nit comments below.
Quoted 12 lines
--- tests/nvme/048 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)tests/nvme/048 +0
-0@@ -47,11 +47,23 @@ nvmf_check_queue_count() { local queue_count="$2" local nvmedev local queue_count_file
tests/nvme/048 nvmf_check_queue_count() { · line 59
Quoted 10 lines
tests/nvme/048 +7
-0+ local retries nvmedev=$(_find_nvme_dev "${subsys_name}") + queue_count=$((queue_count + 1)) + retries=5 + queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) + while [[ "${queue_count}" -ne "${queue_count_file}" ]]; do + if [[ "${retries}" == 0 ]]; then + break;
The line above has extra spaces.
And I think the break above can be replaced with the echo and the return in the if block after the while loop as follows. It will make the code a bit simpler.
tests/nvme/048 +2 -6
@@ -56,7 +56,8 @@ nvmf_check_queue_count() { queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) while [[ "${queue_count}" -ne "${queue_count_file}" ]]; do if [[ "${retries}" == 0 ]]; then - break; + echo "expected queue count ${queue_count} not set" + return 1 fi retries=$((retries - 1)) sleep 1
@@ -64,11 +65,6 @@ nvmf_check_queue_count() { queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) done - if [[ "${queue_count}" -ne "${queue_count_file}" ]]; then - echo "expected queue count ${queue_count} not set" - return 1 - fi - return 0 }