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: Xingui Yang X-Patchwork-Id: 634745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C619C4332F for ; Fri, 16 Dec 2022 10:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbiLPKKB (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 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 */