Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2574587rdb; Fri, 22 Sep 2023 02:41:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgBLdaGlx9QW9DGQDwRVGB/NA+zJ8VStG/lQLPgq0fT3fMcArmpi4gVWsfxnopmZsgJ281 X-Received: by 2002:a17:903:18e:b0:1bb:94ed:20a with SMTP id z14-20020a170903018e00b001bb94ed020amr8584305plg.24.1695375663429; Fri, 22 Sep 2023 02:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695375663; cv=none; d=google.com; s=arc-20160816; b=RblkkjuTaJBnT/132Cguvv3znxpb74NvyGmBneZuaJg9oYUJfkMoXJMA+HbyjKwapw 60MnZZRoj57vOjequipNy9515SF3rQ7eweko3ptYGCNAS4be4y6EXFf35jt7Cj3Jx3T9 Hi0+TgEgjUKgPZpzWFyCmQJ8CEKOSMluJyFd6E1SiW0UOFvX8F6L5SVd8QEHG3gKL61R jaDu7OBsZ0KZsMqIZ8SdJmwSTJvSMoUd6Lq6l374h06c6aGU3dmGR5LlwUl4l+6LtBU3 QZDIIhz409a7KL5JFsBY5duhDYSiniJ42R2XVDFcmXLXB70UDuzJBr5/A5AWv6Ms4vRA SM6A== 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=CbKZAZgNFByTXgYhhZb+JAb+rP58lWXieK1Zk49Gsng=; fh=efbNbptNhbD3foczTZf5UTdQGTI/0Ud9virqYphOI9o=; b=i/EIcKjOgvxU9wBdicKOfOxGC3FpuU8zLGPL0C4C6T0PzfiGAmmAV3m0WrmktK957s C0EvQl7M3t5Sue8fE1mlVfc5pimcFy6QSOdgGZ/Qhsr5AtO/4Lrnmn4MP29P7Ct5+Qd3 NOH2YX89FZH3sb9CR71TRsrroSz53EcedLG+4yFpxo5N+v367NcXo5BFWiEWTIyo/LM8 3EwOlRoTWPuP1KvLIhv0eExpmt4F+B04JlWgrcTq+w1ZXBfFHKFZiNP/0cz2MVQBrDJI 2Gt5DgGAYiGqE4++XN4VCOb2cr8KOGKO6jcyfL91SSVQkJurETVUZZInCj93YG0ym1A1 3qvg== 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 6-20020a170902e9c600b001b9e9b21287si3245862plk.427.2023.09.22.02.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 02:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id C6CA382CC471; Fri, 22 Sep 2023 02:30:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233095AbjIVJ35 (ORCPT + 99 others); Fri, 22 Sep 2023 05:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233215AbjIVJ3r (ORCPT ); Fri, 22 Sep 2023 05:29:47 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 647A6E6F; Fri, 22 Sep 2023 02:29:34 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RsRhf6r1vzMln8; Fri, 22 Sep 2023 17:25:54 +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; Fri, 22 Sep 2023 17:29:31 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , Douglas Gilbert , , CC: , , Wenchao Hao Subject: [PATCH v5 00/10] scsi:scsi_debug: Add error injection for single device Date: Fri, 22 Sep 2023 17:28:56 +0800 Message-ID: <20230922092906.2645265-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: dggems703-chm.china.huawei.com (10.3.19.180) 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:30:06 -0700 (PDT) The original error injection mechanism was based on scsi_host which could not inject fault for a single SCSI device. This patchset provides the ability to inject errors for a single SCSI device. Now we supports inject timeout errors, queuecommand errors, and hostbyte, driverbyte, statusbyte, and sense data for specific SCSI Command. Two new error injection is defined to make abort command or reset LUN failed. Besides error injection for single device, this patchset add a new interface to make reset target failed for each scsi_target. The first two patch add an debugfs interface to add and inquiry single device's error injection info; the third patch defined how to remove an injection which has been added. The following 5 patches use the injection info and generate the related error type. The last one just Add a new interface to make reset target failed. V5: - Using rcu list to sync between error inject add, remove and check - Add module parameter "allow_restart" to control scsi_device's allow_restart flag V4: - Fix BUG_ON triggered by schedule in atomic context when rmmod scsi_debug Closes: https://lore.kernel.org/oe-lkp/202308031027.5941ce5f-oliver.sang@intel.com V3: - Add two more error types to fail abort command and lun reset - Fix memleak when rmmod scsi_debug without clearing errors injected - Fix memkeak because did not implement release in sdebug_error_fops - Fix possible NULL point access in scsi_debug_slave_destroy - Move specific error type's description to each single patch which implement this error type - Add interface to make target reset fail V2: - Using debugfs rather than sysfs attribute interface to manage error Wenchao Hao (10): scsi: scsi_debug: create scsi_debug directory in the debugfs filesystem scsi: scsi_debug: Add interface to manage single device's error inject scsi: scsi_debug: Define grammar to remove added error injection scsi: scsi_debug: timeout command if the error is injected scsi: scsi_debug: Return failed value if the error is injected scsi: scsi_debug: set command's result and sense data if the error is injected scsi: scsi_debug: Add new error injection abort failed scsi: scsi_debug: Add new error injection reset lun failed scsi: scsi_debug: Add debugfs interface to fail target reset scsi: scsi_debug: Add param to control sdev's allow_restart drivers/scsi/scsi_debug.c | 557 +++++++++++++++++++++++++++++++++++++- 1 file changed, 552 insertions(+), 5 deletions(-) -- 2.32.0