Commit 03b288cf authored by Kevin Barnett's avatar Kevin Barnett Committed by Martin K. Petersen

scsi: smartpqi: update device offline

- Improve handling of offline devices.
Reviewed-by: default avatarScott Benesh <scott.benesh@microsemi.com>
Signed-off-by: default avatarKevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 376fb880
......@@ -285,6 +285,11 @@ static inline void pqi_ctrl_wait_until_quiesced(struct pqi_ctrl_info *ctrl_info)
usleep_range(1000, 2000);
}
static inline bool pqi_device_offline(struct pqi_scsi_dev *device)
{
return device->device_offline;
}
static inline void pqi_device_reset_start(struct pqi_scsi_dev *device)
{
device->in_reset = true;
......@@ -2399,15 +2404,17 @@ static inline void pqi_take_device_offline(struct scsi_device *sdev, char *path)
struct pqi_ctrl_info *ctrl_info;
struct pqi_scsi_dev *device;
if (scsi_device_online(sdev)) {
scsi_device_set_state(sdev, SDEV_OFFLINE);
ctrl_info = shost_to_hba(sdev->host);
schedule_delayed_work(&ctrl_info->rescan_work, 0);
device = sdev->hostdata;
dev_err(&ctrl_info->pci_dev->dev, "offlined %s scsi %d:%d:%d:%d\n",
path, ctrl_info->scsi_host->host_no, device->bus,
device->target, device->lun);
}
device = sdev->hostdata;
if (device->device_offline)
return;
device->device_offline = true;
scsi_device_set_state(sdev, SDEV_OFFLINE);
ctrl_info = shost_to_hba(sdev->host);
pqi_schedule_rescan_worker(ctrl_info);
dev_err(&ctrl_info->pci_dev->dev, "offlined %s scsi %d:%d:%d:%d\n",
path, ctrl_info->scsi_host->host_no, device->bus,
device->target, device->lun);
}
static void pqi_process_raid_io_error(struct pqi_io_request *io_request)
......@@ -4598,6 +4605,7 @@ static inline void pqi_schedule_bypass_retry(struct pqi_ctrl_info *ctrl_info)
static bool pqi_raid_bypass_retry_needed(struct pqi_io_request *io_request)
{
struct scsi_cmnd *scmd;
struct pqi_scsi_dev *device;
struct pqi_ctrl_info *ctrl_info;
if (!io_request->raid_bypass)
......@@ -4609,6 +4617,10 @@ static bool pqi_raid_bypass_retry_needed(struct pqi_io_request *io_request)
if (host_byte(scmd->result) == DID_NO_CONNECT)
return false;
device = scmd->device->hostdata;
if (pqi_device_offline(device))
return false;
ctrl_info = shost_to_hba(scmd->device->host);
if (pqi_ctrl_offline(ctrl_info))
return false;
......
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