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

[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 <>
Signed-off-by: default avatarJames Bottomley <>
parent a1172ca2
......@@ -2957,25 +2957,32 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
scmd->scsi_done = done;
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;
return 0;
sas_target_priv_data = sas_device_priv_data->sas_target;
if (!sas_target_priv_data || sas_target_priv_data->handle ==
MPT2SAS_INVALID_DEVICE_HANDLE || sas_target_priv_data->deleted) {
/* invalid device handle */
if (sas_target_priv_data->handle == MPT2SAS_INVALID_DEVICE_HANDLE) {
scmd->result = DID_NO_CONNECT << 16;
return 0;
/* see if we are busy with task managment stuff */
if (sas_device_priv_data->block || sas_target_priv_data->tm_busy)
else if (ioc->shost_recovery || ioc->ioc_link_reset_in_progress)
/* host recovery or link resets sent via IOCTLs */
if (ioc->shost_recovery || ioc->ioc_link_reset_in_progress)
/* device busy with task managment */
else if (sas_device_priv_data->block || sas_target_priv_data->tm_busy)
/* device has been deleted */
else if (sas_target_priv_data->deleted) {
scmd->result = DID_NO_CONNECT << 16;
return 0;
if (scmd->sc_data_direction == DMA_FROM_DEVICE)
Supports Markdown
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