On Wed, Feb 08, 2023 at 04:12:31PM +0100, Christoph Hellwig wrote: > On Wed, Feb 08, 2023 at 03:38:40PM +0800, Ming Lei wrote: > > > This now can cause a case where disk_release is called on a disk > > > that hasn't been added. That's mostly harmless, except for a case > > > in blk_throttl_exit that now needs to check for a NULL ->td pointer. > > > > With this way, blkcg_init_disk() could be called before q->root_blkg > > is released in disk unbind & rebind use case, then memory leak? > > q->root_blkg is now disk->root_blkg. So in an unind and rebind case > a different disk will be involved. OK. Another thing is that blkcg_init_disk() and blkcg_exit_disk() becomes asymmetrical with this patch. So alloc_disk() & add_disk(), del_disk() & put_disk() have to be done together. If it may be documented, this patch looks fine. Thanks, Ming