forked from mirrors/linux
		
	sd: use __register_blkdev to avoid a modprobe for an unregistered dev_t
Switch from using blk_register_region to the probe callback passed to __register_blkdev to disable the request_module call for an unclaimed dev_t in the SD majors. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									f9550f1b39
								
							
						
					
					
						commit
						996e509bbc
					
				
					 1 changed files with 5 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -630,13 +630,11 @@ static struct scsi_driver sd_template = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Dummy kobj_map->probe function.
 | 
			
		||||
 * The default ->probe function will call modprobe, which is
 | 
			
		||||
 * pointless as this module is already loaded.
 | 
			
		||||
 * Don't request a new module, as that could deadlock in multipath
 | 
			
		||||
 * environment.
 | 
			
		||||
 */
 | 
			
		||||
static struct kobject *sd_default_probe(dev_t devt, int *partno, void *data)
 | 
			
		||||
static void sd_default_probe(dev_t devt)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			@ -3528,9 +3526,6 @@ static int sd_remove(struct device *dev)
 | 
			
		|||
 | 
			
		||||
	free_opal_dev(sdkp->opal_dev);
 | 
			
		||||
 | 
			
		||||
	blk_register_region(devt, SD_MINORS, NULL,
 | 
			
		||||
			    sd_default_probe, NULL, NULL);
 | 
			
		||||
 | 
			
		||||
	mutex_lock(&sd_ref_mutex);
 | 
			
		||||
	dev_set_drvdata(dev, NULL);
 | 
			
		||||
	put_device(&sdkp->dev);
 | 
			
		||||
| 
						 | 
				
			
			@ -3720,11 +3715,9 @@ static int __init init_sd(void)
 | 
			
		|||
	SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n"));
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < SD_MAJORS; i++) {
 | 
			
		||||
		if (register_blkdev(sd_major(i), "sd") != 0)
 | 
			
		||||
		if (__register_blkdev(sd_major(i), "sd", sd_default_probe))
 | 
			
		||||
			continue;
 | 
			
		||||
		majors++;
 | 
			
		||||
		blk_register_region(sd_major(i), SD_MINORS, NULL,
 | 
			
		||||
				    sd_default_probe, NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!majors)
 | 
			
		||||
| 
						 | 
				
			
			@ -3797,11 +3790,9 @@ static void __exit exit_sd(void)
 | 
			
		|||
 | 
			
		||||
	class_unregister(&sd_disk_class);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < SD_MAJORS; i++) {
 | 
			
		||||
		blk_unregister_region(sd_major(i), SD_MINORS);
 | 
			
		||||
	for (i = 0; i < SD_MAJORS; i++)
 | 
			
		||||
		unregister_blkdev(sd_major(i), "sd");
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module_init(init_sd);
 | 
			
		||||
module_exit(exit_sd);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue