aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-bus.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-08-03 10:49:06 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-12 08:27:00 -0500
commit682a9b213ca3c47c4de5b0518c59c2e550299106 (patch)
tree3bb4e98871f5fe44a1a3ccb93288548fde22a53b /hw/scsi-bus.c
parent05751d3ff7d3c12d1468002886a71453491481ce (diff)
scsi: pass status when completing
A small improvement in the SCSI request API. Pass the status at the time the request is completed, so that we can assert that no request is completed twice. This would have detected the problem fixed in the previous patch. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r--hw/scsi-bus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index d1ef55985d..9637ccb52e 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -682,9 +682,10 @@ void scsi_req_print(SCSIRequest *req)
}
}
-void scsi_req_complete(SCSIRequest *req)
+void scsi_req_complete(SCSIRequest *req, int status)
{
- assert(req->status != -1);
+ assert(req->status == -1);
+ req->status = status;
scsi_req_ref(req);
scsi_req_dequeue(req);
req->bus->ops->complete(req, req->status);
@@ -706,11 +707,10 @@ void scsi_req_cancel(SCSIRequest *req)
void scsi_req_abort(SCSIRequest *req, int status)
{
- req->status = status;
if (req->dev && req->dev->info->cancel_io) {
req->dev->info->cancel_io(req);
}
- scsi_req_complete(req);
+ scsi_req_complete(req, status);
}
void scsi_device_purge_requests(SCSIDevice *sdev)