On Tue, 2017-04-25 at 14:46 -0500, Don Brace wrote: > @@ -4655,23 +4860,46 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, > static int pqi_eh_device_reset_handler(struct scsi_cmnd *scmd) > { > int rc; > + struct Scsi_Host *shost; > struct pqi_ctrl_info *ctrl_info; > struct pqi_scsi_dev *device; > > - ctrl_info = shost_to_hba(scmd->device->host); > + shost = scmd->device->host; > + ctrl_info = shost_to_hba(shost); > device = scmd->device->hostdata; > > dev_err(&ctrl_info->pci_dev->dev, > "resetting scsi %d:%d:%d:%d\n", > - ctrl_info->scsi_host->host_no, > - device->bus, device->target, device->lun); > + shost->host_no, device->bus, device->target, device->lun); > > - rc = pqi_device_reset(ctrl_info, device); > + pqi_check_ctrl_health(ctrl_info); > + if (pqi_ctrl_offline(ctrl_info)) { > + rc = FAILED; > + goto out; > + } > > + mutex_lock(&ctrl_info->lun_reset_mutex); > + > + pqi_ctrl_block_requests(ctrl_info); > + pqi_ctrl_wait_until_quiesced(ctrl_info); > + pqi_fail_io_queued_for_device(ctrl_info, device); > + rc = pqi_wait_until_inbound_queues_empty(ctrl_info); > + pqi_device_reset_start(device); > + pqi_ctrl_unblock_requests(ctrl_info); > + > + if (rc) > + rc = FAILED; > + else > + rc = pqi_device_reset(ctrl_info, device); > + > + pqi_device_reset_done(device); > + > + mutex_unlock(&ctrl_info->lun_reset_mutex); > + > +out: > dev_err(&ctrl_info->pci_dev->dev, > "reset of scsi %d:%d:%d:%d: %s\n", > - ctrl_info->scsi_host->host_no, > - device->bus, device->target, device->lun, > + shost->host_no, device->bus, device->target, device->lun, > rc == SUCCESS ? "SUCCESS" : "FAILED"); > > return rc; Please use scsi_target_block() / scsi_target_unblock() instead of reimplementing these functions. Thanks, Bart.