-----BEGIN PGP SIGNATURE-----

iQIcBAABAgAGBQJa/GyHAAoJEL2+eyfA3jBX6QMP/0mgTLa12N0wAsTAe+QcLBkM
 wh7tJF/vlGBDigxzrGb43unq8wQT7HoCx83XpjpSwirLD+n5vQ++xeoKB0CTs/27
 jH29jqY52/jPRv293kTwizybQASWBMDxQcPAtYrXd3shmm8BwzrnP3L1zFuAT0cn
 xCaVD/ZXkA+OFn9QMQASu0bbmfhpfksvW/xIPnQNCjYLY/FpoanxJBe0yuc3VSaA
 nAbw30HU6jD8n4e/YHpoVBn4KFN8B3DEqcobmcWl/byD7OhlQJYof8k5smcuvdfz
 IkUBNMBy3i73qJWdPXKaef4G+Ku9rVe48kT2jaTbw7OGbY95Djc9fuChkf2G1zlJ
 UDJQN3x7AeiOFu/cHvzmyEXdbwBVvrHojERd4YK7OUHkS/EwM3cRm+BAKzHcypF2
 d7OixPF8AO0rQzO2FL3KrUW7wuQZbKTDL4Cw7BB/F01iakvV+ZN+WBOucSL5trNI
 ouSLhoceobBdaCea1nECHmxFk+xcIhNyXn0ylxc8+O8RLcFzm39o4k5nkQyzPiD7
 kqSCs43P/EocSVohH78O2zdvZ2dPpv9nzm8NZ2vbC4aLAX7+b/iqTSuNz6MA8ocI
 KVdsyRbJUX4Tz3tnPM4usWkfkIf2MyIDHXu9zOOtSwZ22/k2cIXxmn3lbI176Ev0
 V7WJ4BGp6FCOD2Q4Aj8h
 =VUBH
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging

# gpg: Signature made Wed 16 May 2018 18:38:15 BST
# gpg:                using RSA key BDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/block-pull-request:
  nfs: Remove processed options from QDict
  nfs: Fix error path in nfs_options_qdict_to_qapi()
  blockjob: do not cancel timer in resume
  qemu-iotests: reduce chance of races in 185

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-05-17 11:59:50 +01:00
commit a4207e3b00
4 changed files with 41 additions and 18 deletions

View File

@ -557,6 +557,7 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
BlockdevOptionsNfs *opts = NULL; BlockdevOptionsNfs *opts = NULL;
QObject *crumpled = NULL; QObject *crumpled = NULL;
Visitor *v; Visitor *v;
const QDictEntry *e;
Error *local_err = NULL; Error *local_err = NULL;
crumpled = qdict_crumple(options, errp); crumpled = qdict_crumple(options, errp);
@ -570,9 +571,16 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
qobject_unref(crumpled); qobject_unref(crumpled);
if (local_err) { if (local_err) {
error_propagate(errp, local_err);
return NULL; return NULL;
} }
/* Remove the processed options from the QDict (the visitor processes
* _all_ options in the QDict) */
while ((e = qdict_first(options))) {
qdict_del(options, e->key);
}
return opts; return opts;
} }

View File

@ -209,6 +209,18 @@ static void block_job_txn_del_job(BlockJob *job)
} }
} }
/* Assumes the block_job_mutex is held */
static bool block_job_timer_pending(BlockJob *job)
{
return timer_pending(&job->sleep_timer);
}
/* Assumes the block_job_mutex is held */
static bool block_job_timer_not_pending(BlockJob *job)
{
return !block_job_timer_pending(job);
}
static void block_job_pause(BlockJob *job) static void block_job_pause(BlockJob *job)
{ {
job->pause_count++; job->pause_count++;
@ -221,7 +233,9 @@ static void block_job_resume(BlockJob *job)
if (job->pause_count) { if (job->pause_count) {
return; return;
} }
block_job_enter(job);
/* kick only if no timer is pending */
block_job_enter_cond(job, block_job_timer_not_pending);
} }
void block_job_ref(BlockJob *job) void block_job_ref(BlockJob *job)
@ -656,12 +670,6 @@ static void block_job_completed_txn_success(BlockJob *job)
} }
} }
/* Assumes the block_job_mutex is held */
static bool block_job_timer_pending(BlockJob *job)
{
return timer_pending(&job->sleep_timer);
}
void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
{ {
int64_t old_speed = job->speed; int64_t old_speed = job->speed;

View File

@ -101,14 +101,11 @@ echo
# command to be received (after receiving the command, the rest runs # command to be received (after receiving the command, the rest runs
# synchronously, so jobs can arbitrarily continue or complete). # synchronously, so jobs can arbitrarily continue or complete).
# #
# Jobs present while QEMU is terminating iterate once more due to
# bdrv_drain_all().
#
# The buffer size for commit and streaming is 512k (waiting for 8 seconds after # The buffer size for commit and streaming is 512k (waiting for 8 seconds after
# the first request), for active commit and mirror it's large enough to cover # the first request), for active commit and mirror it's large enough to cover
# the full 4M, and for backup it's the qcow2 cluster size, which we know is # the full 4M, and for backup it's the qcow2 cluster size, which we know is
# 64k. As all of these are at least as large as the speed, we are sure that the # 64k. As all of these are at least as large as the speed, we are sure that the
# offset advances exactly twice before qemu exits. # offset advances exactly once before qemu exits.
_send_qemu_cmd $h \ _send_qemu_cmd $h \
"{ 'execute': 'block-commit', "{ 'execute': 'block-commit',
@ -118,6 +115,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \ 'speed': 65536 } }" \
"return" "return"
# If we don't sleep here 'quit' command races with disk I/O
sleep 0.5
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return" _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu wait=1 _cleanup_qemu
@ -137,6 +137,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \ 'speed': 65536 } }" \
"return" "return"
# If we don't sleep here 'quit' command races with disk I/O
sleep 0.5
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return" _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu wait=1 _cleanup_qemu
@ -183,6 +186,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \ 'speed': 65536 } }" \
"return" "return"
# If we don't sleep here 'quit' command races with disk I/O
sleep 0.5
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return" _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu wait=1 _cleanup_qemu
@ -201,6 +207,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \ 'speed': 65536 } }" \
"return" "return"
# If we don't sleep here 'quit' command races with disk I/O
sleep 0.5
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return" _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu wait=1 _cleanup_qemu

View File

@ -20,7 +20,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 1048576, "speed": 65536, "type": "commit"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "commit"}}
=== Start active commit job and exit qemu === === Start active commit job and exit qemu ===
@ -28,8 +28,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}}
=== Start mirror job and exit qemu === === Start mirror job and exit qemu ===
@ -38,8 +37,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
=== Start backup job and exit qemu === === Start backup job and exit qemu ===
@ -48,7 +46,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 131072, "speed": 65536, "type": "backup"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 65536, "speed": 65536, "type": "backup"}}
=== Start streaming job and exit qemu === === Start streaming job and exit qemu ===
@ -56,6 +54,6 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
{"return": {}} {"return": {}}
{"return": {}} {"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 1048576, "speed": 65536, "type": "stream"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "stream"}}
No errors were found on the image. No errors were found on the image.
*** done *** done