From 125712c1491829ea150f70d29766b505fe49b698 Mon Sep 17 00:00:00 2001 From: Yury Luneff Date: Sat, 21 Nov 2026 12:38:20 +0300 Subject: [PATCH] Test dd conv=noerror with a failing in-order write #133 made in-order writes advance by the blocks taken, so that an ignored write error does not stop them, but only its read half had a test. Write to /dev/full, which fails every write with ENOSPC: without that change dd hangs. Also read only one block of /sys/class/net/lo/speed. Its size is the page size, so on a 64K-page kernel dd copied 64 KiB and the 4 KiB comparison failed. --- tests/test_dd.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_dd.sh b/tests/test_dd.sh index 0cb4d08c..4334445c 100755 --- a/tests/test_dd.sh +++ b/tests/test_dd.sh @@ -79,7 +79,7 @@ rm ./testdata/testfile1 # conv=noerror gives zeros for an unreadable block, also on in-order output; reading lo/speed fails with EINVAL if [[ -r /sys/class/net/lo/speed ]] && ! cat /sys/class/net/lo/speed >/dev/null 2>&1; then cp ./testdata/over ./testdata/testfile1 - $VITASTOR_CLI dd if=/sys/class/net/lo/speed of=./testdata/testfile1 bs=4k conv=noerror oflag=append + $VITASTOR_CLI dd if=/sys/class/net/lo/speed of=./testdata/testfile1 bs=4k count=1 conv=noerror oflag=append (cat ./testdata/over; head -c 4k /dev/zero) | cmp - ./testdata/testfile1 || format_error "dd conv=noerror did not replace an unreadable block with zeros" rm ./testdata/testfile1 else @@ -94,6 +94,14 @@ if [[ -c /dev/net/tun && -r /dev/net/tun ]]; then else echo "SKIP: dd conv=noerror with a failing stream - /dev/net/tun is missing or not readable here" fi +# an ignored write error does not stop in-order output; writes to /dev/full fail with ENOSPC +if [[ -c /dev/full && -w /dev/full ]]; then + rc=0 + timeout 60 $VITASTOR_CLI dd if=/dev/zero of=/dev/full bs=4k count=4 conv=noerror oflag=append || rc=$? + [[ $rc = 0 ]] || format_error "dd conv=noerror to a failing in-order output returned $rc" +else + echo "SKIP: dd conv=noerror with a failing write - /dev/full is missing or not writable here" +fi # pipe in without count - copy to the end of input $VITASTOR_CLI dd iimg=testimg iodepth=4 | $VITASTOR_CLI dd of=./testdata/testfile1 iodepth=4 -- 2.47.3