io_uring: clean poll tw PF_EXITING handling
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 15 Apr 2022 21:08:20 +0000 (22:08 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Apr 2022 00:02:49 +0000 (18:02 -0600)
When we meet PF_EXITING in io_poll_check_events(), don't overcomplicate
the code with io_poll_mark_cancelled() but just return -ECANCELED and
the callers will deal with the rest.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/f0cc981af82a5b193658f8f44397eeb3bf838b7b.1650056133.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index fc47f8fdae7cf87ef49c8803eb20c67c7a523ae0..76d51c6e3ab9c282541a988f42e6128a01abd5fc 100644 (file)
@@ -5902,7 +5902,7 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)
 
        /* req->task == current here, checking PF_EXITING is safe */
        if (unlikely(req->task->flags & PF_EXITING))
-               io_poll_mark_cancelled(req);
+               return -ECANCELED;
 
        do {
                v = atomic_read(&req->poll_refs);