On Aug 17, 2023 / 11:29, Sagi Grimberg wrote: > On 8/17/23 10:30, Shin'ichiro Kawasaki wrote: [...] > > diff --git a/tests/nvme/rc b/tests/nvme/rc > > index 0b964e9..797483e 100644 > > --- a/tests/nvme/rc > > +++ b/tests/nvme/rc > > @@ -428,6 +428,8 @@ _nvme_connect_subsys() { > > local keep_alive_tmo="" > > local reconnect_delay="" > > local ctrl_loss_tmo="" > > + local wait_for="ns" > > + local dev i > > while [[ $# -gt 0 ]]; do > > case $1 in > > @@ -483,6 +485,10 @@ _nvme_connect_subsys() { > > ctrl_loss_tmo="$2" > > shift 2 > > ;; > > + --wait-for) > > + wait_for="$2" > > + shift 2 > > + ;; > > I think that it would make better since to reverse the polarity > here. > > connect always wait, and tests that actually want to > do some fast stress will choose --nowait. Agreed. Will reflect in v3. > > > *) > > positional_args+=("$1") > > shift > > @@ -532,6 +538,21 @@ _nvme_connect_subsys() { > > fi > > nvme connect "${ARGS[@]}" 2> /dev/null > > + > > + # Wait until device file and uuid/wwid sysfs attributes get ready for > > + # namespace 1. > > + if [[ ${wait_for} == ns ]]; then > > + udevadm settle > > + dev=$(_find_nvme_dev "$subsysnqn") > > + for ((i = 0; i < 10; i++)); do > > + if [[ -b /dev/${dev}n1 && > > + -e /sys/block/${dev}n1/uuid && > > + -e /sys/block/${dev}n1/wwid ]]; then > > + return > > What happens if the subsystem does not have any namespaces? > Or what about other namesapces? > > Won't it make more sense to inspect the subsys for > expected ns and wait for all? I think such check is possible. I assume that we can refer /sys/kernel/config/nvmet/subsystems/namespaces to get the expected ns and check them all. Will cook something for v3.