On Tue, May 24, 2022 at 10:33:25AM +0200, Christoph Hellwig wrote: > The block debugfs files are created in blk_register_queue, which is > called by add_disk and use a naming scheme based on the disk_name. > After del_gendisk returns that name can be reused and thus we must not > leave these debugfs files around, otherwise the kernel is unhappy > and spews messages like: > > Directory XXXXX with parent 'block' already present! > > and the newly created devices will not have working debugfs files. > > Move the unregistration to blk_unregister_queue instead (which matches > the sysfs unregistration) to make sure the debugfs life time rules match > those of the disk name. Not look into details yet, but as one blk-mq debugfs user, I don't like the idea, since I often see io hang issue when calling blk_mq_freeze_queue_wait(), and blk-mq debugfs is very helpful for investigating this kind of issue. But now blk-mq debugfs is gone with this patch __before__ draining IO in del_gendisk, and it becomes not useful as before. Thanks, Ming