Skip to contentSkip to conversation

A theoretical problem in scsi_io_copletion and ACTION*_RETRY

PATCH Boaz Harrosh 1 participant 1 message Jan 4, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

James hi.

There is a theoretical problem with the case of ACTION_RETRY / ACTION_DELAYED_RETRY

Since we are calling blk_end_request(...,good_bytes) regardless. We cannot just retry if good_bytes != 0.

The proper returned sense and/or driver-result and/or "good_bytes == 0" is a concerted effort of target+LLD+ULD. I would like to check for that condition as below. If you are absolutely sure this condition can never happen then I'd like to replace below with a BUG_ON.

BTW:
In the case of "good_bytes == 0" there is no point in calling blk_end_request() at all, (It's not going to do anything), so we might want to separate the code to actually check for retries condition first only if "good_bytes == 0" and do release_buffers plus farther processing if not.

Boaz

---

drivers/scsi/scsi_lib.c +6 -0
index 326b228..4cd6900 100644
@@ -827,6 +827,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 		action = ACTION_FAIL;
 	}
 
+	if (action >= ACTION_RETRY && good_bytes)
+		/* We cannot just retry if above blk_end_request advanced on
+		 * some good_bytes, so ACTION_REPREP
+		 */
+		action = ACTION_REPREP;
+
 do_action:
 	switch (action) {
 	case ACTION_FAIL: