Prevent infinite retries due to DID_RESET return status
PATCH 1/2 Prevent infinite retries due to DID_RESET return status
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 <[email protected]>
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 <[email protected]>
drivers/scsi/scsi_lib.c +4 -2
@@ -65,6 +65,7 @@ static struct scsi_host_sg_pool scsi_sg_#undef SPstatic 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(structstruct 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_cmndint sense_valid =0 ;int sense_deferred =0 ; -scsi_release_buffers (cmd); -if (result) { sense_valid =scsi_command_normalize_sense (cmd, &sshdr);if (sense_valid)