Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2487510rwb; Fri, 16 Dec 2022 02:46:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GFQ2QJknScweMTu/M2nPuLfCbkGaUJ7mrL5uc7UuvGkBwd1GQcIKuBlStk/4i7SMTvMDP X-Received: by 2002:a17:907:6e0f:b0:7c4:f343:77a8 with SMTP id sd15-20020a1709076e0f00b007c4f34377a8mr10844047ejc.9.1671187598803; Fri, 16 Dec 2022 02:46:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671187598; cv=none; d=google.com; s=arc-20160816; b=he1IcnOuGWMr/SMLuZeYgFMeV/ktr+gqF+egi7BpCkl+GSHas/Y22BJ8bqsER/41cI 11Gi7PKTiieyqg6wrz8bPnYXspg9PHaOP6B5JjzghSLvi3l5Ui77b7sYziEyN5sm819w OdCzDlC+d3jJQP0Oo2341nGCR4FnAEqVccgcmhKRtHip23rsA4sgewsyW0rQ0yWlyVpU XKLAuxZqxVrjjzxIIKulIWK2v/YbmogqtaH3qt46aJq1mkVtGTf8ug8opNLc4TwSLWCG sS98h2FrBLS7+wL793iHhVNp98JmlpEhjsMkEfnrXHpoYSN/B+hnPz7+amrczzawKtAn ACCQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et19-20020a170907295300b007c0a516af79si1395780ejc.313.2022.12.16.02.46.22; Fri, 16 Dec 2022 02:46:38 -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 + 69 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 Content-Type: text/plain 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 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 --- 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 */ -- 2.17.1