From: "Daniel P. Berrangé" <berrange@redhat.com>
To: lishan <lishan24@huawei.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, eric.fangyi@huawei.com
Subject: Re: [PATCH] block/file-posix: Limit max_iov to IOV_MAX
Date: Mon, 20 Sep 2021 10:03:34 +0100 [thread overview]
Message-ID: <YUhOZuo2kclYpKZ+@redhat.com> (raw)
In-Reply-To: <20210918040658.19484-1-lishan24@huawei.com>
CC'ing qemu-block list
On Sat, Sep 18, 2021 at 12:06:58PM +0800, lishan wrote:
> AIO read/write. The size of iocb->aio_nbytes in the kernel cannot exceed UIO_MAXIOV = 1024.
> max_segments read from the block device layer may be greater than UIO_MAXIOV,
> this causes the ioq_submit interface to return a -22(-EINVAL) error result.
> ---
> block/file-posix.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index d81e15efa4..137e27e47b 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1273,7 +1273,8 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
>
> ret = hdev_get_max_segments(s->fd, &st);
> if (ret > 0) {
> - bs->bl.max_iov = ret;
> + /* The maximum segment size allowed by the kernel is UIO_MAXIOV = 1024. */
> + bs->bl.max_iov = MIN(ret, IOV_MAX);
This change matches a bug fix we've done downstream for QEMU, but it
was suggested that the upstream patch would be taking a different
approach for a more comprehensive fix.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-09-20 9:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 4:06 [PATCH] block/file-posix: Limit max_iov to IOV_MAX lishan
2021-09-20 4:47 ` Markus Armbruster
2021-09-20 9:03 ` Daniel P. Berrangé [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-18 7:33 lishan
2021-09-20 8:14 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YUhOZuo2kclYpKZ+@redhat.com \
--to=berrange@redhat.com \
--cc=eric.fangyi@huawei.com \
--cc=lishan24@huawei.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).