On Thu, Jul 14, 2022 at 06:23:12AM -0700, Christoph Hellwig wrote: > On Thu, Jul 14, 2022 at 09:20:24PM +0800, Ming Lei wrote: > > The problem is that you moved part of blk_cleanup_queue() into > > del_gendisk(). > > > > Here, the issue Jens reproduced is that we don't add disk yet, so won't > > call del_gendisk(). The queue & disk is allocated & initialized correctly. > > > > Then how to do the part done by original blk_cleanup_queue() without calling > > blk_mq_destroy_queue()? > > What do you need to clean up? put_disk is supposed to eventually > clean up everything allocated by blk_alloc_disk through disk_release. > If it fails to cleanup anything that is a bug we need to fix in the core > as it will affect all drivers. The part to be cleaned up is nothing to do with disk: if (queue_is_mq(q)) blk_mq_exit_queue(q); ->exit_hctx() is called in blk_mq_exit_queue(). Without calling blk_mq_destroy_queue, I don't see other way to address this issue, or suggestions? Thanks, Ming