scsi-disk: no need to call scsi_req_data on a short read
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 3 Aug 2011 08:49:04 +0000 (10:49 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 12 Aug 2011 13:27:00 +0000 (08:27 -0500)
In fact, if the HBA's transfer_data callback goes on with scsi_req_continue
the request will be completed successfully instead of showing a failure.
It can even cause a segmentation fault.

An easy way to trigger it is "eject -f cd" during installation (during media
test if the installer does something like that).

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/scsi-disk.c

index fa198f928cdeb2ca9f2158a250300f8bf5234fc5..e38d9f0b757fdaee63425fea50cbf2149c459872 100644 (file)
@@ -214,9 +214,6 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)
         bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
         vm_stop(VMSTOP_DISKFULL);
     } else {
-        if (type == SCSI_REQ_STATUS_RETRY_READ) {
-            scsi_req_data(&r->req, 0);
-        }
         switch (error) {
         case ENOMEM:
             scsi_command_complete(r, CHECK_CONDITION,