On Sat, Aug 13, 2016 at 11:27 AM, Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > On Sat, Aug 13, 2016 at 10:43 AM, James Bottomley [..] >> Um, so this patch doesn't fix the problem. It merely makes the lifetime >> rules correct so the problem can then be fixed at the scsi level. > > You're right that this patch does not fix the problem, I missed that > the scsi_disk is not the parent of the gendisk, so this patch does > nothing to delay scsi_disk_release. What I think is the real fix is > to make the devt properly reference counted and prevent > ida_remove(&sd_index_ida, sdkp->index); from being called until all > objects derived from that allocation are done with it. So, here's an RFC along these lines (only compile tested). This approach provides a generic way to coordinate the lifetime of the bdi name versus the devt allocated by the block device driver.
Attachment:
patch-v3
Description: Binary data