Hi, 在 2025/07/31 9:28, Hou Tao 写道:
cc +linux-block The disk->queue_kobj is initialized in add_disk() and is uninitialized in del_disk(). And it seems that blk_unregister_queue() in del_disk() doesn't uninitialize the queue_kobj completely, because it doesn't expect the queue_kobj will be added again. I think the right place to fix the problem is blk_unregister_queue(). How about just memset the queue_kobj as zero after deleting the queue_kobj in blk_unregister_queue() ?
I think it's better to move kobject_init to allocate disk: 1) alloc disk, kobject_init 2) register q, kobject_add 3) unregister q, kobject_del 4) free disk, kobject_put With this, it's safe to add the kobject again. Thanks, Kuai