aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/026
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2020-02-25 15:31:29 +0100
committerKevin Wolf <kwolf@redhat.com>2020-03-06 17:15:37 +0100
commit31ab00f3747c00fdbb9027cea644b40dd1405480 (patch)
tree7222d17e91584b3a757ccefb8e95e686ff906ce6 /tests/qemu-iotests/026
parent3ede935fdbbd5f7b24b4724bbfb8938acb5956d8 (diff)
downloadqemu-31ab00f3747c00fdbb9027cea644b40dd1405480.zip
qemu-31ab00f3747c00fdbb9027cea644b40dd1405480.tar.gz
qemu-31ab00f3747c00fdbb9027cea644b40dd1405480.tar.bz2
iotests/026: Test EIO on preallocated zero cluster
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>
Diffstat (limited to 'tests/qemu-iotests/026')
-rwxr-xr-xtests/qemu-iotests/02621
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index a4aa747..0c1273c 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -218,6 +218,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