scsi-disk: handle io_canceled uniformly and correctly
commit0c92e0e6b64c9061f7365a2712b9055ea35b52f9
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 25 Feb 2013 11:16:05 +0000 (25 12:16 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Mar 2013 16:51:51 +0000 (5 17:51 +0100)
treedda38ad4bf2a31e53f294e832bdbbcebc0a06e7d
parentd0242eadc5bba4f3abe34bc5d536bbfb81aa9891
scsi-disk: handle io_canceled uniformly and correctly

Always check it immediately after calling bdrv_acct_done, and
always do a "goto done" in case the "done" label has to free
some memory---as is the case for scsi_unmap_complete in the
previous patch.

This patch could fix problems that happen when a request is
split into multiple parts, and one of them is canceled.  Then
the next part is fired, but the HBA's cancellation callbacks have
fired already.  Whether this happens or not, depends on how the
block/ driver implements AIO cancellation.  It it does a simple
bdrv_drain_all() or similar, then it will not have a problem.
If it only cancels the given AIOCB, this scenario could happen.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi-disk.c