From 710b333ac2d786c6618996fe35e47d25bae12bfd Mon Sep 17 00:00:00 2001 From: Xiaofei Tan Date: Thu, 19 Apr 2018 18:12:08 +0800 Subject: [PATCH] scsi: hisi_sas: release remain resources when dev gone We should ensure that all resources of device are freed before gone. In fact, upper layer can ensure that all upper layer IOs are finished when get dev gone. But for some LLDD internal failed IOs, LLDD resources may not freed. So, this patch release remain LLDD resources before dev gone if there are. Signed-off-by: Xiaofei Tan --- drivers/scsi/hisi_sas/hisi_sas_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index bc06079d34ab..ab721381fecd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -866,6 +866,10 @@ static void hisi_sas_dev_gone(struct domain_device *device) HISI_SAS_INT_ABT_DEV, 0); hisi_sas_dereg_device(hisi_hba, device); + if (!list_empty(&sas_dev->list)) { + hisi_sas_release_task(hisi_hba, device); + dev_info(dev, "dev gone: release remain resources anyway.\n"); + } down(&hisi_hba->sem); hisi_hba->hw->clear_itct(hisi_hba, sas_dev); -- GitLab