When running blktests with kernel debugging enabled it can happen that
_find_nvme_loop_dev() returns before the NVMe block device has appeared
in sysfs. This patch avoids that the NVMe tests fail as follows:
+cat: /sys/block/nvme1n1/uuid: No such file or directory
+cat: /sys/block/nvme1n1/wwid: No such file or directory
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
transport="$(cat "/sys/class/nvme/${dev}/transport")"
if [[ "$transport" == "loop" ]]; then
echo "$dev"
+ for ((i = 0; i < 10; i++)); do
+ if [[ -e /sys/block/$dev/uuid &&
+ -e /sys/block/$dev/wwid ]]; then
+ return
+ fi
+ sleep .1
+ done
fi
done
}