Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp166987lqr; Wed, 5 Jun 2024 02:18:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXl3ohqnA8UARoH/3V5TITAEDCHD9fcOHYPmmI6654zPlvhLoOjFLTcxmQ4FnwslK7xbD7+EJlyIuwkF/0jJn1aqsKvYPifreQRvhAthA== X-Google-Smtp-Source: AGHT+IGAVB5D9ONVGbkjmsfAmZzyrUeeDxaoYGt4Tb6/W9cDsqCN2RGME0ikOOTc9ggaKpyI/Iuu X-Received: by 2002:a17:906:66c2:b0:a68:ecf8:9edd with SMTP id a640c23a62f3a-a699faacfdemr118880966b.31.1717579121511; Wed, 05 Jun 2024 02:18:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717579121; cv=pass; d=google.com; s=arc-20160816; b=NxC+9H2gnfFb339Y2+kUBaD3d/NWdH1f7eEuau2xBWtaC9NHL0VJbsJikDXQHMGgWW /wNx/ufucWw62B+NrUhdjcDxpscqcJGvXqGdN+eM7Bq5SbFxVS8c1nS9iTAY/FvJz1eN v6dMQXBMMM/YJMWpFtQHgB8r84noy12wblj4tEmGrG5LZfpqXFn/G4FXqOIYSvn8Rb2e NITIgs3JmmsX8EESjeAJpGMxCjeoDnLl+JZkpLqy4Jgreo4u+wu07wIFV6p2fq2G9+Ey 8Y175z9Yoz5F/Y9bex4oQK+SvbH6RPM0LtFg23r39dsOGO0yBc9eLhRMCHPoqrzR5JDf 6ypw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aqcyHeP6+d7Q5rGdMikjLoTNpmMTGK5vgU8vu0L1700=; fh=D53sqncbHd/r1So/mMjs6wAxkVZ01CqvKjwzasyx8ZE=; b=kdCIAhqJtYpDuq0ZnQVCnm7vAnej21TbbDHnmIpCqkwLA6gTTmp2Yypb5BcgRQlkcK quOLPde/g7NyiunfBGeGnO8S3/6FfWcITZDEbpYLNMP0aLtli492UQ2icQYgKAYy+3k+ oPUJAA4F9/tuuFRhQPAsF6/6/zgJOtt3RX0ZWdpWFQF+eJKiJ8OkYN65bPNyQ/haW0gz /b4Vl87eAiYfAJXsd/p9Fz6xn7ZcwuuTPDaTnOyPSAtXh8xiBF4LHr7YprymY0fy+OuW /PjUMLuAsm4RZ4SIcO5HW0a8waWZBQk8i3HEZ5tPTbJcx+l8S48a9nwPASfNOC+CcZ71 BtSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FnmuLER2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-202073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68a7ad5688si484609366b.6.2024.06.05.02.18.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 02:18:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FnmuLER2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-202073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2ACF91F22077 for ; Wed, 5 Jun 2024 09:18:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F29D18C324; Wed, 5 Jun 2024 09:17:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FnmuLER2" Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E709718FDC4; Wed, 5 Jun 2024 09:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579072; cv=none; b=YDbqudRmBbqClc5MpEOuJO05Hb1KkaK0n4D5+rWIExUj3Z2bNGqpZSRev6Yu4wZqPamOXZKspeQ/9/9L5PpOp5KGjPrbObx9xwhz9/yv+P44+F/mXf+pjkpuV+XgnzHWw6zfoysdzocxyLmLrC9Dv1YYWWRYXUUp4vT3fXwzpMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579072; c=relaxed/simple; bh=pMxUMl191c0/PG/P+rLKeQn8EAI2483T2RHmYGHHcKg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MMNKRe5N5TUS5x87VBTd6Nemqh2uKOL9RTylmM1w3wWBq9frwMTE5M0gCfBUNaXIvVCvboWi6CaHOojyNF6FOkiqifT0PAOqgeJ/cXPqsfl9eAx3Oc6cZO0kVrmwRPPuFCBpt+USU+r/MN46oJlDLAFZ3DPMbCijDbj4gpOy29k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FnmuLER2; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso4066535a12.2; Wed, 05 Jun 2024 02:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717579070; x=1718183870; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aqcyHeP6+d7Q5rGdMikjLoTNpmMTGK5vgU8vu0L1700=; b=FnmuLER2DrFRbkFXGjikW4vKUASwC1mg3oqgzPWVdVbi4mAU1tdc73P/Ps+NiQFTAO 5K0K6T4i/ycJS9KsCmhLH5V4lcw4QcoZN/p5IG5Y6uF/DCITfW+r0x88zXGtbqGoI9Zg T8Rx/oDXc8TxRnxKjH/Aq6OXTwlGggAm9Jn2JhZ6vlPvMA64dkzJgdDWPsZu7pIgFGxd zo/lY7iYFFzI9pWKau+cryvz9KLRUNThlD0Ls60yfV87hgzaJVG1JrpV+ulZ8vVdGkVx QEaNOFA9JFgMuBG2o8csfWOTNJ3jKOntUjgVgfh72M2l2mX4cj32TgcXDuZGcIO8ec0f P/aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717579070; x=1718183870; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aqcyHeP6+d7Q5rGdMikjLoTNpmMTGK5vgU8vu0L1700=; b=b2u1O3tmUHibgKm3BJm0+4ATVRYYMNCLMQJK/koWi/szdDueU2ZKw2zT0AZ7RxMMNO htSd+tvx56aYGA3kTEn3Ch1M36Rot3DqeB6dSMtyCneK49kXSRycNedFf02KG/ZOp0Np slNAm6lbV0xlKvpTP+Cjy86We7kNABSu9mHkDInKKFj5ia2hBlvmqKwGYJvCTaaHmO4S W+qmUfnBIypy/9Z01K07XYg6Sw/JISkN37VpdCyxIEhWT3bGJlcXSwdFUlDsFwhatICo aciadMFF3MvLgfkT2sovKkUUUXZnzJUj7zpKpVwD+CSbqY40M0kxgb/Ozus3uSI6zDIL 0a2A== X-Forwarded-Encrypted: i=1; AJvYcCVJNHjvl7w049rlsKLwl84XXRO/n5FPvtA0IIiG9/E0nOtgPB/u6o8q5YuFdDjPbXI/+EgwRVPSBxKAXLMXOHH0EUkbu6r6JU/TqVoeQsO99Ul9PXvZ5xdlz5wxL1QSvEwSrV3z+zXw7g== X-Gm-Message-State: AOJu0YwP6XdvZ5OgU0+7YDJmaE9e3fW48lk1aRrV9ml+q8ryihddVN7B ZC8m1L6ydypks5xBiGTR1xf65V0HMMO9WY8MUr++dnXbMXHjYfbu X-Received: by 2002:a05:6a20:3d87:b0:1af:6fe9:5039 with SMTP id adf61e73a8af0-1b2b73ade2fmr2408720637.1.1717579070168; Wed, 05 Jun 2024 02:17:50 -0700 (PDT) Received: from localhost (97.64.23.41.16clouds.com. [97.64.23.41]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c2806cfa62sm964831a91.48.2024.06.05.02.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 02:17:49 -0700 (PDT) From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wenchao Hao Subject: [PATCH v5 2/3] scsi: scsi_error: Fix wrong statistic when print error info Date: Wed, 5 Jun 2024 17:17:30 +0800 Message-Id: <20240605091731.3111195-3-haowenchao22@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20240605091731.3111195-1-haowenchao22@gmail.com> References: <20240605091731.3111195-1-haowenchao22@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") 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 612489afe8d2..a61fd8af3b1f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -409,7 +409,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.38.1