scsi-disk: bump SCSIRequest reference count until aio completion runs
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 25 Oct 2011 10:53:34 +0000 (12:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 28 Oct 2011 17:25:52 +0000 (19:25 +0200)
commitc7bae6a75b5b43d560f5b18386447842f9bfec37
treef7ae6100fb19a7d1eb63358bba0afceec403786d
parente88c591d63ed1bc8520f4f276bebd77c22e4ec72
scsi-disk: bump SCSIRequest reference count until aio completion runs

In some cases a request may be canceled before the completion callback
runs.  Keep a reference to the request between starting an AIO operation
and the corresponding scsi_req_cancel or scsi_*_complete.

When a request has to be retried, the request can be dropped because
scsi_dma_restart_bh only looks at requests that are enqueued.  As such,
they always have at least a reference.

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