[PATCH blktests] nvme/050: repeat checking test device restoration

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Mon Aug 18 05:14:29 PDT 2025


Since kernel version 6.17-rc1, the test case nvme/050 has been failing
with the error message "Failed to restore ${TEST_DEV}". This failure
happens because the device restoration check is executed too early,
shortly after writing to /sys/bus/pci/rescan. To avoid the failure,
implement repeated checks for the device restoration with short sleeps.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
This is the blktests side fix for the nvme/050 failure reported for v6.16-rc1
kernel [1].

[1] https://lore.kernel.org/linux-block/suhzith2uj75uiprq4m3cglvr7qwm3d7gi4tmjeohlxl6fcmv3@zu6zym6nmvun/

 tests/nvme/050 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/nvme/050 b/tests/nvme/050
index c710832..ba55c6e 100755
--- a/tests/nvme/050
+++ b/tests/nvme/050
@@ -23,6 +23,7 @@ requires() {
 test_device() {
 	local nvme_ns
 	local pdev
+	local i
 
 	echo "Running ${TEST_NAME}"
 
@@ -49,7 +50,13 @@ test_device() {
 	# Remove and rescan the NVME device to ensure that it has come back
 	echo 1 > "/sys/bus/pci/devices/${pdev}/remove"
 	echo 1 > /sys/bus/pci/rescan
-	if [[ ! -b ${TEST_DEV} ]]; then
+	for ((i = 0; i < 10; i++)); do
+		if [[ -b ${TEST_DEV} ]]; then
+			break
+		fi
+		sleep .5
+	done
+	if (( i >= 10 )); then
 		echo "Failed to restore ${TEST_DEV}"
 	fi
 }
-- 
2.50.1




More information about the Linux-nvme mailing list