Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3057135rdh; Thu, 28 Sep 2023 00:50:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBtSGWDHnhWZLhub45MmLrltfu4x2WzkVph3i5W2FBUbdti2MkbaAWbfZIYTWLo/RbKom1 X-Received: by 2002:a05:622a:8b:b0:40d:6219:d813 with SMTP id o11-20020a05622a008b00b0040d6219d813mr536417qtw.68.1695887403777; Thu, 28 Sep 2023 00:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695887403; cv=none; d=google.com; s=arc-20160816; b=bQTNco0ADCdlZu8svbYvfb4INYozZwDdytSiEqxwV2T2R+KKnVF4aJIIc03LiPwgu0 w2tO9TffDD9jMqvV/WhG0bQsZq1NEMwJF6S27y23borEnWiPB+VP4IwTBy9fUCZeSeBY WtOE2XUGl+cnIH9sfyqD0lqoF12VAp1pv6Q9kuvUNXfWJz+P6SR3/AV78CmAYSeeL0ch 3v82HuiylbF44VmNRl2/NnKY/qx2j9QsUWiAjKUimy89UFMlYoJwRHiOEw0WDd28yNvP 7RcQZWpxvez9T0+dRov5+t0TDacRTc7M+YM35qlCBB8m8WrRvjGsWW2XW9/wOb1fSG7J 2mqg== 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=iZeRx98V2MQ0Fd18TNbOm3OFqQpf69ucYWLQcz2WfNkxo581QPLXs1tR+RaLp9DPJz c4CRxxS8Ufiziy14SKPLp26vL9KbySCjEAMX6lwjft5ms+KJ/Hb2zgIsL5oN9FqD5iWY YKNtgAqDRoYUNKEGH0RCnih0I2KE3rFiXcfRMRAlyjet1enyXw1XHFgjzWX9raBOVg9m dGME6SJJb4yipfJkbEKF7lmuJFYaD/0mSBmpSoePvU9QG9dyRWNg7SG2xEjIuFNhLH/H 5Y02gClpkKqOBsZfT5QHW60iXQhW9SsVIBs3KepOPkeap+x2qyq6oZ+mtNe4rnxUM8VD 1R0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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. [23.128.96.34]) by mx.google.com with ESMTPS id az1-20020a056a02004100b00578a2466521si18739634pgb.676.2023.09.28.00.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 00:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 DE027801BE84; Thu, 28 Sep 2023 00:36:30 -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 S230202AbjI1HgX (ORCPT + 99 others); Thu, 28 Sep 2023 03:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjI1HgV (ORCPT ); Thu, 28 Sep 2023 03:36:21 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E8692; Thu, 28 Sep 2023 00:36:17 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rx4tx1hVBzNnp5; Thu, 28 Sep 2023 15:32:25 +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; Thu, 28 Sep 2023 15:36:14 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: , , Wenchao Hao Subject: [PATCH v2 2/4] scsi: scsi_error: Fix wrong statistic when print error info Date: Thu, 28 Sep 2023 15:35:41 +0800 Message-ID: <20230928073543.3496394-3-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230928073543.3496394-1-haowenchao2@huawei.com> References: <20230928073543.3496394-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: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm000012.china.huawei.com (7.193.23.142) 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 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 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 00:36:31 -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