diff mbox

block/iscsi: fix initialization of iTask in iscsi_co_get_block_status

Message ID 1515425247-21730-1-git-send-email-pl@kamp.de (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Lieven Jan. 8, 2018, 3:27 p.m. UTC
in case of unaligned requests or on a target that does not support
block provisioning we leave iTask uninitialized and check iTask.task
for NULL later.

Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block/iscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Blake Jan. 8, 2018, 3:55 p.m. UTC | #1
On 01/08/2018 09:27 AM, Peter Lieven wrote:
> in case of unaligned requests or on a target that does not support
> block provisioning we leave iTask uninitialized and check iTask.task
> for NULL later.
> 
> Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
> Cc: qemu-stable@nongnu.org

qemu-stable isn't necessary right now, since e38bc23 is not part of 2.11
(backporting this patch is necessary only if that commit is first
backported to 2.11.1 or similar).

> Signed-off-by: Peter Lieven <pl@kamp.de>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  block/iscsi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
Peter Lieven Jan. 8, 2018, 3:58 p.m. UTC | #2
Am 08.01.2018 um 16:55 schrieb Eric Blake:
> On 01/08/2018 09:27 AM, Peter Lieven wrote:
>> in case of unaligned requests or on a target that does not support
>> block provisioning we leave iTask uninitialized and check iTask.task
>> for NULL later.
>>
>> Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
>> Cc: qemu-stable@nongnu.org
> qemu-stable isn't necessary right now, since e38bc23 is not part of 2.11
> (backporting this patch is necessary only if that commit is first
> backported to 2.11.1 or similar).

You are right. I thought it was....

Peter
Paolo Bonzini Jan. 10, 2018, 2:26 p.m. UTC | #3
On 08/01/2018 16:27, Peter Lieven wrote:
> in case of unaligned requests or on a target that does not support
> block provisioning we leave iTask uninitialized and check iTask.task
> for NULL later.
> 
> Fixes: e38bc23454ef763deb4405ebdee6a1081aa00bc8
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  block/iscsi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 5c0a9e5..6a1c537 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -658,6 +658,8 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
>      uint64_t lba;
>      int64_t ret;
>  
> +    iscsi_co_init_iscsitask(iscsilun, &iTask);
> +
>      if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
>          ret = -EINVAL;
>          goto out;
> @@ -675,7 +677,6 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
>  
>      lba = sector_qemu2lun(sector_num, iscsilun);
>  
> -    iscsi_co_init_iscsitask(iscsilun, &iTask);
>      qemu_mutex_lock(&iscsilun->mutex);
>  retry:
>      if (iscsi_get_lba_status_task(iscsilun->iscsi, iscsilun->lun,
> 

Queued (removing Cc qemu-stable), thanks.

Paolo
diff mbox

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 5c0a9e5..6a1c537 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -658,6 +658,8 @@  static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
     uint64_t lba;
     int64_t ret;
 
+    iscsi_co_init_iscsitask(iscsilun, &iTask);
+
     if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
         ret = -EINVAL;
         goto out;
@@ -675,7 +677,6 @@  static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs,
 
     lba = sector_qemu2lun(sector_num, iscsilun);
 
-    iscsi_co_init_iscsitask(iscsilun, &iTask);
     qemu_mutex_lock(&iscsilun->mutex);
 retry:
     if (iscsi_get_lba_status_task(iscsilun->iscsi, iscsilun->lun,