Hi,
在 2022/10/18 16:26, Christoph Hellwig 写道:
On Tue, Oct 18, 2022 at 04:00:36PM +0800, Yu Kuai wrote:
1) in del_gendisk: (add a new api kobject_put_and_test)
if (kobject_put_and_test(bd_holder_dir/slave_dir))
bd_holder_dir/slave_dir = NULL;
2) in bd_link_disk_holder, get bd_holder_dir first:
if (!kobject_get_unless_zero(bd_holder_dir))
return -ENODEV;
...
bd_find_holder_disk()
Do you think this is ok?
I'm not quite sure what the point is.
Because I'm afraid bd_link_disk_holder() just take bdev as paramater,
(bdev is got by blkdev_get_by_dev), but there is no guarantee that disk
can't be remove(del_gendisk is called for the disk that bdev belongs
to).
Thus I think the interface bd_link_disk_holder() itself is problematic,
current caller drbd/md/dm might all be affected.
Thanks,
Kuai
If you want to really clean this up a good thing would be to remove
the delayed holder registration entirely and just do them in dm
after add_disk and remove them before del_gendisk. I've been wanting
to do that a few times but always gave up due to the mess in dm.
.