Hello Christoph, On Tue, Oct 12, 2021 at 11:33:01AM +0200, Christoph Hellwig wrote: > > q->disk becomes invalid after the gendisk is removed. Work around this > by caching the dev_t for the tracepoints. The real fix would be to > properly tear down the I/O schedulers with the gendisk, but that is > a much more invasive change. Except for kyber, blkcg code refers q->disk too. Such as blkg_dev_name() used in showing blk cgroup files, see tg_print_limit(), but blkcg_exit_queue() is called in queue's release handler, so q->disk can be referred when reading blkcg file of cgroup fs from userspace after deleting gendisk. I think it is fine to move blkcg_exit_queue() into del_gendisk(), but bfq_exit_queue() is still run from queue's release handler, and bfq's blkcg policy is deactivated there. That said the referring in reading bfq's cgroup file still can come after deleting disk, especially kernel panic could be caused when q->disk is cleared between the check and calling to bdi_dev_name() in blkg_dev_name(). Thanks, Ming