scsi: do not call transfer_data after canceling a request
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 25 Oct 2011 10:53:33 +0000 (12:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 28 Oct 2011 17:25:52 +0000 (19:25 +0200)
commitd1d0f9a0a1b49487a33067c1f13d232f49200aaf
tree5c12cbd48d40a4f27a7ea04dd4a2b04ef1485e8a
parentc411a087e9591cac189ef51387f9de45b96a8cfa
scsi: do not call transfer_data after canceling a request

Otherwise, if cancellation is "faked" by the AIO layer and goes
through qemu_aio_flush, the whole request is completed synchronously
during scsi_req_cancel.

Using the enqueued flag would work here, but not in the next patches,
so I'm introducing a new io_canceled flag.  That's because scsi_req_data
is a synchronous callback and the enqueued flag might be reset by the
time it returns.  scsi-disk cannot unref the request until after calling
scsi_req_data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/scsi-bus.c
hw/scsi.h
trace-events