On 2020/2/7 21:04, Ming Lei wrote:
But blk_mq_debugfs_register() in your step 3 for adding loop still may fail, that is why I suggest to consider to move blk_mq_debugfs_register() into blk_unregister_queue().
I think therer might be a problem. static void loop_remove(struct loop_device *lo) { del_gendisk(lo->lo_disk); blk_cleanup_queue(lo->lo_queue); blk_mq_free_tag_set(&lo->tag_set); put_disk(lo->lo_disk); kfree(lo); } blk_unregister_queue() is called in del_gendisk(), while blk_cleanup_queue() remove other files or dirs. And blk_mq_debugfs_register() should be called at last since it will remove everything. Thanks Yu Kuai