[for-next,4/5] scsi: hisi_sas: Fix SATA devices missing issue during I_T nexus reset
Message ID | 20221118083714.4034612-5-zhanjie9@hisilicon.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp70065wrr; Fri, 18 Nov 2022 00:46:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ABUD+qkXLSfgYv2xgs4vuTNBMLRJwpMytlhB4A+vHGJVVcJ/gpdsIFsYe/+2soSrxkVD1 X-Received: by 2002:a17:902:7885:b0:178:b4b7:d74d with SMTP id q5-20020a170902788500b00178b4b7d74dmr6566169pll.83.1668761193036; Fri, 18 Nov 2022 00:46:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668761193; cv=none; d=google.com; s=arc-20160816; b=iYjD6USpG/pwZ/3pBSOPgZKqes7bbZ+CtmvPboG5a3OeyN36ucWPQx+dujAtmDG0du tYKCuAIaY0ZghMjsfHButham5o4mj3sEW578JFB4PHY+UQ8G3gtPnwlhp++HIqOtGYB9 qbnENTFr7NvpXZrG6AtqiALn0YLlem6Sko8kZgT6iU3hY5UBzZXcQntC1SAS7SkOeemt adkSCrXqOhNNXW6YDqfilIJ+Blw66geg9EyDqcAij6JFH9ndkaIdIRdw8uaBmA5G+cI2 LJrSFPjIBfOfpL/Y/a0Jst00B6qV6LqR8H/ObzkebbXbT/Mi2Nw74td/B+dCOAZi11l/ lDXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=l4cOt7uVEoCxt9MOn/z+t10e04FFk9KDJes4YOAoxsU=; b=bxbJNbPA9yiNSYSVi1we+/FVDMvw0uMhlfHH+Vti60tsgJ/JQL/4PJpYSSGq0wXJfk riJv0zvwttqfW8Rn9HBlI+3Db0vWeeFgfM+af5XUTGTUOo9LkDOcUsB6aR0/1QbAlwpy wOK54C+XwMHyVdU2jukYOQc/tYPcpSAnQT13nxKBgSLSzwULnJq6L0cTnKRtoO2xuWl/ TiGbENfW3F01sbrBZGm4HqXmt+s656RbvW5KGBdHqY88MGiCoG1IhhiqeZZT6cMN4Dfz w4nxSV+jN2dhVhmo8Z7dvo2tsX6/bCYDWdg4p+XhBpmBz2mUgcHMZh32x9NQoi8+5oxF hlWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a056a00115100b00554f1b32131si3171023pfm.362.2022.11.18.00.46.20; Fri, 18 Nov 2022 00:46:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241438AbiKRIif (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Fri, 18 Nov 2022 03:38:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235225AbiKRIi2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 18 Nov 2022 03:38:28 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294EF643D; Fri, 18 Nov 2022 00:38:27 -0800 (PST) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4ND97b0ZZMzqSYk; Fri, 18 Nov 2022 16:34:35 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 18 Nov 2022 16:38:19 +0800 Received: from localhost.localdomain (10.67.165.2) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 18 Nov 2022 16:38:18 +0800 From: Jie Zhan <zhanjie9@hisilicon.com> To: <jejb@linux.ibm.com>, <martin.petersen@oracle.com> CC: <chenxiang66@hisilicon.com>, <john.g.garry@oracle.com>, <damien.lemoal@opensource.wdc.com>, <yanaijie@huawei.com>, <johannes.thumshirn@wdc.com>, <duoming@zju.edu.cn>, <zhanjie9@hisilicon.com>, <liyihang9@huawei.com>, <yangxingui@huawei.com>, <prime.zeng@hisilicon.com>, <linuxarm@huawei.com>, <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH for-next 4/5] scsi: hisi_sas: Fix SATA devices missing issue during I_T nexus reset Date: Fri, 18 Nov 2022 16:37:13 +0800 Message-ID: <20221118083714.4034612-5-zhanjie9@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20221118083714.4034612-1-zhanjie9@hisilicon.com> References: <20221118083714.4034612-1-zhanjie9@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749822936992844353?= X-GMAIL-MSGID: =?utf-8?q?1749822936992844353?= |
Series |
scsi: hisi_sas/libsas: Fix SATA devices missing issue during hisi_sas_debug_I_T_nexus_reset()
|
|
Commit Message
Jie Zhan
Nov. 18, 2022, 8:37 a.m. UTC
SATA devices on an expander may be removed and not be found again
when I_T nexus reset and revalidation are processed simultaneously.
The issue comes from:
- Revalidation can remove SATA devices in link reset, e.g. in
hisi_sas_clear_nexus_ha().
- However, hisi_sas_debug_I_T_nexus_reset() polls the state of a SATA
device on an expander after sending link_reset, where it calls:
hisi_sas_debug_I_T_nexus_reset
sas_ata_wait_after_reset
ata_wait_after_reset
ata_wait_ready
smp_ata_check_ready
sas_ex_phy_discover
sas_ex_phy_discover_helper
sas_set_ex_phy
The ex_phy's change count is updated in sas_set_ex_phy(), so SATA devices
after a link reset may not be found later through revalidation.
A similar issue was reported in:
commit 0f3fce5cc77e ("[SCSI] libsas: fix ata_eh clobbering ex_phys via
smp_ata_check_ready")
commit 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery competing
with ata error handling").
To address this issue, in hisi_sas_debug_I_T_nexus_reset(), we now call
smp_ata_check_ready_type() that only polls the device type while not
updating the ex_phy's data of libsas.
Fixes: 71453bd9d1bf ("scsi: hisi_sas: Use sas_ata_wait_after_reset() in IT nexus reset")
Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 62080d0fad6f..41ba22f6c7f0 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1694,13 +1694,15 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) return rc; } + /* Remote phy */ if (rc) return rc; - /* Remote phy */ if (dev_is_sata(device)) { - rc = sas_ata_wait_after_reset(device, - HISI_SAS_WAIT_PHYUP_TIMEOUT); + struct ata_link *link = &device->sata_dev.ap->link; + + rc = ata_wait_after_reset(link, HISI_SAS_WAIT_PHYUP_TIMEOUT, + smp_ata_check_ready_type); } else { msleep(2000); }