diff options
author | Paolo Bonzini | 2011-08-03 10:49:06 +0200 |
---|---|---|
committer | Anthony Liguori | 2011-08-12 15:27:00 +0200 |
commit | 682a9b213ca3c47c4de5b0518c59c2e550299106 (patch) | |
tree | 3bb4e98871f5fe44a1a3ccb93288548fde22a53b /hw/scsi-bus.c | |
parent | vscsi: always use get_sense (diff) | |
download | qemu-682a9b213ca3c47c4de5b0518c59c2e550299106.tar.gz qemu-682a9b213ca3c47c4de5b0518c59c2e550299106.tar.xz qemu-682a9b213ca3c47c4de5b0518c59c2e550299106.zip |
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.c | 8 |
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) |