public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add a parameter to set sd driver's probe mode.
@ 2023-04-25  7:59 longguang.yue
  2023-04-25 12:19 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: longguang.yue @ 2023-04-25  7:59 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, longguang.yue

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

Signed-off-by: longguang.yue <bigclouds@163.com>
---
 drivers/scsi/sd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 4bb87043e6db..ea0ac8823599 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add a parameter to set sd driver's probe mode.
  2023-04-25  7:59 [PATCH] Add a parameter to set sd driver's probe mode longguang.yue
@ 2023-04-25 12:19 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2023-04-25 12:19 UTC (permalink / raw)
  To: longguang.yue, martin.petersen; +Cc: linux-scsi

On Tue, 2023-04-25 at 15:59 +0800, longguang.yue wrote:
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-25 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25  7:59 [PATCH] Add a parameter to set sd driver's probe mode longguang.yue
2023-04-25 12:19 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox