[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PULL 3/6] iscsi: Fix divide-by-zero regression on raw
From: |
Eric Blake |
Subject: |
Re: [Qemu-stable] [PULL 3/6] iscsi: Fix divide-by-zero regression on raw SG devices |
Date: |
Thu, 22 Sep 2016 12:34:07 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 09/22/2016 11:52 AM, Paolo Bonzini wrote:
> From: Eric Blake <address@hidden>
>
> When qemu uses iscsi devices in sg mode, iscsilun->block_size
> is left at 0. Prior to commits cf081fca and similar, when
> block limits were tracked in sectors, this did not matter:
> various block limits were just left at 0. But when we started
> scaling by block size, this caused SIGFPE.
>
> +++ b/block/iscsi.c
> @@ -1813,19 +1813,23 @@ static void iscsi_refresh_limits(BlockDriverState
> *bs, Error **errp)
>
> IscsiLun *iscsilun = bs->opaque;
> uint64_t max_xfer_len = iscsilun->use_16_for_rw ? 0xffffffff : 0xffff;
> + unsigned int block_size = MIN_NON_ZERO(BDRV_SECTOR_SIZE,
> + iscsilun->block_size);
>
> - bs->bl.request_alignment = iscsilun->block_size;
> + assert(iscsilun->block_size >= BDRV_SECTOR_SIZE || bs->sg);
> +
> + bs->bl.request_alignment = block_size;
Ouch. If iscsilun->block_size is 4k, this ends up changing
bs->bl.request_alignment to 512, which is wrong. :(
If I'm in time, let's drop this from the pull request, and I'll send a
followup patch.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature