From: Paolo Bonzini <pbonzini@redhat.com>
To: Ming Lei <ming.lei@canonical.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>
Cc: Ming Lei <ming.lei@caonical.com>, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: fix big write
Date: Fri, 05 Dec 2014 17:33:38 +0100 [thread overview]
Message-ID: <5481DE62.4000206@redhat.com> (raw)
In-Reply-To: <1417796112-15141-1-git-send-email-ming.lei@canonical.com>
On 05/12/2014 17:15, Ming Lei wrote:
> From: Ming Lei <ming.lei@caonical.com>
>
> QEMU block should have supported to read/write at most
> 0x7fffff * 512 bytes, unfortunately INT_MAX is used to check
> bytes in both bdrv_co_do_writev() and bdrv_check_byte_request(),
> so cause write failure if nr_sectors is equal or more
> than 0x400000.
>
> There are still other INT_MAX usages in block.c, and they might
> need to change to UINT_MAX too in future, but at least
> this patch's change can make SCSI WRITE SAME 16 workable.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Ming Lei <ming.lei@caonical.com>
Alternatively, I'd accept a SCSI patch setting max_ws_blocks and friends
to 2GB - 1 block.
Paolo
> ---
> block.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block.c b/block.c
> index a612594..ddc18c2 100644
> --- a/block.c
> +++ b/block.c
> @@ -2607,7 +2607,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
> {
> int64_t len;
>
> - if (size > INT_MAX) {
> + if (size > UINT_MAX) {
> return -EIO;
> }
>
> @@ -3420,7 +3420,7 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
> int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,
> BdrvRequestFlags flags)
> {
> - if (nb_sectors < 0 || nb_sectors > (INT_MAX >> BDRV_SECTOR_BITS)) {
> + if (nb_sectors < 0 || nb_sectors > (UINT_MAX >> BDRV_SECTOR_BITS)) {
> return -EINVAL;
> }
>
>
next prev parent reply other threads:[~2014-12-05 16:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 16:15 [Qemu-devel] [PATCH] block: fix big write Ming Lei
2014-12-05 16:33 ` Paolo Bonzini [this message]
2014-12-08 7:19 ` Ming Lei
2014-12-09 17:45 ` Paolo Bonzini
2014-12-10 1:41 ` Ming Lei
2014-12-10 9:56 ` Paolo Bonzini
2014-12-10 12:23 ` Ming Lei
2014-12-10 12:55 ` Paolo Bonzini
2014-12-10 14:35 ` Ming Lei
2014-12-10 15:02 ` Paolo Bonzini
2014-12-10 15:47 ` Ming Lei
2014-12-10 16:44 ` Paolo Bonzini
2014-12-05 17:03 ` Max Reitz
2014-12-05 17:04 ` Paolo Bonzini
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=5481DE62.4000206@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=ming.lei@canonical.com \
--cc=ming.lei@caonical.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.com \
/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).