On Thu 26-11-20 14:04:21, Christoph Hellwig wrote: > Instead of having two structures that represent each block device with > different life time rules, merge them into a single one. This also > greatly simplifies the reference counting rules, as we can use the inode > reference count as the main reference count for the new struct > block_device, with the device model reference front ending it for device > model interaction. The percpu refcount in struct hd_struct is entirely > gone given that struct block_device must be opened and thus valid for > the duration of the I/O. The percpu refcount is long gone after the series refactoring... > @@ -939,13 +910,13 @@ void blk_request_module(dev_t devt) > */ > struct block_device *bdget_disk(struct gendisk *disk, int partno) > { > - struct hd_struct *part; > struct block_device *bdev = NULL; > > - part = disk_get_part(disk, partno); > - if (part) > - bdev = bdget_part(part); > - disk_put_part(part); > + rcu_read_lock(); > + bdev = __disk_get_part(disk, partno); > + if (bdev) > + bdgrab(bdev); Again I think you need to accommodate for bdgrab() returning NULL here when we race with partition destruction... > + rcu_read_unlock(); > > return bdev; > } Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel