Skip to content

Commit 573c2d0

Browse files
wenchao-haomartinkpetersen
authored andcommitted
scsi: scsi_debug: Add param to control sdev's allow_restart
Add new module param "allow_restart" to control scsi_device's allow_restart flag. This flag determines if EH is triggered after a command completes with sense_key 0x6, ASC 0x4 and ASCQ 0x2. EH would be triggered if allow_restart=1 in this condition. The new param can be used with the error injection capability to test how commands completing with sense_key 0x6, ASC 0x4 and ASCQ 0x2 are handled. Signed-off-by: Wenchao Hao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Douglas Gilbert <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f084fe5 commit 573c2d0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: drivers/scsi/scsi_debug.c

+6
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ static bool have_dif_prot;
843843
static bool write_since_sync;
844844
static bool sdebug_statistics = DEF_STATISTICS;
845845
static bool sdebug_wp;
846+
static bool sdebug_allow_restart;
846847
/* Following enum: 0: no zbc, def; 1: host aware; 2: host managed */
847848
static enum blk_zoned_model sdeb_zbc_model = BLK_ZONED_NONE;
848849
static char *sdeb_zbc_model_s;
@@ -5478,6 +5479,9 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
54785479
sdp->no_uld_attach = 1;
54795480
config_cdb_len(sdp);
54805481

5482+
if (sdebug_allow_restart)
5483+
sdp->allow_restart = 1;
5484+
54815485
devip->debugfs_entry = debugfs_create_dir(dev_name(&sdp->sdev_dev),
54825486
sdebug_debugfs_root);
54835487
if (IS_ERR_OR_NULL(devip->debugfs_entry))
@@ -6202,6 +6206,7 @@ module_param_named(zone_cap_mb, sdeb_zbc_zone_cap_mb, int, S_IRUGO);
62026206
module_param_named(zone_max_open, sdeb_zbc_max_open, int, S_IRUGO);
62036207
module_param_named(zone_nr_conv, sdeb_zbc_nr_conv, int, S_IRUGO);
62046208
module_param_named(zone_size_mb, sdeb_zbc_zone_size_mb, int, S_IRUGO);
6209+
module_param_named(allow_restart, sdebug_allow_restart, bool, S_IRUGO | S_IWUSR);
62056210

62066211
MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert");
62076212
MODULE_DESCRIPTION("SCSI debug adapter driver");
@@ -6274,6 +6279,7 @@ MODULE_PARM_DESC(zone_cap_mb, "Zone capacity in MiB (def=zone size)");
62746279
MODULE_PARM_DESC(zone_max_open, "Maximum number of open zones; [0] for no limit (def=auto)");
62756280
MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones (def=1)");
62766281
MODULE_PARM_DESC(zone_size_mb, "Zone size in MiB (def=auto)");
6282+
MODULE_PARM_DESC(allow_restart, "Set scsi_device's allow_restart flag(def=0)");
62776283

62786284
#define SDEBUG_INFO_LEN 256
62796285
static char sdebug_info[SDEBUG_INFO_LEN];

0 commit comments

Comments
 (0)