07_scsi_requeue_consolidate_setup_cmd_retry_calls_in_eh.patch

        scsi_setup_cmd_retry() is needed because scsi eh may alter
        scsi_cmnd to issue eh commands.  Consolidate calls to
        scsi_setup_cmd_retry() to one place in scsi_eh_flush_done_q().
        This change makes scsi_retry_command() more symmetrical with
        scsi_finish_command().

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>

 scsi.c       |    5 -----
 scsi_error.c |   31 +++++++------------------------
 2 files changed, 7 insertions(+), 29 deletions(-)

Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c  2005-04-12 21:50:12.000000000 
+0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c       2005-04-12 21:50:12.000000000 
+0900
@@ -677,11 +677,6 @@ void scsi_retry_command(struct scsi_cmnd
        scsi_device_unbusy(cmd->device);
 
        /*
-        * Restore the SCSI command state.
-        */
-       scsi_setup_cmd_retry(cmd);
-
-       /*
         * Zero the sense information and result code from the last
         * time we tried this command.
         */
Index: scsi-reqfn-export/drivers/scsi/scsi_error.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_error.c    2005-04-12 
21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_error.c 2005-04-12 21:50:12.000000000 
+0900
@@ -586,11 +586,6 @@ static int scsi_request_sense(struct scs
 
        kfree(scsi_result);
 
-       /*
-        * when we eventually call scsi_finish, we really wish to complete
-        * the original request, so let's restore the original data. (db)
-        */
-       scsi_setup_cmd_retry(scmd);
        scmd->result = saved_result;
        return rtn;
 }
@@ -612,14 +607,7 @@ static void scsi_eh_finish_cmd(struct sc
 {
        scmd->device->host->host_failed--;
        scmd->state = SCSI_STATE_BHQUEUE;
-
        scsi_eh_eflags_clr_all(scmd);
-
-       /*
-        * set this back so that the upper level can correctly free up
-        * things.
-        */
-       scsi_setup_cmd_retry(scmd);
        list_move_tail(&scmd->eh_entry, done_q);
 }
 
@@ -756,12 +744,6 @@ retry_tur:
        rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT);
 
        /*
-        * when we eventually call scsi_finish, we really wish to complete
-        * the original request, so let's restore the original data. (db)
-        */
-       scsi_setup_cmd_retry(scmd);
-
-       /*
         * hey, we are done.  let's look to see what happened.
         */
        SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n",
@@ -884,12 +866,6 @@ static int scsi_eh_try_stu(struct scsi_c
        rtn = scsi_send_eh_cmnd(scmd, START_UNIT_TIMEOUT);
 
        /*
-        * when we eventually call scsi_finish, we really wish to complete
-        * the original request, so let's restore the original data. (db)
-        */
-       scsi_setup_cmd_retry(scmd);
-
-       /*
         * hey, we are done.  let's look to see what happened.
         */
        SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n",
@@ -1515,6 +1491,13 @@ static void scsi_eh_flush_done_q(struct 
        list_for_each_safe(lh, lh_sf, done_q) {
                scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
                list_del_init(lh);
+
+               /*
+                * Restore the SCSI command state such that we retry
+                * or finish the original command.
+                */
+               scsi_setup_cmd_retry(scmd);
+
                if (scsi_device_online(scmd->device) &&
                    !blk_noretry_request(scmd->request) &&
                    (++scmd->retries < scmd->allowed)) {

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to