Skip to content

Commit

Permalink
iotests/026: Test EIO on preallocated zero cluster
Browse files Browse the repository at this point in the history
Test what happens when writing data to a preallocated zero cluster, but
the data write fails.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200225143130.111267-3-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 31ab00f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
XanClic authored and mdroth committed Jun 2, 2020
1 parent 382b9f0 commit 30aa0ea
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/qemu-iotests/026
Expand Up @@ -215,6 +215,27 @@ _make_test_img 64M
$QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io
_check_test_img

echo
echo === Avoid freeing preallocated zero clusters on failure ===
echo

cat > "$TEST_DIR/blkdebug.conf" <<EOF
[inject-error]
event = "write_aio"
errno = "5"
once = "on"
EOF

_make_test_img $CLUSTER_SIZE
# Create a preallocated zero cluster
$QEMU_IO -c "write 0 $CLUSTER_SIZE" -c "write -z 0 $CLUSTER_SIZE" "$TEST_IMG" \
| _filter_qemu_io
# Try to overwrite it (prompting an I/O error from blkdebug), thus
# triggering the alloc abort code
$QEMU_IO -c "write 0 $CLUSTER_SIZE" "$BLKDBG_TEST_IMG" | _filter_qemu_io

_check_test_img

# success, all done
echo "*** done"
rm -f $seq.full
Expand Down
10 changes: 10 additions & 0 deletions tests/qemu-iotests/026.out
Expand Up @@ -643,4 +643,14 @@ write failed: Input/output error
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.

=== Avoid freeing preallocated zero clusters on failure ===

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write failed: Input/output error
No errors were found on the image.
*** done
10 changes: 10 additions & 0 deletions tests/qemu-iotests/026.out.nocache
Expand Up @@ -651,4 +651,14 @@ write failed: Input/output error
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
No errors were found on the image.

=== Avoid freeing preallocated zero clusters on failure ===

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
write failed: Input/output error
No errors were found on the image.
*** done

0 comments on commit 30aa0ea

Please sign in to comment.