From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Benoît Canet" <benoit.canet@nodalink.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Max Reitz" <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v3 3/3] iotests: Add test for external image truncation
Date: Wed, 22 Oct 2014 17:57:14 +0200 [thread overview]
Message-ID: <1413993434-11816-4-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1413993434-11816-1-git-send-email-mreitz@redhat.com>
It should not be happening, but it is possible to truncate an image
outside of qemu while qemu is running (or any of the qemu tools using
the block layer. raw_co_get_block_status() should not break then.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/102 | 15 +++++++++++++++
tests/qemu-iotests/102.out | 9 +++++++++
2 files changed, 24 insertions(+)
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index 34b363f..027198b 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -58,6 +58,21 @@ truncate -s $((5 * 64 * 1024)) "$TEST_IMG"
$QEMU_IO -c map "$TEST_IMG"
$QEMU_IMG map "$TEST_IMG"
+echo
+echo '=== Testing map on an image file truncated outside of qemu ==='
+echo
+
+# Same as above, only now we concurrently truncate and map the image
+_make_test_img $IMG_SIZE
+$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
+
+(sleep 0.2; $QEMU_IO -c map "$TEST_IMG"; $QEMU_IMG map "$TEST_IMG") &
+truncate -s $((5 * 64 * 1024)) "$TEST_IMG"
+# To be sure the image has been truncated before $QEMU_IO and $QEMU_IMG run
+echo '--- truncated ---'
+
+sleep 0.3
+
# success, all done
echo '*** done'
rm -f $seq.full
diff --git a/tests/qemu-iotests/102.out b/tests/qemu-iotests/102.out
index e0e9cdc..96f4a33 100644
--- a/tests/qemu-iotests/102.out
+++ b/tests/qemu-iotests/102.out
@@ -7,4 +7,13 @@ wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[ 0] 128/ 128 sectors allocated at offset 0 bytes (1)
Offset Length Mapped to File
+
+=== Testing map on an image file truncated outside of qemu ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
+wrote 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+--- truncated ---
+[ 0] 128/ 128 sectors allocated at offset 0 bytes (1)
+Offset Length Mapped to File
*** done
--
1.9.3
next prev parent reply other threads:[~2014-10-22 15:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 15:57 [Qemu-devel] [PATCH v3 0/3] raw-posix: Fix raw_co_get_block_status() Max Reitz
2014-10-22 15:57 ` [Qemu-devel] [PATCH v3 1/3] raw-posix: Fix raw_co_get_block_status() after EOF Max Reitz
2014-10-22 16:57 ` Eric Blake
2014-10-23 7:27 ` Max Reitz
2014-10-23 7:28 ` Max Reitz
2014-10-22 15:57 ` [Qemu-devel] [PATCH v3 2/3] raw-posix: raw_co_get_block_status() return value Max Reitz
2014-10-22 17:00 ` Eric Blake
2014-10-23 7:29 ` Max Reitz
2014-10-22 15:57 ` Max Reitz [this message]
2014-10-22 16:50 ` [Qemu-devel] [PATCH v3 3/3] iotests: Add test for external image truncation Eric Blake
2014-10-23 7:26 ` Max Reitz
2014-10-23 7:46 ` Kevin Wolf
2014-10-23 7:47 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413993434-11816-4-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=benoit.canet@nodalink.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).