Skip to contentSkip to conversation

Make scsi_remove_host() wait until error handling finished

PATCH Jack Wang 2 participants 2 messages Jun 24, 2013 SCSI

lore
Share & tools
lore

Jack Wang

author
#0 lore raw
Quoted 11 lines
(quoted diff) +2 -1
@@ -646,14 +703,20 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
 static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
 {
        int rtn;
-       struct scsi_host_template *hostt = scmd->device->host->hostt;
+       struct Scsi_Host *host = scmd->device->host;
+       struct scsi_host_template *hostt = host->hostt;
 
        if (!hostt->eh_device_reset_handler)
                return FAILED;
 

Review static int scsi_try_target_reset(struct scsi_cmnd *scmd) · line 721

Quoted 10 lines
(quoted diff) +5 -0
+       if (scsi_begin_eh(host))
+               return FAST_IO_FAIL;
+
        rtn = hostt->eh_device_reset_handler(scmd);
        if (rtn == SUCCESS)
                __scsi_report_device_reset(scmd->device, NULL);
+       scsi_end_eh(host);
+
        return rtn;
 }

As the new eh from Hannes haven't make it into mainline, maybe we still need also check scsi_try_to_abort_cmd?

Jack

#1 lore raw
Quoted 11 lines · Jack Wang
Quoted 11 lines
(quoted diff) +2 -1
@@ -646,14 +703,20 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
  static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
  {
         int rtn;
-       struct scsi_host_template *hostt = scmd->device->host->hostt;
+       struct Scsi_Host *host = scmd->device->host;
+       struct scsi_host_template *hostt = host->hostt;
 
         if (!hostt->eh_device_reset_handler)
                 return FAILED;
 
Quoted 13 lines

Review static int scsi_try_target_reset(struct scsi_cmnd *scmd) · line 721

Quoted 10 lines
(quoted diff) +5 -0
+       if (scsi_begin_eh(host))
+               return FAST_IO_FAIL;
+
         rtn = hostt->eh_device_reset_handler(scmd);
         if (rtn == SUCCESS)
                 __scsi_report_device_reset(scmd->device, NULL);
+       scsi_end_eh(host);
+
         return rtn;
  }

As the new eh from Hannes haven't make it into mainline, maybe we still need also check scsi_try_to_abort_cmd?

I don't think such checks are necessary in scsi_try_to_abort_cmd(). scsi_remove_host() already waits until outstanding SCSI commands have finished. scsi_try_to_abort_cmd() only gets invoked if there are still one or more unfinished commands so scsi_try_to_abort_cmd() won't be invoked anymore after scsi_remove_host() has finished.

Bart.