aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-16 14:20:39 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-16 14:20:39 +0100
commit871c71b1bad2d2647641500603a2236869135c7f (patch)
tree586029263f4a30b270dabbf45a5e3989afaea165 /tests
parent9f0f846465d4c52ce9857787e947dffb64367fae (diff)
parent5dbd0ce115c7720268e653fe928bb6a0c1314a80 (diff)
downloadqemu-871c71b1bad2d2647641500603a2236869135c7f.zip
qemu-871c71b1bad2d2647641500603a2236869135c7f.tar.gz
qemu-871c71b1bad2d2647641500603a2236869135c7f.tar.bz2
Merge tag 'pull-block-2021-11-16' of https://gitlab.com/hreitz/qemu into staging
Block patches for 6.2.0-rc1: - Fixes to image streaming job and block layer reconfiguration to make iotest 030 pass again - docs: Deprecate incorrectly typed device_add arguments - file-posix: Fix alignment after reopen changing O_DIRECT # gpg: Signature made Tue 16 Nov 2021 01:57:03 PM CET # gpg: using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF # gpg: issuer "hreitz@redhat.com" # gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00 4D34 A1FA 40D0 9801 9CDF * tag 'pull-block-2021-11-16' of https://gitlab.com/hreitz/qemu: file-posix: Fix alignment after reopen changing O_DIRECT softmmu/qdev-monitor: fix use-after-free in qdev_set_id() docs: Deprecate incorrectly typed device_add arguments iotests/030: Unthrottle parallel jobs in reverse block: Let replace_child_noperm free children block: Let replace_child_tran keep indirect pointer transactions: Invoke clean() after everything else block: Restructure remove_file_or_backing_child() block: Pass BdrvChild ** to replace_child_noperm block: Drop detached child from ignore list block: Unite remove_empty_child and child_free block: Manipulate children list in .attach/.detach stream: Traverse graph after modification Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/03011
-rwxr-xr-xtests/qemu-iotests/14229
-rw-r--r--tests/qemu-iotests/142.out18
3 files changed, 57 insertions, 1 deletions
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 5fb65b4..567bf1d 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -251,7 +251,16 @@ class TestParallelOps(iotests.QMPTestCase):
speed=1024)
self.assert_qmp(result, 'return', {})
- for job in pending_jobs:
+ # Do this in reverse: After unthrottling them, some jobs may finish
+ # before we have unthrottled all of them. This will drain their
+ # subgraph, and this will make jobs above them advance (despite those
+ # jobs on top being throttled). In the worst case, all jobs below the
+ # top one are finished before we can unthrottle it, and this makes it
+ # advance so far that it completes before we can unthrottle it - which
+ # results in an error.
+ # Starting from the top (i.e. in reverse) does not have this problem:
+ # When a job finishes, the ones below it are not advanced.
+ for job in reversed(pending_jobs):
result = self.vm.qmp('block-job-set-speed', device=job, speed=0)
self.assert_qmp(result, 'return', {})
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
index 69fd10e..86d65a2 100755
--- a/tests/qemu-iotests/142
+++ b/tests/qemu-iotests/142
@@ -350,6 +350,35 @@ info block backing-file"
echo "$hmp_cmds" | run_qemu -drive "$files","$ids" | grep "Cache"
+echo
+echo "--- Alignment after changing O_DIRECT ---"
+echo
+
+# Directly test the protocol level: Can unaligned requests succeed even if
+# O_DIRECT was only enabled through a reopen and vice versa?
+
+# Ensure image size is a multiple of the sector size (required for O_DIRECT)
+$QEMU_IMG create -f file "$TEST_IMG" 1M | _filter_img_create
+
+# And write some data (not strictly necessary, but it feels better to actually
+# have something to be read)
+$QEMU_IO -f file -c 'write 0 4096' "$TEST_IMG" | _filter_qemu_io
+
+$QEMU_IO --cache=writeback -f file $TEST_IMG <<EOF | _filter_qemu_io
+read 42 42
+reopen -o cache.direct=on
+read 42 42
+reopen -o cache.direct=off
+read 42 42
+EOF
+$QEMU_IO --cache=none -f file $TEST_IMG <<EOF | _filter_qemu_io
+read 42 42
+reopen -o cache.direct=off
+read 42 42
+reopen -o cache.direct=on
+read 42 42
+EOF
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/142.out b/tests/qemu-iotests/142.out
index a92b948..e20cfc8 100644
--- a/tests/qemu-iotests/142.out
+++ b/tests/qemu-iotests/142.out
@@ -747,4 +747,22 @@ cache.no-flush=on on backing-file
Cache mode: writeback
Cache mode: writeback, direct
Cache mode: writeback, ignore flushes
+
+--- Alignment after changing O_DIRECT ---
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=file size=1048576
+wrote 4096/4096 bytes at offset 0
+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 42/42 bytes at offset 42
+42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done