Skip to content

Commit

Permalink
nvme/048: make queue count check retry-able
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Daniel Wagner <[email protected]>
[Shin'ichiro: removed unnecessary if block in nvmf_check_queue_count()]
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
  • Loading branch information
igaw authored and kawasaki committed Mar 5, 2024
1 parent d9bb2b7 commit 607513e
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/nvme/048
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,24 @@ 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
echo "expected queue count ${queue_count} not set"
return 1
fi

queue_count=$((queue_count + 1))
if [[ "${queue_count}" -ne "${queue_count_file}" ]]; then
echo "expected queue count ${queue_count} not set"
return 1
fi
sleep 1

retries=$((retries - 1))
queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count)
done

return 0
}
Expand All @@ -73,8 +82,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
}
Expand Down

0 comments on commit 607513e

Please sign in to comment.