Skip to contentSkip to conversation

don't partially completre REQ_PC commands

PATCH In review Mike Christie 1 participant 1 message Nov 8, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/10 don't partially completre REQ_PC commands

sd does not allow scsi_io_completion to retry commands for
SG_IO requests, and it make senses 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.

drivers/scsi/scsi_lib.c +7 -1
index 10627a5..c06e1e4 100644
@@ -1241,7 +1241,13 @@ static int scsi_issue_flush_fn(request_q
 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)
drivers/scsi/st.c +5 -1
index 002e05f..2d8592d 100644
@@ -4178,7 +4178,11 @@ static void scsi_tape_release(struct kre
 
 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);
 }
 
 /*