Skip to contentSkip to conversation

Add a parameter to set sd driver's probe mode.

PATCH In review longguang.yue 2 participants 2 messages Apr 25, 2023 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a parameter to set sd driver's probe mode.

Asynchronous probe leads to the change of disk name, so it is hard to trace disk by its name for monitoring system.

---
 drivers/scsi/sd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/scsi/sd.c +8 -0
index 4bb87043e6db..ea0ac8823599 100644
@@ -99,6 +99,11 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_ZBC);
 
 #define SD_MINORS	16
 
+static unsigned int async = PROBE_PREFER_ASYNCHRONOUS;
+module_param(async, uint, 0644);
+MODULE_PARM_DESC(async,
+		 "probe scsi disk asynchronously or not. Default is 1 asynchronous.");
+
 static void sd_config_discard(struct scsi_disk *, unsigned int);
 static void sd_config_write_same(struct scsi_disk *);
 static int  sd_revalidate_disk(struct gendisk *);
@@ -3839,6 +3844,9 @@ static int __init init_sd(void)
 
 	SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n"));
 
+	if (async != PROBE_PREFER_ASYNCHRONOUS)
+		sd_template.gendrv.probe_type = PROBE_FORCE_SYNCHRONOUS;
+
 	for (i = 0; i < SD_MAJORS; i++) {
 		if (__register_blkdev(sd_major(i), "sd", sd_default_probe))
 			continue;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · longguang.yue

Asynchronous probe leads to the change of disk name, so it is hard to trace disk by its name for monitoring system.

This won't work: just not doing async sd attach doesn't fix all the other causes of asynchronicity that cause sd names to change. You need to look at addressing disks by one of the permanent /dev/disk/by-* device files.

James