[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250314012927.150860-14-jiangjianjun3@huawei.com>
Date: Fri, 14 Mar 2025 09:29:21 +0800
From: JiangJianJun <jiangjianjun3@...wei.com>
To: <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
<linux-scsi@...r.kernel.org>
CC: <hare@...e.de>, <linux-kernel@...r.kernel.org>, <lixiaokeng@...wei.com>,
<jiangjianjun3@...wei.com>, <hewenliang4@...wei.com>,
<yangkunlin7@...wei.com>
Subject: [RFC PATCH v3 13/19] scsi: scsi_debug: Add param to control target based error handle
From: Wenchao Hao <haowenchao2@...wei.com>
Add new module param target_eh to control if enable target based error
handler, and param target_eh_fallback to control if fallback to further
recover when target recovery can not recover all error commands.
This is used to test the target based error handle.
Signed-off-by: Wenchao Hao <haowenchao2@...wei.com>
---
drivers/scsi/scsi_debug.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 162728cca99d..5c0c2529b865 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -886,6 +886,8 @@ static bool sdebug_wp;
static bool sdebug_allow_restart;
static bool sdebug_lun_eh;
static bool sdebug_lun_eh_fallback;
+static bool sdebug_target_eh;
+static bool sdebug_target_eh_fallback;
static enum {
BLK_ZONED_NONE = 0,
BLK_ZONED_HA = 1,
@@ -1195,6 +1197,9 @@ static int sdebug_target_alloc(struct scsi_target *starget)
starget->hostdata = targetip;
+ if (sdebug_target_eh)
+ return scsi_target_setup_eh(starget, sdebug_target_eh_fallback);
+
return 0;
}
@@ -1210,6 +1215,9 @@ static void sdebug_target_destroy(struct scsi_target *starget)
{
struct sdebug_target_info *targetip;
+ if (sdebug_target_eh)
+ scsi_target_clear_eh(starget);
+
targetip = (struct sdebug_target_info *)starget->hostdata;
if (targetip) {
starget->hostdata = NULL;
@@ -6654,6 +6662,8 @@ 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_param_named(lun_eh, sdebug_lun_eh, bool, S_IRUGO);
module_param_named(lun_eh_fallback, sdebug_lun_eh_fallback, bool, S_IRUGO);
+module_param_named(target_eh, sdebug_target_eh, bool, S_IRUGO);
+module_param_named(target_eh_fallback, sdebug_target_eh_fallback, bool, S_IRUGO);
MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert");
MODULE_DESCRIPTION("SCSI debug adapter driver");
@@ -6735,6 +6745,8 @@ 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)");
MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)");
MODULE_PARM_DESC(lun_eh_fallback, "Fallback to further recovery if LUN recovery failed (def=0)");
+MODULE_PARM_DESC(target_eh, "target based error handle (def=0)");
+MODULE_PARM_DESC(target_eh_fallback, "Fallback to further recovery if target recovery failed (def=0)");
#define SDEBUG_INFO_LEN 256
static char sdebug_info[SDEBUG_INFO_LEN];
--
2.33.0
Powered by blists - more mailing lists