linux/drivers/scsi/hisi_sas
Xiang Chen cd938e535e scsi: hisi_sas: check host frozen before calling "done" function
When the host is frozen in SCSI EH state, at any point after the LLDD
sets SAS_TASK_STATE_DONE for the sas_task task state, libsas may free
the task; see sas_scsi_find_task().

This puts the LLDD in a difficult position, in that once it sets
SAS_TASK_STATE_DONE for the task state it should not reference the
sas_task again. But the LLDD needs will check the sas_task indirectly in
calling task->task_done()->sas_scsi_task_done() or sas_ata_task_done()
(to check if the host is frozen state actually).

And the LLDD cannot set SAS_TASK_STATE_DONE for the task state after
task->task_done() is called (as the sas_task is free'd at this point).

This situation would seem to be a problem made by libsas.

To work around, check in the LLDD whether the host is in frozen state to
ensure it is ok to call task->task_done() function. If in the frozen
state, we rely on SCSI EH and libsas to free the sas_task directly.

We do not do this for the following IO types:

 - SMP - they are managed in libsas directly, outside SCSI EH
 - Any internally originated IO, for similar reason

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-05-08 01:10:44 -04:00
..
hisi_sas_main.c scsi: hisi_sas: check host frozen before calling "done" function 2018-05-08 01:10:44 -04:00
hisi_sas_v1_hw.c scsi: hisi_sas: Code cleanup and minor bug fixes 2018-03-12 21:55:25 -04:00
hisi_sas_v2_hw.c scsi: hisi_sas: check host frozen before calling "done" function 2018-05-08 01:10:44 -04:00
hisi_sas_v3_hw.c scsi: hisi_sas: check host frozen before calling "done" function 2018-05-08 01:10:44 -04:00
hisi_sas.h scsi: hisi_sas: check host frozen before calling "done" function 2018-05-08 01:10:44 -04:00
Kconfig scsi: hisi_sas: Remove depends on HAS_DMA in case of platform dependency 2018-03-21 18:34:21 -04:00
Makefile scsi: hisi_sas: add skeleton v3 hw driver 2017-06-19 21:31:25 -04:00