qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/iscsi: fix deadlock on scsi check condition
@ 2014-02-18 12:08 Peter Lieven
  2014-02-18 12:40 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Lieven @ 2014-02-18 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: kwolf, peter.maydell, stefanha, Peter Lieven, qemu-stable,
	ronniesahlberg, pbonzini

the retry logic was broken because the complete status
of the task structure was not reset. this resulted in
an infinite loop retrying the command over and over.

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/iscsi.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 3c0b728..ded414e 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -145,12 +145,13 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
 
     if (iTask->retries-- > 0 && status == SCSI_STATUS_CHECK_CONDITION
         && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) {
+        error_report("iSCSI CheckCondition: %s", iscsi_get_error(iscsi));
         iTask->do_retry = 1;
         goto out;
     }
 
     if (status != SCSI_STATUS_GOOD) {
-        error_report("iSCSI: Failure. %s", iscsi_get_error(iscsi));
+        error_report("iSCSI Failure: %s", iscsi_get_error(iscsi));
     }
 
 out:
@@ -325,6 +326,7 @@ retry:
     }
 
     if (iTask.do_retry) {
+        iTask.complete = 0;
         goto retry;
     }
 
@@ -399,6 +401,7 @@ retry:
     }
 
     if (iTask.do_retry) {
+        iTask.complete = 0;
         goto retry;
     }
 
@@ -433,6 +436,7 @@ retry:
     }
 
     if (iTask.do_retry) {
+        iTask.complete = 0;
         goto retry;
     }
 
@@ -683,6 +687,7 @@ retry:
             scsi_free_scsi_task(iTask.task);
             iTask.task = NULL;
         }
+        iTask.complete = 0;
         goto retry;
     }
 
@@ -767,6 +772,7 @@ retry:
     }
 
     if (iTask.do_retry) {
+        iTask.complete = 0;
         goto retry;
     }
 
@@ -836,6 +842,7 @@ retry:
     }
 
     if (iTask.do_retry) {
+        iTask.complete = 0;
         goto retry;
     }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] block/iscsi: fix deadlock on scsi check condition
  2014-02-18 12:08 [Qemu-devel] [PATCH] block/iscsi: fix deadlock on scsi check condition Peter Lieven
@ 2014-02-18 12:40 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-02-18 12:40 UTC (permalink / raw)
  To: Peter Lieven, qemu-devel
  Cc: kwolf, peter.maydell, ronniesahlberg, stefanha, qemu-stable

Il 18/02/2014 13:08, Peter Lieven ha scritto:
> the retry logic was broken because the complete status
> of the task structure was not reset. this resulted in
> an infinite loop retrying the command over and over.
>
> CC: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/iscsi.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 3c0b728..ded414e 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -145,12 +145,13 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
>
>      if (iTask->retries-- > 0 && status == SCSI_STATUS_CHECK_CONDITION
>          && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) {
> +        error_report("iSCSI CheckCondition: %s", iscsi_get_error(iscsi));
>          iTask->do_retry = 1;
>          goto out;
>      }
>
>      if (status != SCSI_STATUS_GOOD) {
> -        error_report("iSCSI: Failure. %s", iscsi_get_error(iscsi));
> +        error_report("iSCSI Failure: %s", iscsi_get_error(iscsi));
>      }
>
>  out:
> @@ -325,6 +326,7 @@ retry:
>      }
>
>      if (iTask.do_retry) {
> +        iTask.complete = 0;
>          goto retry;
>      }
>
> @@ -399,6 +401,7 @@ retry:
>      }
>
>      if (iTask.do_retry) {
> +        iTask.complete = 0;
>          goto retry;
>      }
>
> @@ -433,6 +436,7 @@ retry:
>      }
>
>      if (iTask.do_retry) {
> +        iTask.complete = 0;
>          goto retry;
>      }
>
> @@ -683,6 +687,7 @@ retry:
>              scsi_free_scsi_task(iTask.task);
>              iTask.task = NULL;
>          }
> +        iTask.complete = 0;
>          goto retry;
>      }
>
> @@ -767,6 +772,7 @@ retry:
>      }
>
>      if (iTask.do_retry) {
> +        iTask.complete = 0;
>          goto retry;
>      }
>
> @@ -836,6 +842,7 @@ retry:
>      }
>
>      if (iTask.do_retry) {
> +        iTask.complete = 0;
>          goto retry;
>      }
>
>

Applied to scsi-next, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-18 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 12:08 [Qemu-devel] [PATCH] block/iscsi: fix deadlock on scsi check condition Peter Lieven
2014-02-18 12:40 ` Paolo Bonzini

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).