From patchwork Fri Dec 16 10:03:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangxingui X-Patchwork-Id: 33931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp882814wrn; Fri, 16 Dec 2022 02:23:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KPeovF/f24HN1RrDKZiJR79kizXqv0TqNN5DmUQHmK1Jsp257mkhdQhF5oxRjWGcBxlYM X-Received: by 2002:a17:902:a60c:b0:189:f990:24af with SMTP id u12-20020a170902a60c00b00189f99024afmr31631265plq.20.1671186208271; Fri, 16 Dec 2022 02:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671186208; cv=none; d=google.com; s=arc-20160816; b=ng1VRfAX9HotRj1SN/an8JEntb5BkClqF9LHtgL1NY29ouw4GiKwqTZJlQJR2DqIBr 1b/zogU064CBz8ykhgyAF1pBOaVUJsIRoKlkPEtJnO40Bm5lJjzEPHxGPLkO/HOeUmQZ 4J1aps8QpvupugBn/qP4bFHht4zeHhJaCT4agNcIy1HCLPQHpGC27NhhpQo7aWZQdqny trrgz0HbYKpRmACEPvFTueJJEA5m48cayx6yTuiAbALM925iim1vqGIhER6Kt9U/kOZB 1jdX/YeW0OywG2iu2zRSEhD0iKXv7O56LznVD2nPfsvuTLPbOgzX3UP84v1LvamnqMvU ji+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=efaSzCnyAS9dIDurbfYBdpzVO9obVdA3MFtnLYIAsEQ=; b=Aqftg6QA2Ticcy89/IN10D+vkSAmQxGwjNfv9GQcZ4IlVl4fk+isMuetWXCaQrKRsZ 0hCMIL30rzRx7oLeF5q8YjmoWtY1ZPaIsE0egoWhucTwU5FIvSgLb6quxVgFCdQRckFw 3a8fxxX/Tx4/d3KS8h+EMnn05I2deb0jtWy+vggGA3tYPoLbq/555VASSsRjPmbD+Yk/ zB464i+k6pdZ7O4UGpp8boC6eqCYb0isV5qlADBjJtD9Ri04BRme8HeV0be3RiDGQmFK p9dwhW/uHZF9DlWucxSgDmYYcyg5pcsRv26rjamOTHxJM6taAZejTo8pAviQg5y7q/RF dxZA== 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=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg2-20020a17090326c200b0018981449921si1980223plb.107.2022.12.16.02.23.15; Fri, 16 Dec 2022 02:23:28 -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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbiLPKKB (ORCPT + 99 others); Fri, 16 Dec 2022 05:10:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiLPKJ7 (ORCPT ); Fri, 16 Dec 2022 05:09:59 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0572186DD; Fri, 16 Dec 2022 02:09:57 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NYPvb6FFnzJqT4; Fri, 16 Dec 2022 18:08:59 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 16 Dec 2022 18:09:55 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH V2] scsi: libsas: Directly kick-off EH when ATA device fell off Date: Fri, 16 Dec 2022 10:03:27 +0000 Message-ID: <20221216100327.7386-1-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500012.china.huawei.com (7.185.36.89) 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752340849141172882?= X-GMAIL-MSGID: =?utf-8?q?1752365749353804049?= If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts. Signed-off-by: Xingui Yang Reviewed-by: Jason Yan --- Changes to v1: - Use dev_is_sata() to check ATA device type drivers/scsi/libsas/sas_discover.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index d5bc1314c341..a12b65eb4a2a 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -362,6 +362,9 @@ static void sas_destruct_ports(struct asd_sas_port *port) void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) { + if (test_bit(SAS_DEV_GONE, &dev->state) && dev_is_sata(dev)) + sas_ata_device_link_abort(dev, false); + if (!test_bit(SAS_DEV_DESTROY, &dev->state) && !list_empty(&dev->disco_list_node)) { /* this rphy never saw sas_rphy_add */