]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
io_uring: transform ret == 0 for poll cancelation completions
authorJens Axboe <axboe@kernel.dk>
Tue, 23 Feb 2021 15:19:33 +0000 (08:19 -0700)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Apr 2021 23:41:58 +0000 (17:41 -0600)
We can set canceled == true and complete out-of-line, ensure that we catch
that and correctly return -ECANCELED if the poll operation got canceled.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 13d087ebe057425360e1ff82a0b7f0afa84850c0..962a3580c49fdf7ca20db7cf644aa1c019966dfe 100644 (file)
@@ -4955,6 +4955,9 @@ static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int error)
 {
        struct io_ring_ctx *ctx = req->ctx;
 
+       if (!error && req->poll.canceled)
+               error = -ECANCELED;
+
        io_poll_remove_double(req);
        req->poll.done = true;
        io_cqring_fill_event(req, error ? error : mangle_poll(mask));