Patchwork [2/4] scsi-disk: do not complete requests twice

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 7, 2011, 8:59 a.m.
Message ID <1317977954-21366-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/118279/
State New
Headers show

Comments

Paolo Bonzini - Oct. 7, 2011, 8:59 a.m.
When scsi_handle_rw_error reports a CHECK CONDITION code, the
owner should not call scsi_req_complete.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi-disk.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 4757a02..6497655 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -230,6 +230,7 @@  static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)
 
         bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
         vm_stop(RSTATE_IO_ERROR);
+        return 1;
     } else {
         switch (error) {
         case ENOMEDIUM:
@@ -246,8 +247,8 @@  static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)
             break;
         }
         bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
+        return 0;
     }
-    return 1;
 }
 
 static void scsi_write_complete(void * opaque, int ret)