• Jackie Liu's avatar
    io_uring: fix an issue when IOSQE_IO_LINK is inserted into defer list · a982eeb0
    Jackie Liu authored
    This patch may fix two issues:
    
    First, when IOSQE_IO_DRAIN set, the next IOs need to be inserted into
    defer list to delay execution, but link io will be actively scheduled to
    run by calling io_queue_sqe.
    
    Second, when multiple LINK_IOs are inserted together with defer_list,
    the LINK_IO is no longer keep order.
    
       |-------------|
       |   LINK_IO   |      ----> insert to defer_list  -----------
       |-------------|                                            |
       |   LINK_IO   |      ----> insert to defer_list  ----------|
       |-------------|                                            |
       |   LINK_IO   |      ----> insert to defer_list  ----------|
       |-------------|                                            |
       |   NORMAL_IO |      ----> insert to defer_list  ----------|
       |-------------|                                            |
                                                                  |
                                  queue_work at same time   <-----|
    
    Fixes: 9e645e11 ("io_uring: add support for sqe links")
    Signed-off-by: default avatarJackie Liu <liuyun01@kylinos.cn>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    a982eeb0
io_uring.c 83 KB