• Ming Lei's avatar
    ublk: replace monitor with cancelable uring_cmd · 216c8f5e
    Ming Lei authored
    
    
    Monitor work actually introduces one extra context for handling abort, this
    way is easy to cause race, and also introduce extra delay when handling
    aborting.
    
    Now we start to support cancelable uring_cmd, so use it instead:
    
    1) this cancel callback is either run from the uring cmd submission task
    context or called after the io_uring context is exit, so the callback is
    run exclusively with ublk_ch_uring_cmd() and __ublk_rq_task_work().
    
    2) the previous patch freezes request queue when calling ublk_abort_queue(),
    which is now completely exclusive with ublk_queue_rq() and
    ublk_ch_uring_cmd()/__ublk_rq_task_work().
    
    3) in timeout handler, if all IOs are in-flight, then all uring commands
    are completed, uring command canceling can't help us to provide forward
    progress any more, so call ublk_abort_requests() in timeout handler.
    
    This way simplifies aborting queue, and is helpful for adding new feature,
    such as, relax the limit of using single task for handling one queue.
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20231009093324.957829-7-ming.lei@redhat.com
    
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    216c8f5e
ublk_drv.c 74 KB