Re: Time to make dynamically allocated devt the default for scsi disks?
From: James Bottomley <James.Bottomley@HansenPartnership.com>
Date: 2016-09-01 15:10:07
Also in:
linux-scsi
On Mon, 2016-08-29 at 11:16 -0700, Bart Van Assche wrote:
On 08/14/2016 10:21 AM, James Bottomley wrote:quoted
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d3e852a..222771d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c@@ -3000,7 +3000,13 @@ static void sd_probe_async(void *data,async_cookie_t cookie) } blk_pm_runtime_init(sdp->request_queue, dev); - device_add_disk(dev, gd); + /* + * previously the parent of the gendisk was the scsi device. It + * was moved to fix lifetime rules, so now we install a symlink + * to the new location of the block class directory + */ + device_add_disk(&sdkp->dev, gd); + WARN_ON(sysfs_add_link_to_group(&dev->kobj, "block", &sdkp ->dev.kobj, "block")); if (sdkp->capacity) sd_dif_config_host(sdkp);@@ -3142,6 +3148,7 @@ static int sd_remove(struct device *dev) async_synchronize_full_domain(&scsi_sd_pm_domain); async_synchronize_full_domain(&scsi_sd_probe_domain); + sysfs_remove_link(&dev->kobj, "block"); device_del(&sdkp->dev); del_gendisk(sdkp->disk); sd_shutdown(dev);Hello James, Sorry that it took so long before I could test this patch and the previous patch that was posted in this e-mail thread. But I did so earlier this morning. What I see is that the following warning message is reported frequently: WARNING: CPU: 1 PID: 136 at drivers/scsi/sd.c:3009 sd_probe_async+0x1ce/0x1e0
That's because the link is created too early, I think. Let me dig into this; I managed to hose my big device machine, so I'll need time to resurrect it. James