From patchwork Fri Dec 8 17:16:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121199 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp863300qgn; Fri, 8 Dec 2017 08:31:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMZvDnq07YKayHfIosHvdkCMemu+GBR2EwBpbDe7GBLf30IrsdCSayYCgbrbiZGRVGXbNqL2 X-Received: by 10.101.64.4 with SMTP id f4mr30278170pgp.205.1512750681304; Fri, 08 Dec 2017 08:31:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750681; cv=none; d=google.com; s=arc-20160816; b=u2RyvuCjtQqr14VOfKCIP1A9U93C/koWrVNWLaFL1C4Ka0M8JzoDPyhnOOaaU7zXXe LRAVpFMmEIjrVZGA3LerP3AeW7R/PZxIcrIrcaUnX8MQ+bMD3oQmZvcT7a+GtNRDrhIv ckMcooPS17AyJ5bcQEnvQQQn8fTDjOZpykrdfVZkdhuTlm8P34UCepbX3OC7mCKAf5Cv yR284K33MJVk13xidv078m//9s1iY/tyXQiamaSjY7y9pC7AYZkdKXIKEkIjRfKUC0eF J9ty7HdGSUxGQLx7NnBhNmnI9S8DJPDuo3lkNDs7+6jsCW9mKp9bv44QF9DBJZr0Txyl SpCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=4hFhPmRpIt3Sv47jtGn8L9nVk0/b19P0dGg34iBNxqc=; b=h86+Qgly4YFPFZJYN/uS4ndy6lGZK1Z8dKNMyESpcxlm4y0fT16TCOHOvYERuqLBzx rnhXNdKlC+JY0LrQ01zcNCCKFMZQci9TBNP8MLVCewEntjof6+tJiEynXKFuO2EwmE81 ZqA/RQEXK/7aHtpO5NsdeHhDZum+RXzu/0CC6wIn9en09aD3+mxEI/JU3o1pOBpQtcDP kl8dzFSh/0mwr3jMcVBgZX1snphgFKvMTNC75kNYahdRI4nfaqvMSxsHGWDrQDlmrbcY WSS+0G/XPpculevroIJgjHCxsQz222o/XgsAqmu20S9hnYw/yi/Wd/PvnJf8zK/gIO9x 0H/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si2289947pls.300.2017.12.08.08.31.20; Fri, 08 Dec 2017 08:31:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754652AbdLHQbT (ORCPT + 18 others); Fri, 8 Dec 2017 11:31:19 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36064 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753793AbdLHQbC (ORCPT ); Fri, 8 Dec 2017 11:31:02 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3F5E75AF954B; Sat, 9 Dec 2017 00:30:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:41 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 16/19] scsi: hisi_sas: add internal abort dev in some places Date: Sat, 9 Dec 2017 01:16:47 +0800 Message-ID: <1512753410-50924-17-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan We should do internal abort dev before TMF_ABORT_TASK_SET and TMF_LU_RESET. Because we may only have done internal abort for single IO in the earlier part of SCSI EH process. Even the internal abort to the single IO, we also don't know whether it is successful. Besides, we should release slots of the device in hisi_sas_abort_task_set() if the abort is successful. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 1b9c48c..302da84 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1238,12 +1238,29 @@ static int hisi_sas_abort_task(struct sas_task *task) static int hisi_sas_abort_task_set(struct domain_device *device, u8 *lun) { + struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); + struct device *dev = hisi_hba->dev; struct hisi_sas_tmf_task tmf_task; int rc = TMF_RESP_FUNC_FAILED; + unsigned long flags; + + rc = hisi_sas_internal_task_abort(hisi_hba, device, + HISI_SAS_INT_ABT_DEV, 0); + if (rc < 0) { + dev_err(dev, "abort task set: internal abort rc=%d\n", rc); + return TMF_RESP_FUNC_FAILED; + } + hisi_sas_dereg_device(hisi_hba, device); tmf_task.tmf = TMF_ABORT_TASK_SET; rc = hisi_sas_debug_issue_ssp_tmf(device, lun, &tmf_task); + if (rc == TMF_RESP_FUNC_COMPLETE) { + spin_lock_irqsave(&hisi_hba->lock, flags); + hisi_sas_release_task(hisi_hba, device); + spin_unlock_irqrestore(&hisi_hba->lock, flags); + } + return rc; } @@ -1333,6 +1350,14 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun) } else { struct hisi_sas_tmf_task tmf_task = { .tmf = TMF_LU_RESET }; + rc = hisi_sas_internal_task_abort(hisi_hba, device, + HISI_SAS_INT_ABT_DEV, 0); + if (rc < 0) { + dev_err(dev, "lu_reset: internal abort failed\n"); + goto out; + } + hisi_sas_dereg_device(hisi_hba, device); + rc = hisi_sas_debug_issue_ssp_tmf(device, lun, &tmf_task); if (rc == TMF_RESP_FUNC_COMPLETE) { spin_lock_irqsave(&hisi_hba->lock, flags);