ISCSI: Readcapacity retruned the lba of the last sector. Total number of sectors is one more.

Submitted by ronniesahlberg@gmail.com on May 4, 2012, 8:15 a.m.

Details

Message ID 1336119344-30445-2-git-send-email-ronniesahlberg@gmail.com
State New
Headers show

Commit Message

ronniesahlberg@gmail.com May 4, 2012, 8:15 a.m.
Thanks to Paolo for spotting.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
---
 block/iscsi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Paolo Bonzini May 4, 2012, 8:37 a.m.
Il 04/05/2012 10:15, Ronnie Sahlberg ha scritto:
>      itask->iscsilun->num_blocks = rc16->returned_lba;
> -    itask->bs->total_sectors    = rc16->returned_lba *
> +    itask->bs->total_sectors    = (rc16->returned_lba + 1) *

What about itask->iscsilun->num_blocks? :)  No need to resend, I fixed
this locally.

Patch hide | download patch | download mbox

diff --git a/block/iscsi.c b/block/iscsi.c
index eb49093..7c1970d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -482,7 +482,7 @@  iscsi_readcapacity16_cb(struct iscsi_context *iscsi, int status,
 
     itask->iscsilun->block_size = rc16->block_length;
     itask->iscsilun->num_blocks = rc16->returned_lba;
-    itask->bs->total_sectors    = rc16->returned_lba *
+    itask->bs->total_sectors    = (rc16->returned_lba + 1) *
                                rc16->block_length / BDRV_SECTOR_SIZE ;
 
     itask->status   = 0;