1 | The following changes since commit c416eecea5f3aea863ab8fda5a36a24157b8f704: | 1 | The following changes since commit 29e0855c5af62bbb0b0b6fed792e004dad92ba95: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-05-15 17:02:00 +0100) | 3 | Merge remote-tracking branch 'remotes/elmarco/tags/slirp-pull-request' into staging (2020-03-22 21:00:38 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | https://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to c82be42cc803b36fd7aed5dceec68312c7056fd5: | 9 | for you to fetch changes up to ff807d559205a434fd37d3343f01a0ab128bd190: |
10 | 10 | ||
11 | nfs: Remove processed options from QDict (2018-05-16 13:37:47 -0400) | 11 | aio-posix: fix io_uring with external events (2020-03-23 11:05:44 +0000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches | 14 | Pull request |
15 | |||
15 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
16 | 17 | ||
17 | Kevin Wolf (2): | 18 | Stefan Hajnoczi (1): |
18 | nfs: Fix error path in nfs_options_qdict_to_qapi() | 19 | aio-posix: fix io_uring with external events |
19 | nfs: Remove processed options from QDict | ||
20 | 20 | ||
21 | Stefan Hajnoczi (2): | 21 | util/fdmon-io_uring.c | 13 ++++++++++++- |
22 | qemu-iotests: reduce chance of races in 185 | 22 | 1 file changed, 12 insertions(+), 1 deletion(-) |
23 | blockjob: do not cancel timer in resume | ||
24 | |||
25 | block/nfs.c | 8 ++++++++ | ||
26 | blockjob.c | 22 +++++++++++++++------- | ||
27 | tests/qemu-iotests/185 | 17 +++++++++++++---- | ||
28 | tests/qemu-iotests/185.out | 12 +++++------- | ||
29 | 4 files changed, 41 insertions(+), 18 deletions(-) | ||
30 | 23 | ||
31 | -- | 24 | -- |
32 | 2.13.6 | 25 | 2.24.1 |
33 | 26 | ||
34 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
2 | 1 | ||
3 | Commit 8565c3ab537e78f3e69977ec2c609dc9417a806e ("qemu-iotests: fix | ||
4 | 185") identified a race condition in a sub-test. | ||
5 | |||
6 | Similar issues also affect the other sub-tests. If disk I/O completes | ||
7 | quickly, it races with the QMP 'quit' command. This causes spurious | ||
8 | test failures because QMP events are emitted in an unpredictable order. | ||
9 | |||
10 | This test relies on QEMU internals and there is no QMP API for getting | ||
11 | deterministic behavior needed to make this test 100% reliable. At the | ||
12 | same time, the test is useful and it would be a shame to remove it. | ||
13 | |||
14 | Add sleep 0.5 to reduce the chance of races. This is not a real fix but | ||
15 | appears to reduce spurious failures in practice. | ||
16 | |||
17 | Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
18 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
19 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
20 | Message-id: 20180508135436.30140-2-stefanha@redhat.com | ||
21 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
22 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
23 | --- | ||
24 | tests/qemu-iotests/185 | 12 ++++++++++++ | ||
25 | 1 file changed, 12 insertions(+) | ||
26 | |||
27 | diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 | ||
28 | index XXXXXXX..XXXXXXX 100755 | ||
29 | --- a/tests/qemu-iotests/185 | ||
30 | +++ b/tests/qemu-iotests/185 | ||
31 | @@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $h \ | ||
32 | 'speed': 65536 } }" \ | ||
33 | "return" | ||
34 | |||
35 | +# If we don't sleep here 'quit' command races with disk I/O | ||
36 | +sleep 0.5 | ||
37 | + | ||
38 | _send_qemu_cmd $h "{ 'execute': 'quit' }" "return" | ||
39 | wait=1 _cleanup_qemu | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $h \ | ||
42 | 'speed': 65536 } }" \ | ||
43 | "return" | ||
44 | |||
45 | +# If we don't sleep here 'quit' command races with disk I/O | ||
46 | +sleep 0.5 | ||
47 | + | ||
48 | _send_qemu_cmd $h "{ 'execute': 'quit' }" "return" | ||
49 | wait=1 _cleanup_qemu | ||
50 | |||
51 | @@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $h \ | ||
52 | 'speed': 65536 } }" \ | ||
53 | "return" | ||
54 | |||
55 | +# If we don't sleep here 'quit' command races with disk I/O | ||
56 | +sleep 0.5 | ||
57 | + | ||
58 | _send_qemu_cmd $h "{ 'execute': 'quit' }" "return" | ||
59 | wait=1 _cleanup_qemu | ||
60 | |||
61 | @@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $h \ | ||
62 | 'speed': 65536 } }" \ | ||
63 | "return" | ||
64 | |||
65 | +# If we don't sleep here 'quit' command races with disk I/O | ||
66 | +sleep 0.5 | ||
67 | + | ||
68 | _send_qemu_cmd $h "{ 'execute': 'quit' }" "return" | ||
69 | wait=1 _cleanup_qemu | ||
70 | |||
71 | -- | ||
72 | 2.13.6 | ||
73 | |||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
2 | 1 | ||
3 | Currently the timer is cancelled and the block job is entered by | ||
4 | block_job_resume(). This behavior causes drain to run extra blockjob | ||
5 | iterations when the job was sleeping due to the ratelimit. | ||
6 | |||
7 | This patch leaves the job asleep when block_job_resume() is called. | ||
8 | Jobs can still be forcibly woken up using block_job_enter(), which is | ||
9 | used to cancel jobs. | ||
10 | |||
11 | After this patch drain no longer runs extra blockjob iterations. This | ||
12 | is the expected behavior that qemu-iotests 185 used to rely on. We | ||
13 | temporarily changed the 185 test output to make it pass for the QEMU | ||
14 | 2.12 release but now it's time to address this issue. | ||
15 | |||
16 | Cc: QingFeng Hao <haoqf@linux.vnet.ibm.com> | ||
17 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
18 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
19 | Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com> | ||
20 | Message-id: 20180508135436.30140-3-stefanha@redhat.com | ||
21 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
22 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
23 | --- | ||
24 | blockjob.c | 22 +++++++++++++++------- | ||
25 | tests/qemu-iotests/185 | 5 +---- | ||
26 | tests/qemu-iotests/185.out | 12 +++++------- | ||
27 | 3 files changed, 21 insertions(+), 18 deletions(-) | ||
28 | |||
29 | diff --git a/blockjob.c b/blockjob.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/blockjob.c | ||
32 | +++ b/blockjob.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void block_job_txn_del_job(BlockJob *job) | ||
34 | } | ||
35 | } | ||
36 | |||
37 | +/* Assumes the block_job_mutex is held */ | ||
38 | +static bool block_job_timer_pending(BlockJob *job) | ||
39 | +{ | ||
40 | + return timer_pending(&job->sleep_timer); | ||
41 | +} | ||
42 | + | ||
43 | +/* Assumes the block_job_mutex is held */ | ||
44 | +static bool block_job_timer_not_pending(BlockJob *job) | ||
45 | +{ | ||
46 | + return !block_job_timer_pending(job); | ||
47 | +} | ||
48 | + | ||
49 | static void block_job_pause(BlockJob *job) | ||
50 | { | ||
51 | job->pause_count++; | ||
52 | @@ -XXX,XX +XXX,XX @@ static void block_job_resume(BlockJob *job) | ||
53 | if (job->pause_count) { | ||
54 | return; | ||
55 | } | ||
56 | - block_job_enter(job); | ||
57 | + | ||
58 | + /* kick only if no timer is pending */ | ||
59 | + block_job_enter_cond(job, block_job_timer_not_pending); | ||
60 | } | ||
61 | |||
62 | void block_job_ref(BlockJob *job) | ||
63 | @@ -XXX,XX +XXX,XX @@ static void block_job_completed_txn_success(BlockJob *job) | ||
64 | } | ||
65 | } | ||
66 | |||
67 | -/* Assumes the block_job_mutex is held */ | ||
68 | -static bool block_job_timer_pending(BlockJob *job) | ||
69 | -{ | ||
70 | - return timer_pending(&job->sleep_timer); | ||
71 | -} | ||
72 | - | ||
73 | void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) | ||
74 | { | ||
75 | int64_t old_speed = job->speed; | ||
76 | diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 | ||
77 | index XXXXXXX..XXXXXXX 100755 | ||
78 | --- a/tests/qemu-iotests/185 | ||
79 | +++ b/tests/qemu-iotests/185 | ||
80 | @@ -XXX,XX +XXX,XX @@ echo | ||
81 | # command to be received (after receiving the command, the rest runs | ||
82 | # synchronously, so jobs can arbitrarily continue or complete). | ||
83 | # | ||
84 | -# Jobs present while QEMU is terminating iterate once more due to | ||
85 | -# bdrv_drain_all(). | ||
86 | -# | ||
87 | # The buffer size for commit and streaming is 512k (waiting for 8 seconds after | ||
88 | # the first request), for active commit and mirror it's large enough to cover | ||
89 | # the full 4M, and for backup it's the qcow2 cluster size, which we know is | ||
90 | # 64k. As all of these are at least as large as the speed, we are sure that the | ||
91 | -# offset advances exactly twice before qemu exits. | ||
92 | +# offset advances exactly once before qemu exits. | ||
93 | |||
94 | _send_qemu_cmd $h \ | ||
95 | "{ 'execute': 'block-commit', | ||
96 | diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/tests/qemu-iotests/185.out | ||
99 | +++ b/tests/qemu-iotests/185.out | ||
100 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q | ||
101 | {"return": {}} | ||
102 | {"return": {}} | ||
103 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
104 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 1048576, "speed": 65536, "type": "commit"}} | ||
105 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "commit"}} | ||
106 | |||
107 | === Start active commit job and exit qemu === | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q | ||
110 | {"return": {}} | ||
111 | {"return": {}} | ||
112 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
113 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}} | ||
114 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}} | ||
115 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}} | ||
116 | |||
117 | === Start mirror job and exit qemu === | ||
118 | |||
119 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l | ||
120 | {"return": {}} | ||
121 | {"return": {}} | ||
122 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
123 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} | ||
124 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} | ||
125 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} | ||
126 | |||
127 | === Start backup job and exit qemu === | ||
128 | |||
129 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l | ||
130 | {"return": {}} | ||
131 | {"return": {}} | ||
132 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
133 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 131072, "speed": 65536, "type": "backup"}} | ||
134 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 65536, "speed": 65536, "type": "backup"}} | ||
135 | |||
136 | === Start streaming job and exit qemu === | ||
137 | |||
138 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l | ||
139 | {"return": {}} | ||
140 | {"return": {}} | ||
141 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | ||
142 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 1048576, "speed": 65536, "type": "stream"}} | ||
143 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "stream"}} | ||
144 | No errors were found on the image. | ||
145 | *** done | ||
146 | -- | ||
147 | 2.13.6 | ||
148 | |||
149 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | Don't throw away local_err, but propagate it to errp. | ||
4 | |||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Message-id: 20180516161034.27440-1-kwolf@redhat.com | ||
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
8 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
9 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
10 | --- | ||
11 | block/nfs.c | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/block/nfs.c b/block/nfs.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/nfs.c | ||
17 | +++ b/block/nfs.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options, | ||
19 | qobject_unref(crumpled); | ||
20 | |||
21 | if (local_err) { | ||
22 | + error_propagate(errp, local_err); | ||
23 | return NULL; | ||
24 | } | ||
25 | |||
26 | -- | ||
27 | 2.13.6 | ||
28 | |||
29 | diff view generated by jsdifflib |
1 | From: Kevin Wolf <kwolf@redhat.com> | 1 | When external event sources are disabled fdmon-io_uring falls back to |
---|---|---|---|
2 | fdmon-poll. The ->need_wait() callback needs to watch for this so it | ||
3 | can return true when external event sources are disabled. | ||
2 | 4 | ||
3 | Commit c22a03454 QAPIfied option parsing in the NFS block driver, but | 5 | It is also necessary to call ->wait() when AioHandlers have changed |
4 | forgot to remove all the options we processed. Therefore, we get an | 6 | because io_uring is asynchronous and we must submit new sqes. |
5 | error in bdrv_open_inherit(), which thinks the remaining options are | ||
6 | invalid. Trying to open an NFS image will result in an error like this: | ||
7 | 7 | ||
8 | Block protocol 'nfs' doesn't support the option 'server.host' | 8 | Both of these changes to ->need_wait() together fix tests/test-aio -p |
9 | /aio/external-client, which failed with: | ||
9 | 10 | ||
10 | Remove all options from the QDict to make the NFS driver work again. | 11 | test-aio: tests/test-aio.c:404: test_aio_external_client: Assertion `aio_poll(ctx, false)' failed. |
11 | 12 | ||
12 | Cc: qemu-stable@nongnu.org | 13 | Reported-by: Julia Suvorova <jusual@redhat.com> |
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | Message-id: 20180516160816.26259-1-kwolf@redhat.com | 15 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
15 | Reviewed-by: Eric Blake <eblake@redhat.com> | 16 | Message-id: 20200319163559.117903-1-stefanha@redhat.com |
16 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 17 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
17 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
18 | --- | 18 | --- |
19 | block/nfs.c | 7 +++++++ | 19 | util/fdmon-io_uring.c | 13 ++++++++++++- |
20 | 1 file changed, 7 insertions(+) | 20 | 1 file changed, 12 insertions(+), 1 deletion(-) |
21 | 21 | ||
22 | diff --git a/block/nfs.c b/block/nfs.c | 22 | diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c |
23 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/block/nfs.c | 24 | --- a/util/fdmon-io_uring.c |
25 | +++ b/block/nfs.c | 25 | +++ b/util/fdmon-io_uring.c |
26 | @@ -XXX,XX +XXX,XX @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options, | 26 | @@ -XXX,XX +XXX,XX @@ static int fdmon_io_uring_wait(AioContext *ctx, AioHandlerList *ready_list, |
27 | BlockdevOptionsNfs *opts = NULL; | 27 | |
28 | QObject *crumpled = NULL; | 28 | static bool fdmon_io_uring_need_wait(AioContext *ctx) |
29 | Visitor *v; | 29 | { |
30 | + const QDictEntry *e; | 30 | - return io_uring_cq_ready(&ctx->fdmon_io_uring); |
31 | Error *local_err = NULL; | 31 | + /* Have io_uring events completed? */ |
32 | 32 | + if (io_uring_cq_ready(&ctx->fdmon_io_uring)) { | |
33 | crumpled = qdict_crumple(options, errp); | 33 | + return true; |
34 | @@ -XXX,XX +XXX,XX @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options, | ||
35 | return NULL; | ||
36 | } | ||
37 | |||
38 | + /* Remove the processed options from the QDict (the visitor processes | ||
39 | + * _all_ options in the QDict) */ | ||
40 | + while ((e = qdict_first(options))) { | ||
41 | + qdict_del(options, e->key); | ||
42 | + } | 34 | + } |
43 | + | 35 | + |
44 | return opts; | 36 | + /* Do we need to submit new io_uring sqes? */ |
37 | + if (!QSLIST_EMPTY_RCU(&ctx->submit_list)) { | ||
38 | + return true; | ||
39 | + } | ||
40 | + | ||
41 | + /* Are we falling back to fdmon-poll? */ | ||
42 | + return atomic_read(&ctx->external_disable_cnt); | ||
45 | } | 43 | } |
46 | 44 | ||
45 | static const FDMonOps fdmon_io_uring_ops = { | ||
47 | -- | 46 | -- |
48 | 2.13.6 | 47 | 2.24.1 |
49 | 48 | ||
50 | diff view generated by jsdifflib |