diff mbox series

[4/5] smartpqi: fix improve handling of multipath failover

Message ID 20240711194704.982400-5-don.brace@microchip.com
State New
Headers show
Series smartpqi updates | expand

Commit Message

Don Brace July 11, 2024, 7:47 p.m. UTC
From: Kevin Barnett <kevin.barnett@microchip.com>

Improve multipath fail-overs by mapping firmware errors into
I/O errors.

In some rare instances, firmware does not return the proper error code
for I/O errors caused by a multipath path failure.

Map I/O errors returned by firmware into errors that help the multipath
layer to detect the failure of a path.

Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index d8df7440bbe1..0dd901445dcc 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -3247,6 +3247,20 @@  static void pqi_process_raid_io_error(struct pqi_io_request *io_request)
 			sense_data_length);
 	}
 
+	if (pqi_cmd_priv(scmd)->this_residual &&
+		!pqi_is_logical_device(scmd->device->hostdata) &&
+		scsi_status == SAM_STAT_CHECK_CONDITION &&
+		host_byte == DID_OK &&
+		sense_data_length &&
+		scsi_normalize_sense(error_info->data, sense_data_length, &sshdr) &&
+		sshdr.sense_key == ILLEGAL_REQUEST &&
+		sshdr.asc == 0x26 &&
+		sshdr.ascq == 0x0) {
+			host_byte = DID_NO_CONNECT;
+			pqi_take_device_offline(scmd->device, "AIO");
+			scsi_build_sense_buffer(0, scmd->sense_buffer, HARDWARE_ERROR, 0x3e, 0x1);
+	}
+
 	scmd->result = scsi_status;
 	set_host_byte(scmd, host_byte);
 }
@@ -6021,7 +6035,7 @@  static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm
 
 	ctrl_info = shost_to_hba(shost);
 
-	if (pqi_ctrl_offline(ctrl_info) || pqi_device_in_remove(device)) {
+	if (pqi_ctrl_offline(ctrl_info) || pqi_device_offline(device) || pqi_device_in_remove(device)) {
 		set_host_byte(scmd, DID_NO_CONNECT);
 		pqi_scsi_done(scmd);
 		return 0;