Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1606759
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/23] scsi: hisi_sas: modify hisi_sas_abort_task() for SSP |
| Date | 2017-03-22 18:10 +0100 |
| Message-ID | <tnRVL-5RD-5@gated-at.bofh.it> (permalink) |
| References | <tnRM5-5ys-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Currently an internal abort is executed regardless
of the result of the TMF. We should also check the
result of the internal abort to see if we should
free the slot.
So change the status code STAT_IO_COMPLETE to
TMF_RESP_FUNC_SUCC, meaning the slot has been
successfully aborted.
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 28 ++++++++++++++++++----------
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +-
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 00068d2..36d4e5a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -935,6 +935,7 @@ static int hisi_sas_abort_task(struct sas_task *task)
struct scsi_cmnd *cmnd = task->uldd_task;
struct hisi_sas_slot *slot = task->lldd_task;
u32 tag = slot->idx;
+ int rc2;
int_to_scsilun(cmnd->device->lun, &lun);
tmf_task.tmf = TMF_ABORT_TASK;
@@ -943,21 +944,22 @@ static int hisi_sas_abort_task(struct sas_task *task)
rc = hisi_sas_debug_issue_ssp_tmf(task->dev, lun.scsi_lun,
&tmf_task);
- /* if successful, clear the task and callback forwards.*/
- if (rc == TMF_RESP_FUNC_COMPLETE) {
+ rc2 = hisi_sas_internal_task_abort(hisi_hba, device,
+ HISI_SAS_INT_ABT_CMD, tag);
+ /*
+ * If the TMF finds that the IO is not in the device and also
+ * the internal abort does not succeed, then it is safe to
+ * free the slot.
+ * Note: if the internal abort succeeds then the slot
+ * will have already been completed
+ */
+ if (rc == TMF_RESP_FUNC_COMPLETE && rc2 != TMF_RESP_FUNC_SUCC) {
if (task->lldd_task) {
- struct hisi_sas_slot *slot;
-
- slot = &hisi_hba->slot_info
- [tmf_task.tag_of_task_to_be_managed];
spin_lock_irqsave(&hisi_hba->lock, flags);
- hisi_hba->hw->slot_complete(hisi_hba, slot);
+ hisi_sas_do_release_task(hisi_hba, task, slot);
spin_unlock_irqrestore(&hisi_hba->lock, flags);
}
}
-
- hisi_sas_internal_task_abort(hisi_hba, device,
- HISI_SAS_INT_ABT_CMD, tag);
} else if (task->task_proto & SAS_PROTOCOL_SATA ||
task->task_proto & SAS_PROTOCOL_STP) {
if (task->dev->dev_type == SAS_SATA_DEV) {
@@ -1220,6 +1222,12 @@ static int hisi_sas_query_task(struct sas_task *task)
goto exit;
}
+ if (task->task_status.resp == SAS_TASK_COMPLETE &&
+ task->task_status.stat == TMF_RESP_FUNC_SUCC) {
+ res = TMF_RESP_FUNC_SUCC;
+ goto exit;
+ }
+
/* TMF timed out, return direct. */
if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index a35f881..ad5a7e6 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -1766,7 +1766,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,
goto out;
case STAT_IO_COMPLETE:
/* internal abort command complete */
- ts->stat = TMF_RESP_FUNC_COMPLETE;
+ ts->stat = TMF_RESP_FUNC_SUCC;
goto out;
case STAT_IO_NO_DEVICE:
ts->stat = TMF_RESP_FUNC_COMPLETE;
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements John Garry <john.garry@huawei.com> - 2017-03-22 18:00 +0100 [PATCH 13/23] scsi: hisi_sas: fix some sas_task.task_state_lock locking John Garry <john.garry@huawei.com> - 2017-03-22 18:00 +0100 [PATCH 12/23] scsi: hisi_sas: free slots after hardreset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 09/23] scsi: hisi_sas: modify hisi_sas_abort_task() for SSP John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 14/23] scsi: hisi_sas: remove task free'ing for timeouts John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 06/23] scsi: hisi_sas: error hisi_sas_task_prep() when port down John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 15/23] scsi: hisi_sas: process error codes according to their priority John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 02/23] scsi: hisi_sas: add controller reset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 19/23] scsi: hisi_sas: add hisi_sas_clear_nexus_ha() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 22/23] scsi: hisi_sas: use dev_is_sata to identify SATA or SAS disk John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 17/23] scsi: hisi_sas: handle PHY UP+DOWN simultaneous irq John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 05/23] scsi: hisi_sas: remove hisi_sas_port_deformed() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 16/23] scsi: hisi_sas: some modifications to v2 hw reg init values John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 04/23] scsi: hisi_sas: add softreset function for SATA disk John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 20/23] scsi: hisi_sas: release SMP slot in lldd_abort_task John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 [PATCH 03/23] scsi: hisi_sas: move PHY init to hisi_sas_scan_start() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100 Re: [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-23 16:20 +0100
csiph-web