[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/7] scsi-generic: Handle queue full
From: |
Hannes Reinecke |
Subject: |
[Qemu-devel] [PATCH 1/7] scsi-generic: Handle queue full |
Date: |
Tue, 15 Jun 2010 17:16:04 +0200 |
User-agent: |
Heirloom mailx 12.2 01/07/07 |
The sg driver currently has a hardcoded limit of commands it
can handle simultaneously. When this limit is reached the
driver will return -EDOM. So we need to capture this to
enable proper return values here.
And we shouldn't forget we're using linux-style status codes,
which are shift by one.
Signed-off-by: Hannes Reinecke <address@hidden>
---
hw/scsi-generic.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 6c58742..af76826 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -96,13 +96,19 @@ static void scsi_command_complete(void *opaque, int ret)
s->senselen = r->io_header.sb_len_wr;
if (ret != 0) {
- scsi_req_print(&r->req);
- fprintf(stderr, "%s: ret %d (%s)\n", __FUNCTION__,
- ret, strerror(-ret));
- s->senselen = scsi_build_sense(SENSE_CODE(INVALID_FIELD),
- s->sensebuf, SCSI_SENSE_BUF_SIZE, 0);
- s->driver_status = SG_ERR_DRIVER_SENSE;
- r->req.status = CHECK_CONDITION;
+ if (ret == -EDOM) {
+ /* sg driver uses EDOM to signal queue busy */
+ fprintf(stderr, "%s: sg queue busy\n", __FUNCTION__);
+ r->req.status = QUEUE_FULL << 1;
+ } else {
+ scsi_req_print(&r->req);
+ fprintf(stderr, "%s: ret %d (%s)\n", __FUNCTION__,
+ ret, strerror(-ret));
+ s->senselen = scsi_build_sense(SENSE_CODE(INVALID_FIELD),
+ s->sensebuf, SCSI_SENSE_BUF_SIZE, 0);
+ s->driver_status = SG_ERR_DRIVER_SENSE;
+ r->req.status = CHECK_CONDITION << 1;
+ }
} else {
if (s->driver_status & SG_ERR_DRIVER_TIMEOUT) {
scsi_req_print(&r->req);
--
1.6.6.1
- [Qemu-devel] [PATCH 1/7] scsi-generic: Handle queue full,
Hannes Reinecke <=