scsi: hisi_sas: Don't send bcast events from HW during nexus HA reset
authorJohn Garry <john.garry@huawei.com>
Mon, 5 Sep 2022 11:48:49 +0000 (19:48 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Sep 2022 02:28:11 +0000 (22:28 -0400)
Remote devices may go missing from the per-device nexus reset part of the
HA nexus, i.e after the controller reset. This is because libsas may find
the devices to be gone as the phy may be temporarily down when processing
the bcast event generated from the nexus reset. Filter out bcast events
during this time to stop the devices being lost.

Link: https://lore.kernel.org/r/1662378529-101489-6-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c

index 32fa775e7d3741d084a8e22654c3b78d5315d3b4..699b07abb6b0b03e460226959fe5c31a8972e23d 100644 (file)
@@ -1823,12 +1823,14 @@ static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha)
        struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
        HISI_SAS_DECLARE_RST_WORK_ON_STACK(r);
        ASYNC_DOMAIN_EXCLUSIVE(async);
-       int i;
+       int i, ret;
 
        queue_work(hisi_hba->wq, &r.work);
        wait_for_completion(r.completion);
-       if (!r.done)
-               return TMF_RESP_FUNC_FAILED;
+       if (!r.done) {
+               ret = TMF_RESP_FUNC_FAILED;
+               goto out;
+       }
 
        for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) {
                struct hisi_sas_device *sas_dev = &hisi_hba->devices[i];
@@ -1845,7 +1847,9 @@ static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha)
        async_synchronize_full_domain(&async);
        hisi_sas_release_tasks(hisi_hba);
 
-       return TMF_RESP_FUNC_COMPLETE;
+       ret = TMF_RESP_FUNC_COMPLETE;
+out:
+       return ret;
 }
 
 static int hisi_sas_query_task(struct sas_task *task)
@@ -1993,10 +1997,14 @@ void hisi_sas_phy_bcast(struct hisi_sas_phy *phy)
 {
        struct asd_sas_phy *sas_phy = &phy->sas_phy;
        struct hisi_hba *hisi_hba = phy->hisi_hba;
+       struct sas_ha_struct *sha = &hisi_hba->sha;
 
        if (test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags))
                return;
 
+       if (test_bit(SAS_HA_FROZEN, &sha->state))
+               return;
+
        sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD, GFP_ATOMIC);
 }
 EXPORT_SYMBOL_GPL(hisi_sas_phy_bcast);