Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp760308rdb; Thu, 30 Nov 2023 19:00:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMnLMj61Rg0+962hG1uE/+dMKgaI32+m4rvGQKRAnc19+GokqL38OfuaDD3r7Xf7Q+14Kw X-Received: by 2002:a05:6870:8585:b0:1e9:9742:7dfd with SMTP id f5-20020a056870858500b001e997427dfdmr26044408oal.31.1701399625140; Thu, 30 Nov 2023 19:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701399625; cv=none; d=google.com; s=arc-20160816; b=qyLSTqvqJOg2Rgp9YEHfdVMBg47g3FIKyJ4Mt7nSD48aFcYrcCaamecv1uVv+vfYOU lYFjpp1pmoPniHgxV/bas8H+6zPqKPWGztsdWVzN7SpgbfewYddRqyR6S95OjeDImRcn 2OlDI+aPDDWxsumoTs15C91VyFkHLK9U5BRJzWaxNGXaefnF2njuPD7ybZUze7fu6CZm 9M+fhLFD7RGzFJk61W1vZg9jB0NyRX87xSxpqDyGKWwCvKP521huiHPlRe7wcV+5OD64 RcLbSGBW2pluOGU8EnNtWZl+GWUhgVoSFiFz23zNYHNwS1YqJ5mY0z5FzH8ON1nb95xY 2ZDw== 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=3xCUVqpwzsqfBdi7Tb4KMKUNC7ELqGhbXHUO3xkJ2g8=; fh=lLe8NoVVmEmysVgSqTZYlhODssQdAb0Zio5XUQnN4uk=; b=b+QR2b6/bjxl694YH/rR0Oor1B5BJbO/wxgJctASJbp0rYO9uILF7bpqLInRkCr30Q C5Wf0DxYE/TXmWcSprISERZSpjr/gBHFHW6WfgxKPkh3LBj6qiGW1zeaaitU24C6819m Sbo0e1lwjoestlDOW/LkRq4x1WbDD5AyCTi6dh2TPQz/6vmH/mK5aerRNYiXJqKONRgQ qgnfcWDOkUNKIUt2k1mcPnyuDC9Z/++m8Ppt3ZAQAjpnfmvuwkwjrIIq2OvFS7hbiiyy cNX3ZZaWJ3fZOcrNNl71JYZ6oCh5CS8RHXmIYFDhCiwN7T07Rrl1FZL7SWB32Anh1liD cekg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e6-20020a63ee06000000b005c609c4fb47si2407715pgi.283.2023.11.30.19.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 19:00:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2627880DECC6; Thu, 30 Nov 2023 19:00:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376882AbjLADAL (ORCPT + 99 others); Thu, 30 Nov 2023 22:00:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231537AbjLADAK (ORCPT ); Thu, 30 Nov 2023 22:00:10 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811C51718; Thu, 30 Nov 2023 19:00:16 -0800 (PST) Received: from dggpemd100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4ShHl545gtzsRSY; Fri, 1 Dec 2023 10:56:33 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpemd100001.china.huawei.com (7.185.36.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Fri, 1 Dec 2023 11:00:14 +0800 From: Xingui Yang To: , , CC: , , , Subject: [PATCH v2] scsi: libsas: Put the disk offline if all recovery actions fail Date: Fri, 1 Dec 2023 02:57:17 +0000 Message-ID: <20231201025717.16264-1-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemd100001.china.huawei.com (7.185.36.94) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 19:00:21 -0800 (PST) Currently, after all recovery actions in sas_eh_handle_sas_errors() fail for sas disk, we just clear all IO, but the disk is still online. Perhaps we should free sas_task and continue the subsequent recovery process for IO that cannot be processed. If it still fails, the disk will be offline in scsi_eh_ready_devs(). Signed-off-by: Xingui Yang Signed-off-by: Bo Wu --- v1 -> v2: 1. Free the sas_task of the work_q. --- drivers/scsi/libsas/sas_scsi_host.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 9047cfcd1072..0cd3b92a299f 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -637,8 +637,8 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head * SAS_ADDR(task->dev->sas_addr), cmd->device->lun); - sas_eh_finish_cmd(cmd); - goto clear_q; + list_move_tail(&cmd->eh_entry, work_q); + goto free_q_task; } } out: @@ -646,6 +646,15 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head * list_splice_tail_init(&ha->eh_ata_q, work_q); return; +free_q_task: + pr_debug("--- Exit %s -- free_q_task\n", __func__); + list_for_each_entry_safe(cmd, n, work_q, eh_entry) { + struct sas_task *task = TO_SAS_TASK(cmd); + + sas_end_task(cmd, task); + } + goto out; + clear_q: pr_debug("--- Exit %s -- clear_q\n", __func__); list_for_each_entry_safe(cmd, n, work_q, eh_entry) -- 2.17.1