Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2240951rdg; Sun, 15 Oct 2023 19:04:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvDaX0x9Qk7rTKpUmq902kQp3yaOlE6vqW8fVUIw0nUjhKGQRQ4BWQl5UB712Gq8axKcAL X-Received: by 2002:a17:902:8b8c:b0:1c0:aca0:8c44 with SMTP id ay12-20020a1709028b8c00b001c0aca08c44mr29083089plb.19.1697421860588; Sun, 15 Oct 2023 19:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697421860; cv=none; d=google.com; s=arc-20160816; b=Lohr/AZ5fmNGQzSEAvBRTd+r3forRS0QzA8kOEb0Py19B8d6X1smAHicyVBv5ePT2Y HFdKWQ7Ad0bghFvIynofmWZQVqOGXaMGh51olIgO4CdM2oFrhriwWieZh8lFom1lVgd4 VZ11/GjGFo01gmS/rvZlHhaT6V9Eb6smW8TEpA6kurN0Kq2VBx0ZuwzMaJ6MC2qgKVOW lc+0gALs6Ofg3n9tAinQWqtC6E3R9/yZH5YNihdy8HiI6GnvZ96rWxfa/slcQgqNPBPY mv4LImRdxAG2TOgmCjqB0sNyRDghf1Q6lniI8L0ztS0QyJsMMUuCzEPQ6wEdcyip5hvx k37w== 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 :message-id:date:subject:cc:to:from; bh=mQTG/nkGrl8JKUeK0AqAbNBZBa20VHsMMzrlu4j3Dpc=; fh=ZDcIlyYggP5K3GvQBQF3K/GzUnCJV+bQb/1GDPxM7E4=; b=HSom+NH6QNY9P1P0HDGi7JznjX6+ILTmD4e8Ar28/kldBSHIfUEZZoeA8CoVAlOoor v0/a2BHt3wmVUymubmcJM867HDC8VvR9hQFo0VndW+10snW3DcrmWLn729U01gojw3RD 8iTCHXr4BEFgTQCgjxcrxOEAwgUMaXVlmlVojgFSkulM44nEhhxyc2uMh1hDV4txGVAE /2lAIg9irvwOj5hHymTSXirsJJGwKH6vUnJLaFoZtUiKlkq03ums7dSNgy/kQ0Bbekr0 Kn9CRHUurXeJyHE2l8IG/cm0JKxExtUVsg1QRuhnGRZyB36nWKucLfmBncR+ibebg27k DckQ== 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:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g23-20020a170902869700b001c3b4eb2135si9068520plo.463.2023.10.15.19.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 19:04:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id BE220806155E; Sun, 15 Oct 2023 19:04:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbjJPCDl (ORCPT + 99 others); Sun, 15 Oct 2023 22:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjJPCDj (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 D465E95; Sun, 15 Oct 2023 19:03:36 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S80fZ3QJTzNndS; Mon, 16 Oct 2023 09:59:34 +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:32 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: , , Wenchao Hao Subject: [PATCH v3 0/4] SCSI: Fix issues between removing device and error handle Date: Mon, 16 Oct 2023 10:03:10 +0800 Message-ID: <20231016020314.1269636-1-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 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 pete.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 (pete.vger.email [0.0.0.0]); Sun, 15 Oct 2023 19:04:18 -0700 (PDT) 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(). Three issues are found: 1. statistic info printed at beginning of scsi_error_handler is wrong 2. device reset is not triggered 3. IO requeued to request_queue would be hang after error handle 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 (4): 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 scsi: scsi_core: Fix IO hang when device removing drivers/scsi/scsi.c | 46 ++++++++++++++++++++++++++------------ drivers/scsi/scsi_error.c | 4 ++-- drivers/scsi/scsi_lib.c | 2 +- include/scsi/scsi_device.h | 25 ++++++++++++++++++--- 4 files changed, 57 insertions(+), 20 deletions(-) -- 2.32.0