qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] block/file-posix: Limit max_iov to IOV_MAX


From: Markus Armbruster
Subject: Re: [PATCH] block/file-posix: Limit max_iov to IOV_MAX
Date: Mon, 20 Sep 2021 06:47:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

lishan <lishan24@huawei.com> writes:

> 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);
>          }
>      }
>  }

I didn't check your assertion we always need to cap at IOV_MAX.
Assuming you're right, why not do it in hdev_get_max_segments()?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]