|
|
0a122b |
From 8ddf0e61ad5bc3ab854a04f6b20d996ef4ed0ae2 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
Date: Mon, 17 Mar 2014 22:45:31 +0100
|
|
|
0a122b |
Subject: [PATCH 6/6] iotests: Test corruption during COW request
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
Message-id: <1395096331-12610-4-git-send-email-mreitz@redhat.com>
|
|
|
0a122b |
Patchwork-id: 58121
|
|
|
0a122b |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 3/3] iotests: Test corruption during COW request
|
|
|
0a122b |
Bugzilla: 1048575
|
|
|
0a122b |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
BZ: 1048575
|
|
|
0a122b |
|
|
|
0a122b |
Extend test file 060 by a test case for corruption occuring concurrently
|
|
|
0a122b |
to a COW request. QEMU should not crash but rather return an appropriate
|
|
|
0a122b |
error message.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
0a122b |
(cherry picked from commit 98d39e34fe95f8609be3ccbd1b67926631d2c7c0)
|
|
|
0a122b |
|
|
|
0a122b |
Conflicts:
|
|
|
0a122b |
tests/qemu-iotests/060
|
|
|
0a122b |
|
|
|
0a122b |
As the series allowing blkdebug to be used through the QMP interfaces
|
|
|
0a122b |
has not yet been backported, this test may not use
|
|
|
0a122b |
"-o file.driver=blkdebug" to select the blkdebug block driver, but
|
|
|
0a122b |
rather "blkdebug::$TEST_IMG" as the filename.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
tests/qemu-iotests/060 | 26 ++++++++++++++++++++++++++
|
|
|
0a122b |
tests/qemu-iotests/060.out | 15 +++++++++++++++
|
|
|
0a122b |
2 files changed, 41 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
tests/qemu-iotests/060 | 26 ++++++++++++++++++++++++++
|
|
|
0a122b |
tests/qemu-iotests/060.out | 15 +++++++++++++++
|
|
|
0a122b |
2 files changed, 41 insertions(+), 0 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
|
|
|
0a122b |
index bbb1909..2abd566 100644
|
|
|
0a122b |
--- a/tests/qemu-iotests/060
|
|
|
0a122b |
+++ b/tests/qemu-iotests/060
|
|
|
0a122b |
@@ -138,6 +138,32 @@ $QEMU_IMG snapshot -a foo "$TEST_IMG"
|
|
|
0a122b |
_check_test_img
|
|
|
0a122b |
$QEMU_IO -c "$OPEN_RO" -c "read -P 1 0 512" | _filter_qemu_io
|
|
|
0a122b |
|
|
|
0a122b |
+echo
|
|
|
0a122b |
+echo "=== Testing overlap while COW is in flight ==="
|
|
|
0a122b |
+echo
|
|
|
0a122b |
+# compat=0.10 is required in order to make the following discard actually
|
|
|
0a122b |
+# unallocate the sector rather than make it a zero sector - we want COW, after
|
|
|
0a122b |
+# all.
|
|
|
0a122b |
+IMGOPTS='compat=0.10' _make_test_img 1G
|
|
|
0a122b |
+# Write two clusters, the second one enforces creation of an L2 table after
|
|
|
0a122b |
+# the first data cluster.
|
|
|
0a122b |
+$QEMU_IO -c 'write 0k 64k' -c 'write 512M 64k' "$TEST_IMG" | _filter_qemu_io
|
|
|
0a122b |
+# Discard the first cluster. This cluster will soon enough be reallocated and
|
|
|
0a122b |
+# used for COW.
|
|
|
0a122b |
+$QEMU_IO -c 'discard 0k 64k' "$TEST_IMG" | _filter_qemu_io
|
|
|
0a122b |
+# Now, corrupt the image by marking the second L2 table cluster as free.
|
|
|
0a122b |
+poke_file "$TEST_IMG" '131084' "\x00\x00" # 0x2000c
|
|
|
0a122b |
+# Start a write operation requiring COW on the image stopping it right before
|
|
|
0a122b |
+# doing the read; then, trigger the corruption prevention by writing anything to
|
|
|
0a122b |
+# any unallocated cluster, leading to an attempt to overwrite the second L2
|
|
|
0a122b |
+# table. Finally, resume the COW write and see it fail (but not crash).
|
|
|
0a122b |
+echo "open blkdebug::$TEST_IMG
|
|
|
0a122b |
+break cow_read 0
|
|
|
0a122b |
+aio_write 0k 1k
|
|
|
0a122b |
+wait_break 0
|
|
|
0a122b |
+write 64k 64k
|
|
|
0a122b |
+resume 0" | $QEMU_IO | _filter_qemu_io
|
|
|
0a122b |
+
|
|
|
0a122b |
# success, all done
|
|
|
0a122b |
echo "*** done"
|
|
|
0a122b |
rm -f $seq.full
|
|
|
0a122b |
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
|
|
|
0a122b |
index 6c7bdbb..a517948 100644
|
|
|
0a122b |
--- a/tests/qemu-iotests/060.out
|
|
|
0a122b |
+++ b/tests/qemu-iotests/060.out
|
|
|
0a122b |
@@ -78,4 +78,19 @@ read 512/512 bytes at offset 0
|
|
|
0a122b |
No errors were found on the image.
|
|
|
0a122b |
read 512/512 bytes at offset 0
|
|
|
0a122b |
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
0a122b |
+
|
|
|
0a122b |
+=== Testing overlap while COW is in flight ===
|
|
|
0a122b |
+
|
|
|
0a122b |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
|
|
0a122b |
+wrote 65536/65536 bytes at offset 0
|
|
|
0a122b |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
0a122b |
+wrote 65536/65536 bytes at offset 536870912
|
|
|
0a122b |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
0a122b |
+discard 65536/65536 bytes at offset 0
|
|
|
0a122b |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
0a122b |
+qcow2: Preventing invalid write on metadata (overlaps with active L2 table); image marked as corrupt.
|
|
|
0a122b |
+blkdebug: Suspended request '0'
|
|
|
0a122b |
+write failed: Input/output error
|
|
|
0a122b |
+blkdebug: Resuming request '0'
|
|
|
0a122b |
+aio_write failed: No medium found
|
|
|
0a122b |
*** done
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|