From: Mike Christie Date: Fri, 11 Nov 2005 11:31:40 +0000 (-0600) Subject: [SCSI] complete the whole command when it is REQ_BLOCK_PC X-Git-Tag: v2.6.16-rc1~474^2~22^2~8^2~16 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d95716d6a1308c465d8c17ed1a217628936bb0c;p=linux-2.6 [SCSI] complete the whole command when it is REQ_BLOCK_PC sd does not allow scsi_io_completion to retry commands for SG_IO requests, and it make sense that it should not happen for st SG_IO commands too. If for st we hit the bottom of scsi_io_completion we will probably screw things up pretty bad. This patch returns to the block layer that the whole command completed and relies on the caller to check the request errors field. For initialization commands like in sd, this adds the previous behavior where scsi_io_completion did not process the error. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 365843a156..3e136bfe42 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1247,7 +1247,13 @@ static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, static void scsi_generic_done(struct scsi_cmnd *cmd) { BUG_ON(!blk_pc_request(cmd->request)); - scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); + /* + * This will complete the whole command with uptodate=1 so + * as far as the block layer is concerned the command completed + * successfully. Since this is a REQ_BLOCK_PC command the + * caller should check the request's errors value + */ + scsi_io_completion(cmd, cmd->bufflen, 0); } static int scsi_prep_fn(struct request_queue *q, struct request *req) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 6d9078705c..053444b027 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -4185,7 +4185,11 @@ static void scsi_tape_release(struct kref *kref) static void st_intr(struct scsi_cmnd *SCpnt) { - scsi_io_completion(SCpnt, (SCpnt->result ? 0: SCpnt->bufflen), 1); + /* + * The caller should be checking the request's errors + * value. + */ + scsi_io_completion(SCpnt, SCpnt->bufflen, 0); } /*