thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch

be904d
From b1035096f2d46e2146704d1db9581c6d2131d1f4 Mon Sep 17 00:00:00 2001
be904d
From: Max Reitz <mreitz@redhat.com>
be904d
Date: Mon, 13 Jul 2020 14:24:49 -0400
be904d
Subject: [PATCH 2/4] iotests/026: Test EIO on preallocated zero cluster
be904d
be904d
RH-Author: Max Reitz <mreitz@redhat.com>
be904d
Message-id: <20200713142451.289703-3-mreitz@redhat.com>
be904d
Patchwork-id: 97953
be904d
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 2/4] iotests/026: Test EIO on preallocated zero cluster
be904d
Bugzilla: 1807057
be904d
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
be904d
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
be904d
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
be904d
be904d
Test what happens when writing data to a preallocated zero cluster, but
be904d
the data write fails.
be904d
be904d
Signed-off-by: Max Reitz <mreitz@redhat.com>
be904d
Message-Id: <20200225143130.111267-3-mreitz@redhat.com>
be904d
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
be904d
(cherry picked from commit 31ab00f3747c00fdbb9027cea644b40dd1405480)
be904d
Signed-off-by: Max Reitz <mreitz@redhat.com>
be904d
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
be904d
---
be904d
 tests/qemu-iotests/026             | 21 +++++++++++++++++++++
be904d
 tests/qemu-iotests/026.out         | 10 ++++++++++
be904d
 tests/qemu-iotests/026.out.nocache | 10 ++++++++++
be904d
 3 files changed, 41 insertions(+)
be904d
be904d
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
be904d
index 3430029ed6..d89729697f 100755
be904d
--- a/tests/qemu-iotests/026
be904d
+++ b/tests/qemu-iotests/026
be904d
@@ -215,6 +215,27 @@ _make_test_img 64M
be904d
 $QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io
be904d
 _check_test_img
be904d
 
be904d
+echo
be904d
+echo === Avoid freeing preallocated zero clusters on failure ===
be904d
+echo
be904d
+
be904d
+cat > "$TEST_DIR/blkdebug.conf" <
be904d
+[inject-error]
be904d
+event = "write_aio"
be904d
+errno = "5"
be904d
+once = "on"
be904d
+EOF
be904d
+
be904d
+_make_test_img $CLUSTER_SIZE
be904d
+# Create a preallocated zero cluster
be904d
+$QEMU_IO -c "write 0 $CLUSTER_SIZE" -c "write -z 0 $CLUSTER_SIZE" "$TEST_IMG" \
be904d
+    | _filter_qemu_io
be904d
+# Try to overwrite it (prompting an I/O error from blkdebug), thus
be904d
+# triggering the alloc abort code
be904d
+$QEMU_IO -c "write 0 $CLUSTER_SIZE" "$BLKDBG_TEST_IMG" | _filter_qemu_io
be904d
+
be904d
+_check_test_img
be904d
+
be904d
 # success, all done
be904d
 echo "*** done"
be904d
 rm -f $seq.full
be904d
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
be904d
index ff0817b6f2..83989996ff 100644
be904d
--- a/tests/qemu-iotests/026.out
be904d
+++ b/tests/qemu-iotests/026.out
be904d
@@ -643,4 +643,14 @@ write failed: Input/output error
be904d
 wrote 1048576/1048576 bytes at offset 0
be904d
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
 No errors were found on the image.
be904d
+
be904d
+=== Avoid freeing preallocated zero clusters on failure ===
be904d
+
be904d
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
be904d
+wrote 1024/1024 bytes at offset 0
be904d
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
+wrote 1024/1024 bytes at offset 0
be904d
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
+write failed: Input/output error
be904d
+No errors were found on the image.
be904d
 *** done
be904d
diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache
be904d
index 495d013007..9359d26d7e 100644
be904d
--- a/tests/qemu-iotests/026.out.nocache
be904d
+++ b/tests/qemu-iotests/026.out.nocache
be904d
@@ -651,4 +651,14 @@ write failed: Input/output error
be904d
 wrote 1048576/1048576 bytes at offset 0
be904d
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
 No errors were found on the image.
be904d
+
be904d
+=== Avoid freeing preallocated zero clusters on failure ===
be904d
+
be904d
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
be904d
+wrote 1024/1024 bytes at offset 0
be904d
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
+wrote 1024/1024 bytes at offset 0
be904d
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
+write failed: Input/output error
be904d
+No errors were found on the image.
be904d
 *** done
be904d
-- 
be904d
2.27.0
be904d