Re: [PATCH blktests v1 1/3] nvme/048: Check for queue count check directly

Daniel Wagner
2023-06-20T17:37:52Z

On Tue, Jun 20, 2023 at 04:49:45PM +0300, Sagi Grimberg wrote:
> > +nvmf_wait_for_queue_count() {
> > + local subsys_name="$1"
> > + local queue_count="$2"
> > + local nvmedev
> > +
> > + nvmedev=$(_find_nvme_dev "${subsys_name}")
> > +
> > + queue_count_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/queue_count"
> > +
> > + nvmf_wait_for_state "${subsys_name}" "live" || return 1
> > +
> > + queue_count=$((queue_count + 1))
> > + if grep -q "${queue_count}" "${queue_count_file}"; then
> > + return 0
> > + fi
> > +
> > + echo "expected queue count ${queue_count} not set"
> > + return 1
> > +}
> > +
> > set_nvmet_attr_qid_max() {
> > local nvmet_subsystem="$1"
> > local qid_max="$2"
> > @@ -56,10 +76,7 @@ set_qid_max() {
> > local qid_max="$3"
> > set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}"
> > -
> > - # Setting qid_max forces a disconnect and the reconntect attempt starts
> > - nvmf_wait_for_state "${subsys_name}" "connecting" || return 1
> > - nvmf_wait_for_state "${subsys_name}" "live" || return 1
> > + nvmf_wait_for_queue_count "${subsys_name}" "${qid_max}" || return 1
>
> Why not simply wait for live? The connecting is obviously racy...

That is what the new version is doing. It's waiting for the live state and then
checks the queue count.