Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2137110rwb; Thu, 15 Dec 2022 20:29:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf63IQBjnx/qOiW+Bi9W/MfDLFUuE5sq5KJ+qp4lITQrhSrFkEYYqgR4IvxfkzTFdRkHx5Xs X-Received: by 2002:aa7:db10:0:b0:46c:ecb8:e703 with SMTP id t16-20020aa7db10000000b0046cecb8e703mr27602261eds.22.1671164955845; Thu, 15 Dec 2022 20:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671164955; cv=none; d=google.com; s=arc-20160816; b=JK0eatDmDCmpH2DgNXH8TxSydpvd8ZeIGUq6nSNijMexHgIormjUbpTF/LU2y8OkdP QyU5L0x6Srgy61MohR2WNXO2NB4/I6i3B5W5ZyyOBjPn2/wdwJW/pLZQB3bmm0MjPyCu O5pM55C4nA0BWb0N2nZn3gO9avn/2jdFYVdeFGy5RSWYya32a/EHFLB1Hny7wKERnnZV C7MWepvQMW8hVS8zUIH81fpszNr3E1HZg1VniF7lH0BjUcp/FhudXCKFImZ3f4LdiJfR LPEP7u1pOP8esIX8GaWJ4Ede2XuJ92G0jOh6koeETytgC7C9xqWRRzPX2h5sMZZNXluH hqqA== 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=d83xc0kf1KiEQFrz+j1tMOs5nvBnTXQNPTNlQJK7qkw=; b=anWOOsQmdWaE/YzW3yk6e1tpZqulh8ylk/Pf8L1QVCUNuKuEUP4I0Kay5LGeZnyXff Lpj11ADmG0I4UQAkZg5gH0aHgOu3iS1KGSElbn2Aw6R2qKI654gc/gvJpzH1ZBrX4XG3 ht67GZw5bhW5jKl6USWm59bJLM2KMW+pJRNmD0xXCxBefCAR+9xDZoqb7a+211CydCHw atCuJa2Bgphp80Df1UnEDFslIwmBMmspUtUJiPvUpx32DUCmf6GsdgsD0iQuC0erU/Ha g9/h8zH3Y21KQST8KiaRqeMoubkX+QJr2iIjqfh8wwD4mP/gLhPvcY4f5VohoITXzPVt jjaA== 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 y17-20020a056402271100b0044f2eb2de9asi1449645edd.444.2022.12.15.20.28.58; Thu, 15 Dec 2022 20:29:15 -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 S229864AbiLPDgK (ORCPT + 68 others); Thu, 15 Dec 2022 22:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbiLPDgH (ORCPT ); Thu, 15 Dec 2022 22:36:07 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9ADD6564; Thu, 15 Dec 2022 19:36:06 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NYF605SPLzJpPf; Fri, 16 Dec 2022 11:32:24 +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 11:36:04 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH] scsi: libsas: Directly kick-off EH when ATA device fell off Date: Fri, 16 Dec 2022 03:29:36 +0000 Message-ID: <20221216032936.17841-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: dggems704-chm.china.huawei.com (10.3.19.181) 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 --- drivers/scsi/libsas/sas_discover.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index d5bc1314c341..bd22741daa99 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -362,6 +362,11 @@ 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->dev_type == SAS_SATA_DEV || + (dev->tproto & SAS_PROTOCOL_STP))) + 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