mirror of
https://github.com/qemu/qemu.git
synced 2025-01-23 22:13:25 +08:00
Patches for 5.2.0-rc2:
- quorum: Fix crash with rewrite-corrupted and without read-write user - io_uring: do not use pointer after free - file-posix: Use fallback path for -EBUSY from FALLOC_FL_PUNCH_HOLE - iotests: Fix failure on Python 3.9 due to use of a deprecated function - char-stdio: Fix QMP default for 'signal' -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAl+zt1URHGt3b2xmQHJl ZGhhdC5jb20ACgkQfwmycsiPL9ZxyxAAu8GIOeAb7atQvc+KpeBTUG4A+tfAXkC+ iUYdIpFeWWgmGf7myu3nlaAkeTDk6qHalmzkGRHi3yhX4eNIh5Sdff1YwPcZwf+q GLIqFFTW0z1Bd36N8G7Mkf04nKX4QTHqp6THHtSt9jNs56h5OP3axPXVA/3v9y8B 4ZAkOOvwnwO+U94crhy5y5pX/Vwafv/Dz4DH9hEupE+EI9AuzjZLBrS+sgkxjhmu gvHpDSqm6NXwWQA5a24J6NzCy3n/Fw/rqmnoOrN8eRz+4DSCMVDnTDDEMFLa/UoK Ci7AqWfG/MnQ4GrGsOx80KJhAFLTmI60vfnUizKtEjL/HJyK5PDyM+VxHz+P/Tkq 4hqQsHEsll4mAQiKCrrKOOXhn+YC4DhY/5O1EzEfhqfUjI+BFE9iC7LuqQevwKPL gytup7eoZjIHMtnKwY1B2ApAqHtodswjHkefcjEcvSlhqGi/BvwuWmeYlFXmA3r0 YO8fvbYJrwHwJy7CzMb5Rgs2461QGERmXoCsBxLAiqXU9rhpOZ6gKXIjjlYojZ8M W0kqbaccTRPuhooFdEQ9RTPSkX7AX2bI0nOoPxfz3YD/siw35YwnUkJqvQbckvJd vpPkCL5jt3d9sfO0z1xjSH2ey9bevSReYpCsk+kIZl7V2XoDAW0Nbi0Td3pW4j6x dEkg/+sjF+o= =0pFF -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Patches for 5.2.0-rc2: - quorum: Fix crash with rewrite-corrupted and without read-write user - io_uring: do not use pointer after free - file-posix: Use fallback path for -EBUSY from FALLOC_FL_PUNCH_HOLE - iotests: Fix failure on Python 3.9 due to use of a deprecated function - char-stdio: Fix QMP default for 'signal' # gpg: Signature made Tue 17 Nov 2020 11:43:17 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: iotests/081: Test rewrite-corrupted without WRITE iotests/081: Filter image format after testdir quorum: Require WRITE perm with rewrite-corrupted io_uring: do not use pointer after free file-posix: allow -EBUSY errors during write zeros on raw block devices iotests: Replace deprecated ConfigParser.readfp() char-stdio: Fix QMP default for 'signal' Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c8e5c4b246
@ -1698,6 +1698,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
|
||||
switch (ret) {
|
||||
case -ENOTSUP:
|
||||
case -EINVAL:
|
||||
case -EBUSY:
|
||||
break;
|
||||
default:
|
||||
return ret;
|
||||
|
@ -425,6 +425,6 @@ LuringState *luring_init(Error **errp)
|
||||
void luring_cleanup(LuringState *s)
|
||||
{
|
||||
io_uring_queue_exit(&s->ring);
|
||||
g_free(s);
|
||||
trace_luring_cleanup_state(s);
|
||||
g_free(s);
|
||||
}
|
||||
|
@ -1163,7 +1163,12 @@ static void quorum_child_perm(BlockDriverState *bs, BdrvChild *c,
|
||||
uint64_t perm, uint64_t shared,
|
||||
uint64_t *nperm, uint64_t *nshared)
|
||||
{
|
||||
BDRVQuorumState *s = bs->opaque;
|
||||
|
||||
*nperm = perm & DEFAULT_PERM_PASSTHROUGH;
|
||||
if (s->rewrite_corrupted) {
|
||||
*nperm |= BLK_PERM_WRITE;
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot share RESIZE or WRITE, as this would make the
|
||||
|
@ -112,9 +112,7 @@ static void qemu_chr_open_stdio(Chardev *chr,
|
||||
|
||||
qemu_chr_open_fd(chr, 0, 1);
|
||||
|
||||
if (opts->has_signal) {
|
||||
stdio_allow_signal = opts->signal;
|
||||
}
|
||||
stdio_allow_signal = !opts->has_signal || opts->signal;
|
||||
qemu_chr_set_echo_stdio(chr, false);
|
||||
}
|
||||
#endif
|
||||
|
@ -321,8 +321,7 @@
|
||||
# Configuration info for stdio chardevs.
|
||||
#
|
||||
# @signal: Allow signals (such as SIGINT triggered by ^C)
|
||||
# be delivered to qemu. Default: true in -nographic mode,
|
||||
# false otherwise.
|
||||
# be delivered to qemu. Default: true.
|
||||
#
|
||||
# Since: 1.5
|
||||
##
|
||||
|
@ -42,18 +42,20 @@ _supported_fmt raw
|
||||
_supported_proto file
|
||||
_supported_os Linux
|
||||
_require_drivers quorum
|
||||
_require_devices virtio-scsi
|
||||
|
||||
do_run_qemu()
|
||||
{
|
||||
echo Testing: "$@" | _filter_imgfmt
|
||||
echo Testing: "$@"
|
||||
$QEMU -nographic -qmp stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
|
||||
| _filter_qemu_io | _filter_generated_node_ids
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qemu \
|
||||
| _filter_qmp | _filter_qemu_io \
|
||||
| _filter_generated_node_ids
|
||||
}
|
||||
|
||||
quorum="driver=raw,file.driver=quorum,file.vote-threshold=2"
|
||||
@ -154,6 +156,59 @@ echo "== checking that quorum has corrected the corrupted file =="
|
||||
|
||||
$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io
|
||||
|
||||
echo
|
||||
echo "== using quorum rewrite corrupted mode without WRITE permission =="
|
||||
|
||||
# The same as above, but this time, do it on a quorum node whose only
|
||||
# parent will not take the WRITE permission
|
||||
|
||||
echo '-- corrupting --'
|
||||
# Only corrupt a portion: The guest device (scsi-hd on virtio-scsi)
|
||||
# will read some data (looking for a partition table to guess the
|
||||
# disk's geometry), which would trigger a quorum mismatch if the
|
||||
# beginning of the image was corrupted. The subsequent
|
||||
# QUORUM_REPORT_BAD event would be suppressed (because at that point,
|
||||
# there cannot have been a qmp_capabilities on the monitor). Because
|
||||
# that event is rate-limited, the next QUORUM_REPORT_BAD that happens
|
||||
# thanks to our qemu-io read (which should trigger a mismatch) would
|
||||
# then be delayed past the VM quit and not appear in the output.
|
||||
# So we keep the first 1M intact to see a QUORUM_REPORT_BAD resulting
|
||||
# from the qemu-io invocation.
|
||||
$QEMU_IO -c "write -P 0x42 1M 1M" "$TEST_DIR/2.raw" | _filter_qemu_io
|
||||
|
||||
# Fix the corruption (on a read-only quorum node, i.e. without taking
|
||||
# the WRITE permission on it -- its child nodes need to be R/W OTOH,
|
||||
# so that rewrite-corrupted works)
|
||||
echo
|
||||
echo '-- running quorum --'
|
||||
run_qemu \
|
||||
-blockdev file,node-name=file1,filename="$TEST_DIR/1.raw" \
|
||||
-blockdev file,node-name=file2,filename="$TEST_DIR/2.raw" \
|
||||
-blockdev file,node-name=file3,filename="$TEST_DIR/3.raw" \
|
||||
-blockdev '{
|
||||
"driver": "quorum",
|
||||
"node-name": "quorum",
|
||||
"read-only": true,
|
||||
"vote-threshold": 2,
|
||||
"rewrite-corrupted": true,
|
||||
"children": [ "file1", "file2", "file3" ]
|
||||
}' \
|
||||
-device virtio-scsi,id=scsi \
|
||||
-device scsi-hd,id=quorum-drive,bus=scsi.0,drive=quorum \
|
||||
<<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{
|
||||
"execute": "human-monitor-command",
|
||||
"arguments": {
|
||||
"command-line": 'qemu-io -d quorum-drive "read -P 0x32 0 $size"'
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo '-- checking that the image has been corrected --'
|
||||
$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io
|
||||
|
||||
echo
|
||||
echo "== breaking quorum =="
|
||||
|
||||
|
@ -47,6 +47,33 @@ read 10485760/10485760 bytes at offset 0
|
||||
read 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== using quorum rewrite corrupted mode without WRITE permission ==
|
||||
-- corrupting --
|
||||
wrote 1048576/1048576 bytes at offset 1048576
|
||||
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
-- running quorum --
|
||||
Testing: -blockdev file,node-name=file1,filename=TEST_DIR/1.IMGFMT -blockdev file,node-name=file2,filename=TEST_DIR/2.IMGFMT -blockdev file,node-name=file3,filename=TEST_DIR/3.IMGFMT -blockdev {
|
||||
"driver": "quorum",
|
||||
"node-name": "quorum",
|
||||
"read-only": true,
|
||||
"vote-threshold": 2,
|
||||
"rewrite-corrupted": true,
|
||||
"children": [ "file1", "file2", "file3" ]
|
||||
} -device virtio-scsi,id=scsi -device scsi-hd,id=quorum-drive,bus=scsi.0,drive=quorum
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "file2", "sectors-count": 20480, "sector-num": 0, "type": "read"}}
|
||||
read 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
{"return": ""}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
|
||||
|
||||
-- checking that the image has been corrected --
|
||||
read 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== breaking quorum ==
|
||||
wrote 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
Loading…
Reference in New Issue
Block a user