mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 04:13:39 +08:00
iscsi: fix assertion in is_sector_request_lun_aligned
Commit94d047a
added an assertion the the request alignment check. This introduced 2 issues: a) A off-by-one error since a request of BDRV_REQUEST_MAX_SECTORS is actually allowed. b) The bdrv_get_block_status call in the read path to check the allocation status requests up to INT_MAX sectors which triggers the assertion. Fixes:94d047a35b
Signed-off-by: Peter Lieven <pl@kamp.de> Message-Id: <1466414680-18383-1-git-send-email-pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8642c1b81e
commit
0ead93120e
@ -417,7 +417,7 @@ static bool is_byte_request_lun_aligned(int64_t offset, int count,
|
||||
static bool is_sector_request_lun_aligned(int64_t sector_num, int nb_sectors,
|
||||
IscsiLun *iscsilun)
|
||||
{
|
||||
assert(nb_sectors < BDRV_REQUEST_MAX_SECTORS);
|
||||
assert(nb_sectors <= BDRV_REQUEST_MAX_SECTORS);
|
||||
return is_byte_request_lun_aligned(sector_num << BDRV_SECTOR_BITS,
|
||||
nb_sectors << BDRV_SECTOR_BITS,
|
||||
iscsilun);
|
||||
@ -661,7 +661,8 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
|
||||
int64_t ret;
|
||||
int pnum;
|
||||
BlockDriverState *file;
|
||||
ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file);
|
||||
ret = iscsi_co_get_block_status(bs, sector_num,
|
||||
BDRV_REQUEST_MAX_SECTORS, &pnum, &file);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user