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

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