From 8ecd1bb434632b0dfe8e87337950dea74c4539d0 Mon Sep 17 00:00:00 2001 From: mjacob Date: Tue, 11 Apr 2006 21:36:43 +0000 Subject: If we end up with a CTIO completing with CAM_REQUEUE_REQ, be obliging and just redo the request instead of squawking and dying. --- share/examples/scsi_target/scsi_cmds.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'share/examples') diff --git a/share/examples/scsi_target/scsi_cmds.c b/share/examples/scsi_target/scsi_cmds.c index dd0b069..bd23bed 100644 --- a/share/examples/scsi_target/scsi_cmds.c +++ b/share/examples/scsi_target/scsi_cmds.c @@ -689,8 +689,22 @@ tcmd_rdwr_done(struct ccb_accept_tio *atio, struct ccb_scsiio *ctio, } break; case CTIO_DONE: - if (ctio->ccb_h.status != CAM_REQ_CMP) { - /* XXX */ + switch (ctio->ccb_h.status & CAM_STATUS_MASK) { + case CAM_REQ_CMP: + break; + case CAM_REQUEUE_REQ: + warnx("requeueing request"); + if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_OUT) { + if (aio_write(&c_descr->aiocb) < 0) { + err(1, "aio_write"); /* XXX */ + } + } else { + if (aio_read(&c_descr->aiocb) < 0) { + err(1, "aio_read"); /* XXX */ + } + } + return; + default: errx(1, "CTIO failed, status %#x", ctio->ccb_h.status); } a_descr->init_ack += ctio->dxfer_len; -- cgit v1.1