1 | The following changes since commit ee135aa0428fe5af2af7be04ff16d2b596a9330a: | 1 | The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.1-20180821' into staging (2018-08-21 13:27:11 +0100) | 3 | Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100) |
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://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 26bf474ba92c76e61bea51726e22da6dfd185296: | 9 | for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a: |
10 | 10 | ||
11 | block: iotest to catch abort on forced blockjob cancel (2018-08-21 15:20:37 -0400) | 11 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block job patches | 14 | Pull request |
15 | |||
16 | The main fix here is for io_uring. Spurious -EAGAIN errors can happen and the | ||
17 | request needs to be resubmitted. | ||
18 | |||
19 | The MAINTAINERS changes carry no risk and we might as well include them in QEMU | ||
20 | 6.1. | ||
21 | |||
15 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
16 | 23 | ||
17 | Jeff Cody (2): | 24 | Fabian Ebner (1): |
18 | block: for jobs, do not clear user_paused until after the resume | 25 | block/io_uring: resubmit when result is -EAGAIN |
19 | block: iotest to catch abort on forced blockjob cancel | ||
20 | 26 | ||
21 | job.c | 2 +- | 27 | Philippe Mathieu-Daudé (1): |
22 | tests/qemu-iotests/229 | 95 ++++++++++++++++++++++++++++++++++++++ | 28 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver |
23 | tests/qemu-iotests/229.out | 23 +++++++++ | 29 | |
24 | tests/qemu-iotests/group | 1 + | 30 | Stefano Garzarella (1): |
25 | 4 files changed, 120 insertions(+), 1 deletion(-) | 31 | MAINTAINERS: add Stefano Garzarella as io_uring reviewer |
26 | create mode 100755 tests/qemu-iotests/229 | 32 | |
27 | create mode 100644 tests/qemu-iotests/229.out | 33 | MAINTAINERS | 2 ++ |
34 | block/io_uring.c | 16 +++++++++++++++- | ||
35 | 2 files changed, 17 insertions(+), 1 deletion(-) | ||
28 | 36 | ||
29 | -- | 37 | -- |
30 | 2.17.1 | 38 | 2.31.1 |
31 | 39 | ||
32 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Stefano Garzarella <sgarzare@redhat.com> | ||
1 | 2 | ||
3 | I've been working with io_uring for a while so I'd like to help | ||
4 | with reviews. | ||
5 | |||
6 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
7 | Message-Id: <20210728131515.131045-1-sgarzare@redhat.com> | ||
8 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
9 | --- | ||
10 | MAINTAINERS | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/MAINTAINERS | ||
16 | +++ b/MAINTAINERS | ||
17 | @@ -XXX,XX +XXX,XX @@ Linux io_uring | ||
18 | M: Aarushi Mehta <mehta.aaru20@gmail.com> | ||
19 | M: Julia Suvorova <jusual@redhat.com> | ||
20 | M: Stefan Hajnoczi <stefanha@redhat.com> | ||
21 | +R: Stefano Garzarella <sgarzare@redhat.com> | ||
22 | L: qemu-block@nongnu.org | ||
23 | S: Maintained | ||
24 | F: block/io_uring.c | ||
25 | -- | ||
26 | 2.31.1 | ||
27 | diff view generated by jsdifflib |
1 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 1 | From: Fabian Ebner <f.ebner@proxmox.com> |
---|---|---|---|
2 | Reviewed-by: John Snow <jsnow@redhat.com> | 2 | |
3 | Message-id: df317f617fbe5affcf699cb8560e7b0c2e028a64.1534868459.git.jcody@redhat.com | 3 | Linux SCSI can throw spurious -EAGAIN in some corner cases in its |
4 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 4 | completion path, which will end up being the result in the completed |
5 | io_uring request. | ||
6 | |||
7 | Resubmitting such requests should allow block jobs to complete, even | ||
8 | if such spurious errors are encountered. | ||
9 | |||
10 | Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com> | ||
11 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
12 | Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> | ||
13 | Message-id: 20210729091029.65369-1-f.ebner@proxmox.com | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
5 | --- | 15 | --- |
6 | tests/qemu-iotests/229 | 95 ++++++++++++++++++++++++++++++++++++++ | 16 | block/io_uring.c | 16 +++++++++++++++- |
7 | tests/qemu-iotests/229.out | 23 +++++++++ | 17 | 1 file changed, 15 insertions(+), 1 deletion(-) |
8 | tests/qemu-iotests/group | 1 + | ||
9 | 3 files changed, 119 insertions(+) | ||
10 | create mode 100755 tests/qemu-iotests/229 | ||
11 | create mode 100644 tests/qemu-iotests/229.out | ||
12 | 18 | ||
13 | diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229 | 19 | diff --git a/block/io_uring.c b/block/io_uring.c |
14 | new file mode 100755 | ||
15 | index XXXXXXX..XXXXXXX | ||
16 | --- /dev/null | ||
17 | +++ b/tests/qemu-iotests/229 | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | +#!/bin/bash | ||
20 | +# | ||
21 | +# Test for force canceling a running blockjob that is paused in | ||
22 | +# an error state. | ||
23 | +# | ||
24 | +# Copyright (C) 2018 Red Hat, Inc. | ||
25 | +# | ||
26 | +# This program is free software; you can redistribute it and/or modify | ||
27 | +# it under the terms of the GNU General Public License as published by | ||
28 | +# the Free Software Foundation; either version 2 of the License, or | ||
29 | +# (at your option) any later version. | ||
30 | +# | ||
31 | +# This program is distributed in the hope that it will be useful, | ||
32 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
33 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
34 | +# GNU General Public License for more details. | ||
35 | +# | ||
36 | +# You should have received a copy of the GNU General Public License | ||
37 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
38 | +# | ||
39 | + | ||
40 | +# creator | ||
41 | +owner=jcody@redhat.com | ||
42 | + | ||
43 | +seq="$(basename $0)" | ||
44 | +echo "QA output created by $seq" | ||
45 | + | ||
46 | +here="$PWD" | ||
47 | +status=1 # failure is the default! | ||
48 | + | ||
49 | +_cleanup() | ||
50 | +{ | ||
51 | + _cleanup_qemu | ||
52 | + _cleanup_test_img | ||
53 | + rm -f "$TEST_IMG" "$DEST_IMG" | ||
54 | +} | ||
55 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
56 | + | ||
57 | +# get standard environment, filters and checks | ||
58 | +. ./common.rc | ||
59 | +. ./common.filter | ||
60 | +. ./common.qemu | ||
61 | + | ||
62 | +# Needs backing file and backing format support | ||
63 | +_supported_fmt qcow2 qed | ||
64 | +_supported_proto file | ||
65 | +_supported_os Linux | ||
66 | + | ||
67 | + | ||
68 | +DEST_IMG="$TEST_DIR/d.$IMGFMT" | ||
69 | +TEST_IMG="$TEST_DIR/b.$IMGFMT" | ||
70 | + | ||
71 | +_make_test_img 2M | ||
72 | + | ||
73 | +# destination for mirror will be too small, causing error | ||
74 | +TEST_IMG=$DEST_IMG _make_test_img 1M | ||
75 | + | ||
76 | +$QEMU_IO -c 'write 0 2M' "$TEST_IMG" | _filter_qemu_io | ||
77 | + | ||
78 | +_launch_qemu -drive id=testdisk,file="$TEST_IMG",format="$IMGFMT" | ||
79 | + | ||
80 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
81 | + "{'execute': 'qmp_capabilities'}" \ | ||
82 | + 'return' | ||
83 | + | ||
84 | +echo | ||
85 | +echo '=== Starting drive-mirror, causing error & stop ===' | ||
86 | +echo | ||
87 | + | ||
88 | +_send_qemu_cmd $QEMU_HANDLE \ | ||
89 | + "{'execute': 'drive-mirror', | ||
90 | + 'arguments': {'device': 'testdisk', | ||
91 | + 'mode': 'absolute-paths', | ||
92 | + 'format': '$IMGFMT', | ||
93 | + 'target': '$DEST_IMG', | ||
94 | + 'sync': 'full', | ||
95 | + 'mode': 'existing', | ||
96 | + 'on-source-error': 'stop', | ||
97 | + 'on-target-error': 'stop' }}" \ | ||
98 | + "JOB_STATUS_CHANGE.*pause" | ||
99 | + | ||
100 | +echo | ||
101 | +echo '=== Force cancel job paused in error state ===' | ||
102 | +echo | ||
103 | + | ||
104 | +success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \ | ||
105 | + "{'execute': 'block-job-cancel', | ||
106 | + 'arguments': { 'device': 'testdisk', | ||
107 | + 'force': true}}" \ | ||
108 | + "BLOCK_JOB_CANCELLED" "Assertion" | ||
109 | + | ||
110 | +# success, all done | ||
111 | +echo "*** done" | ||
112 | +rm -f $seq.full | ||
113 | +status=0 | ||
114 | diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out | ||
115 | new file mode 100644 | ||
116 | index XXXXXXX..XXXXXXX | ||
117 | --- /dev/null | ||
118 | +++ b/tests/qemu-iotests/229.out | ||
119 | @@ -XXX,XX +XXX,XX @@ | ||
120 | +QA output created by 229 | ||
121 | +Formatting 'TEST_DIR/b.IMGFMT', fmt=IMGFMT size=2097152 | ||
122 | +Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=1048576 | ||
123 | +wrote 2097152/2097152 bytes at offset 0 | ||
124 | +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
125 | +{"return": {}} | ||
126 | + | ||
127 | +=== Starting drive-mirror, causing error & stop === | ||
128 | + | ||
129 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}} | ||
130 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} | ||
131 | +{"return": {}} | ||
132 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}} | ||
133 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "testdisk"}} | ||
134 | + | ||
135 | +=== Force cancel job paused in error state === | ||
136 | + | ||
137 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} | ||
138 | +{"return": {}} | ||
139 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}} | ||
140 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}} | ||
141 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}} | ||
142 | +*** done | ||
143 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
144 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
145 | --- a/tests/qemu-iotests/group | 21 | --- a/block/io_uring.c |
146 | +++ b/tests/qemu-iotests/group | 22 | +++ b/block/io_uring.c |
147 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s) |
148 | 225 rw auto quick | 24 | total_bytes = ret + luringcb->total_read; |
149 | 226 auto quick | 25 | |
150 | 227 auto quick | 26 | if (ret < 0) { |
151 | +229 auto quick | 27 | - if (ret == -EINTR) { |
28 | + /* | ||
29 | + * Only writev/readv/fsync requests on regular files or host block | ||
30 | + * devices are submitted. Therefore -EAGAIN is not expected but it's | ||
31 | + * known to happen sometimes with Linux SCSI. Submit again and hope | ||
32 | + * the request completes successfully. | ||
33 | + * | ||
34 | + * For more information, see: | ||
35 | + * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u | ||
36 | + * | ||
37 | + * If the code is changed to submit other types of requests in the | ||
38 | + * future, then this workaround may need to be extended to deal with | ||
39 | + * genuine -EAGAIN results that should not be resubmitted | ||
40 | + * immediately. | ||
41 | + */ | ||
42 | + if (ret == -EINTR || ret == -EAGAIN) { | ||
43 | luring_resubmit(s, luringcb); | ||
44 | continue; | ||
45 | } | ||
152 | -- | 46 | -- |
153 | 2.17.1 | 47 | 2.31.1 |
154 | 48 | ||
155 | diff view generated by jsdifflib |
1 | The function job_cancel_async() will always cause an assert for blockjob | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | user resume. We set job->user_paused to false, and then call | ||
3 | job->driver->user_resume(). In the case of blockjobs, this is the | ||
4 | block_job_user_resume() function. | ||
5 | 2 | ||
6 | In that function, we assert that job.user_paused is set to true. | 3 | I'm interested in following the activity around the NVMe bdrv. |
7 | Unfortunately, right before calling this function, it has explicitly | ||
8 | been set to false. | ||
9 | 4 | ||
10 | The fix is pretty simple: set job->user_paused to false only after the | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
11 | job user_resume() function has been called. | 6 | Message-id: 20210728183340.2018313-1-philmd@redhat.com |
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
8 | --- | ||
9 | MAINTAINERS | 1 + | ||
10 | 1 file changed, 1 insertion(+) | ||
12 | 11 | ||
13 | Reviewed-by: John Snow <jsnow@redhat.com> | 12 | diff --git a/MAINTAINERS b/MAINTAINERS |
14 | Reviewed-by: Eric Blake <eblake@redhat.com> | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 14 | --- a/MAINTAINERS |
16 | Message-id: bb183b77d8f2dd6bd67b8da559a90ac1e74b2052.1534868459.git.jcody@redhat.com | 15 | +++ b/MAINTAINERS |
17 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 16 | @@ -XXX,XX +XXX,XX @@ F: block/null.c |
18 | --- | 17 | NVMe Block Driver |
19 | job.c | 2 +- | 18 | M: Stefan Hajnoczi <stefanha@redhat.com> |
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | 19 | R: Fam Zheng <fam@euphon.net> |
20 | +R: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
21 | L: qemu-block@nongnu.org | ||
22 | S: Supported | ||
23 | F: block/nvme* | ||
24 | -- | ||
25 | 2.31.1 | ||
21 | 26 | ||
22 | diff --git a/job.c b/job.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/job.c | ||
25 | +++ b/job.c | ||
26 | @@ -XXX,XX +XXX,XX @@ static void job_cancel_async(Job *job, bool force) | ||
27 | { | ||
28 | if (job->user_paused) { | ||
29 | /* Do not call job_enter here, the caller will handle it. */ | ||
30 | - job->user_paused = false; | ||
31 | if (job->driver->user_resume) { | ||
32 | job->driver->user_resume(job); | ||
33 | } | ||
34 | + job->user_paused = false; | ||
35 | assert(job->pause_count > 0); | ||
36 | job->pause_count--; | ||
37 | } | ||
38 | -- | ||
39 | 2.17.1 | ||
40 | |||
41 | diff view generated by jsdifflib |