• Jens Axboe's avatar
    io_uring: recycle provided before arming poll · abdad709
    Jens Axboe authored
    We currently have a race where we recycle the selected buffer if poll
    returns IO_APOLL_OK. But that's too late, as the poll could already be
    triggering or have triggered. If that race happens, then we're putting a
    buffer that's already being used.
    
    Fix this by recycling before we arm poll. This does mean that we'll
    sometimes almost instantly re-select the buffer, but it's rare enough in
    testing that it should not pose a performance issue.
    
    Fixes: b1c62645 ("io_uring: recycle provided buffers if request goes async")
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    abdad709
io_uring.c 295 KB