Skip to content

Commit daff37f

Browse files
Xingui Yangmartinkpetersen
authored andcommitted
scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
The hw port ID of phy may change when inserting disks in batches, causing the port ID in hisi_sas_port and itct to be inconsistent with the hardware, resulting in I/O errors. The solution is to set the device state to gone to intercept I/O sent to the device, and then execute linkreset to discard and find the disk to re-update its information. Signed-off-by: Xingui Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8aa580c commit daff37f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,28 @@ static void hisi_sas_phyup_work_common(struct work_struct *work,
935935
container_of(work, typeof(*phy), works[event]);
936936
struct hisi_hba *hisi_hba = phy->hisi_hba;
937937
struct asd_sas_phy *sas_phy = &phy->sas_phy;
938+
struct asd_sas_port *sas_port = sas_phy->port;
939+
struct hisi_sas_port *port = phy->port;
940+
struct device *dev = hisi_hba->dev;
941+
struct domain_device *port_dev;
938942
int phy_no = sas_phy->id;
939943

944+
if (!test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags) &&
945+
sas_port && port && (port->id != phy->port_id)) {
946+
dev_info(dev, "phy%d's hw port id changed from %d to %llu\n",
947+
phy_no, port->id, phy->port_id);
948+
port_dev = sas_port->port_dev;
949+
if (port_dev && !dev_is_expander(port_dev->dev_type)) {
950+
/*
951+
* Set the device state to gone to block
952+
* sending IO to the device.
953+
*/
954+
set_bit(SAS_DEV_GONE, &port_dev->state);
955+
hisi_sas_notify_phy_event(phy, HISI_PHYE_LINK_RESET);
956+
return;
957+
}
958+
}
959+
940960
phy->wait_phyup_cnt = 0;
941961
if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP)
942962
hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no);

0 commit comments

Comments
 (0)