Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2575338rdb; Fri, 22 Sep 2023 02:43:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrzfGWfJhESuCKSHBPqo/mveZHneGFrh8brsC3Br9OslrOBH8jQmGpHxW8zWW+CuV6mJ5x X-Received: by 2002:a05:6870:414c:b0:1d0:f5bd:6d2 with SMTP id r12-20020a056870414c00b001d0f5bd06d2mr8571424oad.38.1695375788468; Fri, 22 Sep 2023 02:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695375788; cv=none; d=google.com; s=arc-20160816; b=Lx736yxgiRItfOEb/Xw3gVDKQH6w5D1MtdyR7FZvtxLuUTiZ1p67+v/vN3yPPMZhrf KNpwBYPoKIeVvzODRQ4hC9OdaVLHxOo2gdECB8Kv7y9mimxUaSML/AJhGx7DDyVMhgcg 7jLsEQH6zlQonmFH7jyb66k2TCAMNPx8w0PPbLpLfTxhUm3lp7YvTELbGrrxxH9jgUHo pBEV2lxbswZoiRQ/Xhm0bKdUKOzb87VS/JWOr7i26B02fIJWATLitmZGMsQnlnaxUH3e y1iAAkqkHgHo3VpG2T1Pdw1s5I37Lpu8O7iFwprzl37U29/TQVmNv/XYFKkWlfic8t8G XY2g== 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=rU5MdSvJX0c4K58o0VVIJTPHUYEOMmfxYLcpJNke8A0=; fh=efbNbptNhbD3foczTZf5UTdQGTI/0Ud9virqYphOI9o=; b=j7GMnwpvJWp5I0wOAre8M0qhdSAI5CxExUQhQzG6Cpy2noH3GBpb6thO76jgVM1BIV fD8pPgKEnhtb2SiaRSRFFseTQsPwF5zX4E+Vo7paKXnkZf02ruaLH6N2AAQ54avebhSF GcQXERdITYA36Mv2tirsab+CF6Z7hZv7GH5ZJj0rQvm3YjWFx7I9f+pRTY4aIdtm9Vo2 ZFGHkNeQy+W0gJzd6M+4eaqaDl5CHtSfQHoXcZ3bt2CVBfX4u1wZ1jHTtDD3Q73t/tXV OdD544sAC4+FUqTCNBB4xfa7HxKDPxfdj/VEYQisCgmKB3mqsrxIPbmo6pjrDU+MLXop 4FaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id k7-20020a634b47000000b00578ca217740si3451727pgl.711.2023.09.22.02.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 02:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 4C7F3819D1F2; Fri, 22 Sep 2023 02:31:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233105AbjIVJa6 (ORCPT + 99 others); Fri, 22 Sep 2023 05:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233080AbjIVJ34 (ORCPT ); Fri, 22 Sep 2023 05:29:56 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A51CF9; Fri, 22 Sep 2023 02:29:41 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RsRkV0DkDzrSTM; Fri, 22 Sep 2023 17:27:30 +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:38 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , Douglas Gilbert , , CC: , , Wenchao Hao Subject: [PATCH v5 10/10] scsi: scsi_debug: Add param to control sdev's allow_restart Date: Fri, 22 Sep 2023 17:29:06 +0800 Message-ID: <20230922092906.2645265-11-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230922092906.2645265-1-haowenchao2@huawei.com> References: <20230922092906.2645265-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: 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:31:07 -0700 (PDT) Add new module param "allow_restart" to control if setup scsi_device's allow_restart flag. This is used to test scsi command finished with sense_key 0x6, asc 0x4 and ascq 0x2 Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_debug.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index ab4a6f7de1ef..52a9ddea57d3 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -843,6 +843,7 @@ static bool have_dif_prot; static bool write_since_sync; static bool sdebug_statistics = DEF_STATISTICS; static bool sdebug_wp; +static bool sdebug_allow_restart; /* Following enum: 0: no zbc, def; 1: host aware; 2: host managed */ static enum blk_zoned_model sdeb_zbc_model = BLK_ZONED_NONE; static char *sdeb_zbc_model_s; @@ -5469,6 +5470,9 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp) sdp->no_uld_attach = 1; config_cdb_len(sdp); + if (sdebug_allow_restart) + sdp->allow_restart = 1; + devip->debugfs_entry = debugfs_create_dir(dev_name(&sdp->sdev_dev), sdebug_debugfs_root); debugfs_create_file("error", 0600, devip->debugfs_entry, sdp, @@ -6186,6 +6190,7 @@ module_param_named(zone_cap_mb, sdeb_zbc_zone_cap_mb, int, S_IRUGO); module_param_named(zone_max_open, sdeb_zbc_max_open, int, S_IRUGO); module_param_named(zone_nr_conv, sdeb_zbc_nr_conv, int, S_IRUGO); module_param_named(zone_size_mb, sdeb_zbc_zone_size_mb, int, S_IRUGO); +module_param_named(allow_restart, sdebug_allow_restart, bool, S_IRUGO | S_IWUSR); MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert"); MODULE_DESCRIPTION("SCSI debug adapter driver"); @@ -6258,6 +6263,7 @@ MODULE_PARM_DESC(zone_cap_mb, "Zone capacity in MiB (def=zone size)"); MODULE_PARM_DESC(zone_max_open, "Maximum number of open zones; [0] for no limit (def=auto)"); MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones (def=1)"); MODULE_PARM_DESC(zone_size_mb, "Zone size in MiB (def=auto)"); +MODULE_PARM_DESC(allow_restart, "Set scsi_device's allow_restart flag(def=0)"); #define SDEBUG_INFO_LEN 256 static char sdebug_info[SDEBUG_INFO_LEN]; -- 2.32.0