Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2240985rdg; Sun, 15 Oct 2023 19:04:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSjXxNucok+8q8mcFOWDE+4y7QZmsfsoCRcipvHPpYokMaPVcQVWQ0XLInAMARbvTfryEb X-Received: by 2002:a81:5388:0:b0:59f:5da9:d53c with SMTP id h130-20020a815388000000b0059f5da9d53cmr31545687ywb.35.1697421867588; Sun, 15 Oct 2023 19:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697421867; cv=none; d=google.com; s=arc-20160816; b=Y3K36PF68ONahkH1AxkQEB1sDOD1hAJYEBhQIm/lw7+4JLjZ5X207+N8eSYu6riHTv rvx+36zIeyVqza/QNm6ymanCFxnow93uyvMNqW4UIG9+Tbcjp0omNFM1MqEiGPLaoYZa E8RSgKmjB5B/0VmEjoklKOjwSSBtonaUvRVGI8yLjaL9mrjDkdfaRk03CdNPqU+zMqPf QhsVjq9I3zXkE1jgjwB3S2Obi3dLc2jb6Y9oZHfG/OysMFF8METK6FD1uqU6qhJOpbqp O3DtW2EXtQOslWqsnNd8iM23nCSt/UA78K1u3gwTMP0rZz+VcxZxj5SCIniE9kAu+ikj zdIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5HXWY/1eKTi2AaycFfWdMtNMxCXH8NCt5M62vjx8klI=; fh=ZDcIlyYggP5K3GvQBQF3K/GzUnCJV+bQb/1GDPxM7E4=; b=ILPriOuXcgnkGdleCjoBQ5gkwMX+zeIIkZgrp4OGXPIXrtYSnXN4lQ4lx0bb/TAmmL 2zMY5PQRoHCpQuyiKvXzHPIcgpQMBlKKOlqZiXwA1ambzBtxmcB5AUywBg34QyDSsC6n rv8MBYnhovfHyYQjptmY8ZXiQ/ugdS78YNQck7mY9O1HWiwONlAUHajHEt1lK+sq1zgy 8nIiyn8yMkMHoTdcL0j4zBCnK0AML2EhTQI3lc05XZ8mjCHYzw+Ur0VQXGOea8cqNqH4 LIiADuif4+xTwZ5N1YUmrwYWov0187TUoaa8Tu8IJdr1yrY/oq+xlFn8Irxhb17/JJV9 gBmg== 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:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id w71-20020a63824a000000b005b7c45c7b8fsi1318444pgd.664.2023.10.15.19.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 19:04:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id DDEB98083A97; Sun, 15 Oct 2023 19:04:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbjJPCDk (ORCPT + 99 others); Sun, 15 Oct 2023 22:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjJPCDj (ORCPT ); Sun, 15 Oct 2023 22:03:39 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374C8C1; Sun, 15 Oct 2023 19:03:37 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S80g125lDzVlcD; Mon, 16 Oct 2023 09:59:57 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm000012.china.huawei.com (7.193.23.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 16 Oct 2023 10:03:33 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: , , Wenchao Hao Subject: [PATCH v3 2/4] scsi: scsi_error: Fix wrong statistic when print error info Date: Mon, 16 Oct 2023 10:03:12 +0800 Message-ID: <20231016020314.1269636-3-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231016020314.1269636-1-haowenchao2@huawei.com> References: <20231016020314.1269636-1-haowenchao2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000012.china.huawei.com (7.193.23.142) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Sun, 15 Oct 2023 19:04:13 -0700 (PDT) shost_for_each_device() would skip devices which is in progress of removing, so commands of these devices would be ignored in scsi_eh_prt_fail_stats(). Fix this issue by using shost_for_each_device_include_deleted() to iterate devices in scsi_eh_prt_fail_stats(). Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index c67cdcdc3ba8..2550f8cd182a 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -407,7 +407,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, int cmd_cancel = 0; int devices_failed = 0; - shost_for_each_device(sdev, shost) { + shost_for_each_device_include_deleted(sdev, shost) { list_for_each_entry(scmd, work_q, eh_entry) { if (scmd->device == sdev) { ++total_failures; -- 2.32.0