[PATCH blktests] nbd/rc: check nbd connection with nbd-client -check command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



_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





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux