Commit 130b958a authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley

[SCSI] mpt2sas: Reworked scmd->result priority for _scsih_qcmd.

we added support to set the deleted flag prior to device scan,
then clear the flag for responding devices, leaving the deleted flag only
set for missing devices.  The problem is for internal generated host resets,
IO queues are not blocked at scsi mid layer level.  IO will be continued
sent to driver, and driver  will return SCSI_MLQUEUE_HOST_BUSY.  The problem
is the driver checks for the deleted flag before it checks for the
controller being in reset, so there is a window where the driver would be
returning DID_NO_CONNECT for responding devices.  This occurs during  the
time between calling  _scsih_prep_device_scan, and
_scsih_mark_responding_sas_device & _scsih_mark_responding_raid_device.

Fix the queuecommand entry point so ioc->shost_recovery flag sanity check is
given higher presidence then the device "deleted flag" check.
Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent a1172ca2
...@@ -2957,25 +2957,32 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) ...@@ -2957,25 +2957,32 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
scmd->scsi_done = done; scmd->scsi_done = done;
sas_device_priv_data = scmd->device->hostdata; sas_device_priv_data = scmd->device->hostdata;
if (!sas_device_priv_data) { if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scmd->scsi_done(scmd);
return 0; return 0;
} }
sas_target_priv_data = sas_device_priv_data->sas_target; sas_target_priv_data = sas_device_priv_data->sas_target;
if (!sas_target_priv_data || sas_target_priv_data->handle == /* invalid device handle */
MPT2SAS_INVALID_DEVICE_HANDLE || sas_target_priv_data->deleted) { if (sas_target_priv_data->handle == MPT2SAS_INVALID_DEVICE_HANDLE) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scmd->scsi_done(scmd);
return 0; return 0;
} }
/* see if we are busy with task managment stuff */ /* host recovery or link resets sent via IOCTLs */
if (sas_device_priv_data->block || sas_target_priv_data->tm_busy) if (ioc->shost_recovery || ioc->ioc_link_reset_in_progress)
return SCSI_MLQUEUE_DEVICE_BUSY;
else if (ioc->shost_recovery || ioc->ioc_link_reset_in_progress)
return SCSI_MLQUEUE_HOST_BUSY; return SCSI_MLQUEUE_HOST_BUSY;
/* device busy with task managment */
else if (sas_device_priv_data->block || sas_target_priv_data->tm_busy)
return SCSI_MLQUEUE_DEVICE_BUSY;
/* device has been deleted */
else if (sas_target_priv_data->deleted) {
scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd);
return 0;
}
if (scmd->sc_data_direction == DMA_FROM_DEVICE) if (scmd->sc_data_direction == DMA_FROM_DEVICE)
mpi_control = MPI2_SCSIIO_CONTROL_READ; mpi_control = MPI2_SCSIIO_CONTROL_READ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment