Skip to content

Commit 7ea3e77

Browse files
Yihang Limartinkpetersen
authored andcommitted
scsi: hisi_sas: Rollback some operations if FLR failed
We obtain the semaphore and set HISI_SAS_RESETTING_BIT in hisi_sas_reset_prepare_v3_hw(), block the scsi host and set HISI_SAS_REJECT_CMD_BIT in hisi_sas_controller_reset_prepare(), released them in hisi_sas_controller_reset_done(). However, if the HW reset failure in FLR results in early return, the semaphore and flag bits will not be release. Rollback some operations including clearing flags / releasing semaphore when FLR is failed. Fixes: e5ea480 ("scsi: hisi_sas: Implement handlers of PCIe FLR for v3 hw") Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8dd1029 commit 7ea3e77

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4968,6 +4968,7 @@ static void hisi_sas_reset_done_v3_hw(struct pci_dev *pdev)
49684968
{
49694969
struct sas_ha_struct *sha = pci_get_drvdata(pdev);
49704970
struct hisi_hba *hisi_hba = sha->lldd_ha;
4971+
struct Scsi_Host *shost = hisi_hba->shost;
49714972
struct device *dev = hisi_hba->dev;
49724973
int rc;
49734974

@@ -4976,6 +4977,10 @@ static void hisi_sas_reset_done_v3_hw(struct pci_dev *pdev)
49764977
rc = hw_init_v3_hw(hisi_hba);
49774978
if (rc) {
49784979
dev_err(dev, "FLR: hw init failed rc=%d\n", rc);
4980+
clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
4981+
scsi_unblock_requests(shost);
4982+
clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags);
4983+
up(&hisi_hba->sem);
49794984
return;
49804985
}
49814986

0 commit comments

Comments
 (0)