• Xiaoguang Wang's avatar
    io_uring: fix __io_iopoll_check deadlock in io_sq_thread · c7849be9
    Xiaoguang Wang authored
    Since commit a3a0e43f ("io_uring: don't enter poll loop if we have
    CQEs pending"), if we already events pending, we won't enter poll loop.
    In case SETUP_IOPOLL and SETUP_SQPOLL are both enabled, if app has
    been terminated and don't reap pending events which are already in cq
    ring, and there are some reqs in poll_list, io_sq_thread will enter
    __io_iopoll_check(), and find pending events, then return, this loop
    will never have a chance to exit.
    
    I have seen this issue in fio stress tests, to fix this issue, let
    io_sq_thread call io_iopoll_getevents() with argument 'min' being zero,
    and remove __io_iopoll_check().
    
    Fixes: a3a0e43f ("io_uring: don't enter poll loop if we have CQEs pending")
    Signed-off-by: default avatarXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    c7849be9
io_uring.c 169 KB