Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp632579lqi; Thu, 7 Mar 2024 07:19:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVXDmKbLay8Xau3SJERc9lIHdBpLTD/vGm3JD+fx4yi4S1qSRhXgFceWPyNzd3fb8/MA0v0pX8l0LZLHFf8lXmh7SDwIjcEOrFsYR9QGw== X-Google-Smtp-Source: AGHT+IFW1yY0BconqZPrW+oOm7kT34O47rmT34dnvo8fLGtEcNsCm8Ihh3vPX1tlPaFHJpjEnDrk X-Received: by 2002:a17:902:e883:b0:1dc:78bc:ad0a with SMTP id w3-20020a170902e88300b001dc78bcad0amr10274377plg.36.1709824781809; Thu, 07 Mar 2024 07:19:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709824781; cv=pass; d=google.com; s=arc-20160816; b=Bhgu+wkLz5oXfCMMLRKiK8aFQGFOHr0ry27PKtjAzcPMTWgj/oi+hunp9pBsnjBRTw 53/ZCic4hHGTyAY2oavJKknYF2VIt5avNVYfzknaIIFzO0Jp0rOQD34p/s0zd1hOLr22 ucNjE4j+zqUUNK+yepxRtn+H3mH8ZFo6FbqDIjEjvbaQzRnKlAwjXkzkDwwGjjQ2OJSk 43XjxOgDfDPqf0g8xHx9QS8jyX+JTEeEyGrYxWwJKSZPzu1EWIJX2pusIBGiinA876q2 xrmknRqBGQyLJFbXPAybvOMyNuiHOeD8Z9QRx/ScCHGACow386SG3GQ/upzoJQJoJr2V qHZw== 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:message-id:date:subject:cc:to :from; bh=0IPdHFQmavD3qy1NqZL00V27qtm+04U5ozWrAJ+a40o=; fh=kJw81WcDbczhMv9Ym8ExeTSTQJZsL8hg/D68tIB968A=; b=oK0SINzvJ/T673PwccviAFaeEgE+IejVvvZ83tDFaXVKeVd0htUnXckUJH5adEkgab /izDtfPK0zdKJdriDQOm3RfPltzhe1jSfhI1+VA1Yg/op1Gv8twZQqpf89dFiELF3eml XmoKRMtlRKxW/jTVD4CTMzW7D75taTWzVD0Q+SbGccAADFUVWx+MIQUvkoQYfOGuh0FM SDVvC7wIaVFO4rxlcp/CrCDYhrGGoZuMNvFcI8tuKmF8SEjCzOug0im0TUXi1lnwJKOP 0iTbudYAAHrOzHsTXFX/fV68Xn2i3XWcMQPrjgdzaN5lZEOF8uoRxlbqk5wkha4T2cEH IKyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-95763-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95763-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u10-20020a170903124a00b001da15f2a761si14349818plh.13.2024.03.07.07.19.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 07:19:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95763-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-95763-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95763-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2BC5FB260A0 for ; Thu, 7 Mar 2024 14:46:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CADD812E1FA; Thu, 7 Mar 2024 14:45:53 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC2271EB2F; Thu, 7 Mar 2024 14:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709822753; cv=none; b=Mo1Y26JmPH+jYNHgNkidqqHrMhHEGyesvZ/oYCEQtYS0IsF+Qd3LbZyKgD5+TdEKFBI4dMlE+sjBk6E9a2i0+Y74Tl10YCY3IX5dh1wvL6NfmfLxytyWVM5YccZzgDwvVDVyeALeEpfj6zAQUEho7Dg4xVqP45SWbm3QV/nhj+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709822753; c=relaxed/simple; bh=1qZVm0xyYLh7JYAEGw5xTkCh+bdrOkAYksX68kfmoGk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Vtmkd4mFHT/ssUHo/0sGK3hG1CGcNlykUhBxS5YQI/wkd4nzhFvFNlGVpoxdwzVY8TbPGlKfsSjQJvL5aeCM+nkFQhmoubdtKoE0KeIiKqYxkGfPckUVkhJj1B+OCx9qoq/Z6KJoNjWK0mblU2NPp/FKSrSF9TBZWuQfKkVmoxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TrBtT6wFlz1FLwj; Thu, 7 Mar 2024 22:45:37 +0800 (CST) Received: from kwepemm600012.china.huawei.com (unknown [7.193.23.74]) by mail.maildlp.com (Postfix) with ESMTPS id 56B271A016C; Thu, 7 Mar 2024 22:45:47 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 7 Mar 2024 22:45:46 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , , CC: Wenchao Hao , Subject: [PATCH v4 0/3] SCSI: Fix issues between removing device and error handle Date: Thu, 7 Mar 2024 22:43:08 +0800 Message-ID: <20240307144311.73735-1-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600012.china.huawei.com (7.193.23.74) I am testing SCSI error handle with my previous scsi_debug error injection patches, and found some issues when removing device and error handler happened together. These issues are triggered because devices in removing would be skipped when calling shost_for_each_device(). The issues are found: 1. statistic info printed at beginning of scsi_error_handler is wrong 2. device reset is not triggered V4: - Remove the forth patch which fix IO hang when device removing becaust the issue is fixed by commit '6df0e077d76bd (scsi: core: Kick the requeue list after inserting when flushing)' V3: - Update patch description - Update comments of functions added V2: - Fix IO hang by run all devices' queue after error handler - Do not modify shost_for_each_device() directly but add a new helper to iterate devices but do not skip devices in removing Wenchao Hao (3): scsi: core: Add new helper to iterate all devices of host scsi: scsi_error: Fix wrong statistic when print error info scsi: scsi_error: Fix device reset is not triggered drivers/scsi/scsi.c | 46 ++++++++++++++++++++++++++------------ drivers/scsi/scsi_error.c | 4 ++-- include/scsi/scsi_device.h | 25 ++++++++++++++++++--- 3 files changed, 56 insertions(+), 19 deletions(-) -- 2.32.0