[bug report] blktests nvme/047 failed due to /dev/nvme0n1 not created in time

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Aug 10 04:41:59 PDT 2023


On Aug 10, 2023 / 11:18, Daniel Wagner wrote:
> On Thu, Aug 10, 2023 at 12:19:39AM +0000, Shinichiro Kawasaki wrote:
> > Yi, could you try and see if it avoids the failure?
> > 
> > diff --git a/tests/nvme/rc b/tests/nvme/rc
> > index 4f3a994..005db80 100644
> > --- a/tests/nvme/rc
> > +++ b/tests/nvme/rc
> > @@ -740,7 +740,7 @@ _find_nvme_dev() {
> >  		if [[ "$subsysnqn" == "$subsys" ]]; then
> >  			echo "$dev"
> >  			for ((i = 0; i < 10; i++)); do
> > -				if [[ -e /sys/block/$dev/uuid &&
> > +				if [[ -e /dev/$dev && -e /sys/block/$dev/uuid &&
> >  					-e /sys/block/$dev/wwid ]]; then
> >  					return
> >  				fi
> 
> The path for uuid is not correct. It's needs to be something like
> 
> 	if [[ -e /dev/$dev && -e /sys/block/"${dev}n1"/uuid &&
> 		-e /sys/block/"${dev}n1"/wwid ]]; then
> 			return
> 	fi

Oh, right... I think /dev/$dev should be /dev/${dev}n1 also, if we will add it.

I guess the current for loop keeps on checking the wrong uuid and wwid file
paths, then it does 0.1 seconds wait 10 times = 1 second wait. So, it does not
check readiness of the found device, but the wait allows the device gets ready,
and achieved what the commit c766fccf3aff ("Make the NVMe tests more reliable")
aimed.

And I think this for loop to wait for device readiness should move from
_find_nvme_dev() to _nvme_connect_subsys(), so that wait is done even when
_find_nvme_dev() is missing.

P.S. I've just noticed that you have almost same idea in the cover letter for
     the v2 series of "Switch to allowed_host".


More information about the Linux-nvme mailing list