_wait_for_nbd_connect() checks nbd connections by checking the existence of a debugfs attribute file. However, even when the file exists, nbd connections are not fully ready, and the stat command for the nbd device file in the test case nbd/002 may fail with unexpected I/O errors. To avoid the failure, check the nbd connections not only by the debugfs attribute file, but also by "nbd-client -check" command. Link: https://github.com/osandov/blktests/pull/134 Reported-by: Yi Zhang <yi.zhang@xxxxxxxxxx> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- tests/nbd/rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/nbd/rc b/tests/nbd/rc index 9c1c15b..266befd 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -43,7 +43,8 @@ _have_nbd_netlink() { _wait_for_nbd_connect() { for ((i = 0; i < 3; i++)); do - if [[ -e /sys/kernel/debug/nbd/nbd0/tasks ]]; then + if [[ -e /sys/kernel/debug/nbd/nbd0/tasks ]] && \ + nbd-client -check /dev/nbd0 &> /dev/null; then return 0 fi sleep 1 -- 2.44.0