On 22/09/2016 19:34, Eric Blake wrote: > On 09/22/2016 11:52 AM, Paolo Bonzini wrote: >> From: Eric Blake <ebl...@redhat.com> >> >> 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. >
Fixed myself (s/MIN_NON_ZERO/MAX/) and v2 sent. Paolo
signature.asc
Description: OpenPGP digital signature