1 | The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935: | 1 | The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100) | 3 | Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/stefanha/qemu.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 cc8eecd7f105a1dff5876adeb238a14696061a4a: | 9 | for you to fetch changes up to 9b06d0d076271d76e5384d767ef94a676f0a9efd: |
10 | 10 | ||
11 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100) | 11 | block/blkio: add more comments on the fd passing handling (2023-08-03 11:28:43 -0400) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | The main fix here is for io_uring. Spurious -EAGAIN errors can happen and the | 16 | Fix for an fd leak in the blkio block driver. |
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 | 17 | ||
22 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
23 | 19 | ||
24 | Fabian Ebner (1): | 20 | Stefano Garzarella (2): |
25 | block/io_uring: resubmit when result is -EAGAIN | 21 | block/blkio: close the fd when blkio_connect() fails |
22 | block/blkio: add more comments on the fd passing handling | ||
26 | 23 | ||
27 | Philippe Mathieu-Daudé (1): | 24 | block/blkio.c | 28 +++++++++++++++++++++------- |
28 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver | 25 | 1 file changed, 21 insertions(+), 7 deletions(-) |
29 | |||
30 | Stefano Garzarella (1): | ||
31 | MAINTAINERS: add Stefano Garzarella as io_uring reviewer | ||
32 | |||
33 | MAINTAINERS | 2 ++ | ||
34 | block/io_uring.c | 16 +++++++++++++++- | ||
35 | 2 files changed, 17 insertions(+), 1 deletion(-) | ||
36 | 26 | ||
37 | -- | 27 | -- |
38 | 2.31.1 | 28 | 2.41.0 |
39 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | I'm interested in following the activity around the NVMe bdrv. | 3 | libblkio drivers take ownership of `fd` only after a successful |
4 | blkio_connect(), so if it fails, we are still the owners. | ||
4 | 5 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 6 | Fixes: cad2ccc395 ("block/blkio: use qemu_open() to support fd passing for virtio-blk") |
6 | Message-id: 20210728183340.2018313-1-philmd@redhat.com | 7 | Suggested-by: Hanna Czenczek <hreitz@redhat.com> |
8 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
9 | Reviewed-by: Hanna Czenczek <hreitz@redhat.com> | ||
10 | Message-id: 20230803082825.25293-2-sgarzare@redhat.com | ||
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
8 | --- | 12 | --- |
9 | MAINTAINERS | 1 + | 13 | block/blkio.c | 11 ++++++++--- |
10 | 1 file changed, 1 insertion(+) | 14 | 1 file changed, 8 insertions(+), 3 deletions(-) |
11 | 15 | ||
12 | diff --git a/MAINTAINERS b/MAINTAINERS | 16 | diff --git a/block/blkio.c b/block/blkio.c |
13 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/MAINTAINERS | 18 | --- a/block/blkio.c |
15 | +++ b/MAINTAINERS | 19 | +++ b/block/blkio.c |
16 | @@ -XXX,XX +XXX,XX @@ F: block/null.c | 20 | @@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, |
17 | NVMe Block Driver | 21 | const char *path = qdict_get_try_str(options, "path"); |
18 | M: Stefan Hajnoczi <stefanha@redhat.com> | 22 | BDRVBlkioState *s = bs->opaque; |
19 | R: Fam Zheng <fam@euphon.net> | 23 | bool fd_supported = false; |
20 | +R: Philippe Mathieu-Daudé <philmd@redhat.com> | 24 | - int fd, ret; |
21 | L: qemu-block@nongnu.org | 25 | + int fd = -1, ret; |
22 | S: Supported | 26 | |
23 | F: block/nvme* | 27 | if (!path) { |
28 | error_setg(errp, "missing 'path' option"); | ||
29 | @@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, | ||
30 | if (ret < 0) { | ||
31 | fd_supported = false; | ||
32 | qemu_close(fd); | ||
33 | + fd = -1; | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | @@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, | ||
38 | } | ||
39 | |||
40 | ret = blkio_connect(s->blkio); | ||
41 | + if (ret < 0 && fd >= 0) { | ||
42 | + /* Failed to give the FD to libblkio, close it */ | ||
43 | + qemu_close(fd); | ||
44 | + fd = -1; | ||
45 | + } | ||
46 | + | ||
47 | /* | ||
48 | * If the libblkio driver doesn't support the `fd` property, blkio_connect() | ||
49 | * will fail with -EINVAL. So let's try calling blkio_connect() again by | ||
50 | * directly setting `path`. | ||
51 | */ | ||
52 | if (fd_supported && ret == -EINVAL) { | ||
53 | - qemu_close(fd); | ||
54 | - | ||
55 | /* | ||
56 | * We need to clear the `fd` property we set previously by setting | ||
57 | * it to -1. | ||
24 | -- | 58 | -- |
25 | 2.31.1 | 59 | 2.41.0 |
26 | diff view generated by jsdifflib |
1 | From: Stefano Garzarella <sgarzare@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | I've been working with io_uring for a while so I'd like to help | 3 | As Hanna pointed out, it is not clear in the code why qemu_open() |
4 | with reviews. | 4 | can fail, and why blkio_set_int("fd") is not enough to discover |
5 | the `fd` property support. | ||
5 | 6 | ||
7 | Let's fix them by adding more details in the code comments. | ||
8 | |||
9 | Suggested-by: Hanna Czenczek <hreitz@redhat.com> | ||
10 | Reviewed-by: Hanna Czenczek <hreitz@redhat.com> | ||
6 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | 11 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
7 | Message-Id: <20210728131515.131045-1-sgarzare@redhat.com> | 12 | Message-id: 20230803082825.25293-3-sgarzare@redhat.com |
8 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
9 | --- | 14 | --- |
10 | MAINTAINERS | 1 + | 15 | block/blkio.c | 15 ++++++++++++--- |
11 | 1 file changed, 1 insertion(+) | 16 | 1 file changed, 12 insertions(+), 3 deletions(-) |
12 | 17 | ||
13 | diff --git a/MAINTAINERS b/MAINTAINERS | 18 | diff --git a/block/blkio.c b/block/blkio.c |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/MAINTAINERS | 20 | --- a/block/blkio.c |
16 | +++ b/MAINTAINERS | 21 | +++ b/block/blkio.c |
17 | @@ -XXX,XX +XXX,XX @@ Linux io_uring | 22 | @@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, |
18 | M: Aarushi Mehta <mehta.aaru20@gmail.com> | 23 | */ |
19 | M: Julia Suvorova <jusual@redhat.com> | 24 | fd = qemu_open(path, O_RDWR, NULL); |
20 | M: Stefan Hajnoczi <stefanha@redhat.com> | 25 | if (fd < 0) { |
21 | +R: Stefano Garzarella <sgarzare@redhat.com> | 26 | + /* |
22 | L: qemu-block@nongnu.org | 27 | + * qemu_open() can fail if the user specifies a path that is not |
23 | S: Maintained | 28 | + * a file or device, for example in the case of Unix Domain Socket |
24 | F: block/io_uring.c | 29 | + * for the virtio-blk-vhost-user driver. In such cases let's have |
30 | + * libblkio open the path directly. | ||
31 | + */ | ||
32 | fd_supported = false; | ||
33 | } else { | ||
34 | ret = blkio_set_int(s->blkio, "fd", fd); | ||
35 | @@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | - * If the libblkio driver doesn't support the `fd` property, blkio_connect() | ||
40 | - * will fail with -EINVAL. So let's try calling blkio_connect() again by | ||
41 | - * directly setting `path`. | ||
42 | + * Before https://gitlab.com/libblkio/libblkio/-/merge_requests/208 | ||
43 | + * (libblkio <= v1.3.0), setting the `fd` property is not enough to check | ||
44 | + * whether the driver supports the `fd` property or not. In that case, | ||
45 | + * blkio_connect() will fail with -EINVAL. | ||
46 | + * So let's try calling blkio_connect() again by directly setting `path` | ||
47 | + * to cover this scenario. | ||
48 | */ | ||
49 | if (fd_supported && ret == -EINVAL) { | ||
50 | /* | ||
25 | -- | 51 | -- |
26 | 2.31.1 | 52 | 2.41.0 |
27 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Fabian Ebner <f.ebner@proxmox.com> | ||
2 | 1 | ||
3 | Linux SCSI can throw spurious -EAGAIN in some corner cases in its | ||
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> | ||
15 | --- | ||
16 | block/io_uring.c | 16 +++++++++++++++- | ||
17 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/block/io_uring.c b/block/io_uring.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/block/io_uring.c | ||
22 | +++ b/block/io_uring.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s) | ||
24 | total_bytes = ret + luringcb->total_read; | ||
25 | |||
26 | if (ret < 0) { | ||
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 | } | ||
46 | -- | ||
47 | 2.31.1 | ||
48 | diff view generated by jsdifflib |