On Thu, Nov 11, 2021 at 10:03:43AM +0800, Ming Lei wrote: > disk->fops->owner is grabbed in blkdev_get_no_open() after the disk > kobject refcount is increased. This way can't make sure that > disk->fops->owner is still alive since del_gendisk() still can move > on if the kobject refcount of disk is grabbed by open() and > disk->fops->open() isn't called yet. > > Fixes the issue by moving try_module_get() into blkdev_get_by_dev() > with ->open_mutex() held, then we can drain the in-progress open() > in del_gendisk(). Meantime new open() won't succeed because disk > becomes not alive. > > This way is reasonable because blkdev_get_no_open() needn't to touch > disk->fops or defined callbacks. > > Cc: Christoph Hellwig <hch@xxxxxx> > Cc: czhong@xxxxxxxxxx > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> > --- > V2: > - remove comment as suggested by Christoph > - improve commit log a bit Hi Jens, Ping... Thanks, Ming