Skip to content

Commit 21c7e97

Browse files
Luojiaxing1991martinkpetersen
authored andcommitted
scsi: hisi_sas: Disable SATA disk phy for severe I_T nexus reset failure
If the softreset fails in the I_T reset, libsas will then continue to issue a controller reset to try to recover. However a faulty disk may cause the softreset to fail, and resetting the controller will not help this scenario. Indeed, we will just continue the cycle of error handle handling to try to recover. So if the softreset fails upon certain conditions, just disable the phy associated with the disk. The user needs to handle this problem. Link: https://lore.kernel.org/r/1634041588-74824-5-git-send-email-john.garry@huawei.com Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 00aeaf3 commit 21c7e97

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,14 +1870,33 @@ static int hisi_sas_I_T_nexus_reset(struct domain_device *device)
18701870
}
18711871
hisi_sas_dereg_device(hisi_hba, device);
18721872

1873-
if (dev_is_sata(device)) {
1873+
rc = hisi_sas_debug_I_T_nexus_reset(device);
1874+
if (rc == TMF_RESP_FUNC_COMPLETE && dev_is_sata(device)) {
1875+
struct sas_phy *local_phy;
1876+
18741877
rc = hisi_sas_softreset_ata_disk(device);
1875-
if (rc == TMF_RESP_FUNC_FAILED)
1876-
return TMF_RESP_FUNC_FAILED;
1878+
switch (rc) {
1879+
case -ECOMM:
1880+
rc = -ENODEV;
1881+
break;
1882+
case TMF_RESP_FUNC_FAILED:
1883+
case -EMSGSIZE:
1884+
case -EIO:
1885+
local_phy = sas_get_local_phy(device);
1886+
rc = sas_phy_enable(local_phy, 0);
1887+
if (!rc) {
1888+
local_phy->enabled = 0;
1889+
dev_err(dev, "Disabled local phy of ATA disk %016llx due to softreset fail (%d)\n",
1890+
SAS_ADDR(device->sas_addr), rc);
1891+
rc = -ENODEV;
1892+
}
1893+
sas_put_local_phy(local_phy);
1894+
break;
1895+
default:
1896+
break;
1897+
}
18771898
}
18781899

1879-
rc = hisi_sas_debug_I_T_nexus_reset(device);
1880-
18811900
if ((rc == TMF_RESP_FUNC_COMPLETE) || (rc == -ENODEV))
18821901
hisi_sas_release_task(hisi_hba, device);
18831902

0 commit comments

Comments
 (0)