• Jens Axboe's avatar
    io_uring: fix race around poll update and poll triggering · b2e720ac
    Jens Axboe authored
    Joakim reports that in some conditions he sees a multishot poll request
    being canceled, and that it coincides with getting -EALREADY on
    modification. As part of the poll update procedure, there's a small window
    where the request is marked as canceled, and if this coincides with the
    event actually triggering, then we can get a spurious -ECANCELED and
    termination of the multishot request.
    
    Don't mark the poll request as being canceled for update. We also don't
    care if we race on removal unless it's a one-shot request, we can safely
    updated for either case.
    
    Fixes: b69de288 ("io_uring: allow events and user_data update of running poll requests")
    Reported-by: default avatarJoakim Hassila <joj@mac.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    b2e720ac
io_uring.c 245 KB