• M
    ublk_drv: fix request queue leak · cebbe577
    Ming Lei 提交于
    Call blk_cleanup_queue() in release code path for fixing request
    queue leak.
    
    Also for-5.20/block has cleaned up blk_cleanup_queue(), which is
    basically merged to del_gendisk() if blk_mq_alloc_disk() is used
    for allocating disk and queue.
    
    However, ublk may not add disk in case of starting device failure, then
    del_gendisk() won't be called when removing ublk device, so blk_mq_exit_queue
    will not be callsed, and it can be bit hard to deal with this kind of
    merge conflict.
    
    Turns out ublk's queue/disk use model is very similar with scsi, so switch
    to scsi's model by allocating disk and queue independently, then it can be
    quite easy to handle v5.20 merge conflict by replacing blk_cleanup_queue
    with blk_mq_destroy_queue.
    Reported-by: NJens Axboe <axboe@kernel.dk>
    Fixes: 71f28f31 ("ublk_drv: add io_uring based userspace block driver")
    Signed-off-by: NMing Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20220714103201.131648-1-ming.lei@redhat.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
    cebbe577
ublk_drv.c 37.0 KB