All of lore.kernel.org
 help / color / mirror / Atom feed
* A theoretical problem in scsi_io_copletion and ACTION*_RETRY
@ 2010-01-04 12:43 Boaz Harrosh
  0 siblings, 0 replies; only message in thread
From: Boaz Harrosh @ 2010-01-04 12:43 UTC (permalink / raw)
  To: James Bottomley, linux-scsi

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:

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-04 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 12:43 A theoretical problem in scsi_io_copletion and ACTION*_RETRY Boaz Harrosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.