yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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