A theoretical problem in scsi_io_copletion and ACTION*_RETRY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 326b228..4cd6900 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -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:
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux