• P
    io_uring: cancel reqs shouldn't kill overflow list · 5e4b649f
    Pavel Begunkov 提交于
    stable inclusion
    from stable-5.10.4
    commit b2ec2b12a45009e1801ea7b60bc644628d4ddee2
    bugzilla: 46903
    
    --------------------------------
    
    [ Upstream commit cda286f0 ]
    
    io_uring_cancel_task_requests() doesn't imply that the ring is going
    away, it may continue to work well after that. The problem is that it
    sets ->cq_overflow_flushed effectively disabling the CQ overflow feature
    
    Split setting cq_overflow_flushed from flush, and do the first one only
    on exit. It's ok in terms of cancellations because there is a
    io_uring->in_idle check in __io_cqring_fill_event().
    
    It also fixes a race with setting ->cq_overflow_flushed in
    io_uring_cancel_task_requests, whuch's is not atomic and a part of a
    bitmask with other flags. Though, the only other flag that's not set
    during init is drain_next, so it's not as bad for sane architectures.
    Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
    Fixes: 0f212204 ("io_uring: don't rely on weak ->files references")
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NChen Jun <chenjun102@huawei.com>
    Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
    5e4b649f
io_uring.c 235.8 KB