From: Peter Lieven <pl@kamp.de>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com,
pbonzini@redhat.com, ronniesahlberg@gmail.com, eblake@redhat.com,
Peter Lieven <pl@kamp.de>
Subject: [Qemu-devel] [PATCH] iscsi: fix assertion in is_sector_request_lun_aligned
Date: Mon, 20 Jun 2016 11:24:40 +0200 [thread overview]
Message-ID: <1466414680-18383-1-git-send-email-pl@kamp.de> (raw)
Commit 94d047a 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: 94d047a35bf663e28f8fef137544d8ea78165add
Signed-off-by: Peter Lieven <pl@kamp.de>
---
block/iscsi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 7e78ade..9bb5ff6 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -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;
}
--
1.9.1
next reply other threads:[~2016-06-20 9:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 9:24 Peter Lieven [this message]
2016-06-20 16:47 ` [Qemu-devel] [PATCH] iscsi: fix assertion in is_sector_request_lun_aligned Eric Blake
2016-06-23 15:50 ` Paolo Bonzini
2016-06-23 16:19 ` Peter Lieven
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=1466414680-18383-1-git-send-email-pl@kamp.de \
--to=pl@kamp.de \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.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).