• Jens Axboe's avatar
    io_uring: fix CQ overflow condition · 74f464e9
    Jens Axboe authored
    This is a leftover from when the rings initially were not free flowing,
    and hence a test for tail + 1 == head would indicate full. Since we now
    let them wrap instead of mask them with the size, we need to check if
    they drift more than the ring size from each other.
    
    This fixes a case where we'd overwrite CQ ring entries, if the user
    failed to reap completions. Both cases would ultimately result in lost
    completions as the application violated the depth it asked for. The only
    difference is that before this fix we'd return invalid entries for the
    overflowed completions, instead of properly flagging it in the
    cq_ring->overflow variable.
    Reported-by: default avatarStefan Bühler <source@stbuehler.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    74f464e9
io_uring.c 69.8 KB