linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Prevent infinite retries due to DID_RESET return status
@ 2007-01-31 18:54 Michael Reed
  0 siblings, 0 replies; only message in thread
From: Michael Reed @ 2007-01-31 18:54 UTC (permalink / raw)
  To: linux-scsi; +Cc: Christoph Hellwig, Jeremy Higdon

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

Move scsi_release_buffers() call so that buffers are retained until
after a determination is made about whether the command will be
requeued via scsi_queue_insert().  Doing so allows a command which
receives DID_RESET to be immediately queued to the driver using
the original scsi_cmnd, thus retaining it's original jiffies_at_alloc.

Signed-off-by: Michael Reed <mdr@sgi.com>

[-- Attachment #2: DID_RESET_new_1.patch --]
[-- Type: text/x-patch, Size: 1800 bytes --]

Move scsi_release_buffers() call so that buffers are retained until
after a determination is made about whether the command will be
requeued via scsi_queue_insert().  Doing so allows a command which
receives DID_RESET to be immediately queued to the driver using
the original scsi_cmnd, thus retaining it's original jiffies_at_alloc.

Signed-off-by: Michael Reed <mdr@sgi.com>

--- rg61u/drivers/scsi/scsi_lib.c	2007-01-02 23:11:18.000000000 -0600
+++ rg61/drivers/scsi/scsi_lib.c	2007-01-29 15:03:36.602482680 -0600
@@ -65,6 +65,7 @@ static struct scsi_host_sg_pool scsi_sg_
 #undef SP
 
 static void scsi_run_queue(struct request_queue *q);
+static void scsi_release_buffers(struct scsi_cmnd *cmd);
 
 /*
  * Function:	scsi_unprep_request()
@@ -599,6 +600,7 @@ static void scsi_requeue_command(struct 
 	struct request *req = cmd->request;
 	unsigned long flags;
 
+	scsi_release_buffers(cmd);
 	scsi_unprep_request(req);
 	spin_lock_irqsave(q->queue_lock, flags);
 	blk_requeue_request(q, req);
@@ -644,6 +646,7 @@ void scsi_run_host_queues(struct Scsi_Ho
  * Lock status: Assumed that lock is not held upon entry.
  *
  * Returns:     cmd if requeue required, NULL otherwise.
+ * 		If cmd is returned then its buffers have not been released.
  *
  * Notes:       This is called for block device requests in order to
  *              mark some number of sectors as complete.
@@ -686,6 +689,7 @@ static struct scsi_cmnd *scsi_end_reques
 		}
 	}
 
+	scsi_release_buffers(cmd);
 	add_disk_randomness(req->rq_disk);
 
 	spin_lock_irqsave(q->queue_lock, flags);
@@ -826,8 +830,6 @@ void scsi_io_completion(struct scsi_cmnd
 	int sense_valid = 0;
 	int sense_deferred = 0;
 
-	scsi_release_buffers(cmd);
-
 	if (result) {
 		sense_valid = scsi_command_normalize_sense(cmd, &sshdr);
 		if (sense_valid)

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

only message in thread, other threads:[~2007-01-31 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-31 18:54 [PATCH 1/2] Prevent infinite retries due to DID_RESET return status Michael Reed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).