scsi: hisi_sas: Block requests before a debugfs snapshot
authorYihang Li <liyihang9@huawei.com>
Tue, 11 Jul 2023 03:14:59 +0000 (11:14 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 23 Jul 2023 19:18:25 +0000 (15:18 -0400)
When FIO and debugfs snapshot occur concurrently, some SATA I/Os are failed
to return to the upper layer due to the setting of HISI_SAS_REJECT_CMD_BIT.
Then the SCSI layer invokes the error processing thread. However,
sas_ata_hard_reset() in EH also fails to be reset due to the setting of
HISI_SAS_REJECT_CMD_BIT. As a result, the device is disabled.

Calling scsi_block_requests() in the front of a debugfs snapshot and wait
command complete before setting HISI_SAS_REJECT_CMD_BIT to avoid SATA I/O
failures.

Signed-off-by: Yihang Li <liyihang9@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1689045300-44318-3-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 2f33e6b4a92fbfac3efc1c43b29cf3630b497905..7aad495d78e58b63f51ccb8590b74d216321b48f 100644 (file)
@@ -3106,21 +3106,25 @@ static const struct hisi_sas_debugfs_reg debugfs_ras_reg = {
 
 static void debugfs_snapshot_prepare_v3_hw(struct hisi_hba *hisi_hba)
 {
-       set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
-
-       hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0);
+       struct Scsi_Host *shost = hisi_hba->shost;
 
+       scsi_block_requests(shost);
        wait_cmds_complete_timeout_v3_hw(hisi_hba, 100, 5000);
 
+       set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
        hisi_sas_sync_cqs(hisi_hba);
+       hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0);
 }
 
 static void debugfs_snapshot_restore_v3_hw(struct hisi_hba *hisi_hba)
 {
+       struct Scsi_Host *shost = hisi_hba->shost;
+
        hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE,
                         (u32)((1ULL << hisi_hba->queue_count) - 1));
 
        clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
+       scsi_unblock_requests(shost);
 }
 
 static void read_iost_itct_cache_v3_hw(struct hisi_hba *hisi_hba,