Skip to content

Commit 2c26a5f

Browse files
committed
nvme/050: repeat checking test device restoration
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. Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 34a7fc4 commit 2c26a5f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/nvme/050

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ requires() {
2323
test_device() {
2424
local nvme_ns
2525
local pdev
26+
local i
2627

2728
echo "Running ${TEST_NAME}"
2829

@@ -49,7 +50,13 @@ test_device() {
4950
# Remove and rescan the NVME device to ensure that it has come back
5051
echo 1 > "/sys/bus/pci/devices/${pdev}/remove"
5152
echo 1 > /sys/bus/pci/rescan
52-
if [[ ! -b ${TEST_DEV} ]]; then
53+
for ((i = 0; i < 10; i++)); do
54+
if [[ -b ${TEST_DEV} ]]; then
55+
break
56+
fi
57+
sleep .5
58+
done
59+
if (( i >= 10 )); then
5360
echo "Failed to restore ${TEST_DEV}"
5461
fi
5562
}

0 commit comments

Comments
 (0)