]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - fs/io_uring.c
io_uring: fix work_exit sqpoll cancellations
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 25 Apr 2021 22:34:45 +0000 (23:34 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Apr 2021 12:59:25 +0000 (06:59 -0600)
commit28090c133869b461c5366195a856d73469ab87d9
tree5da5a4787a2f03207d74cf1f72d9ed4eb903b774
parent615cee49b3ca55f54d527f7a6a7d0fd4fd6fef6b
io_uring: fix work_exit sqpoll cancellations

After closing an SQPOLL ring, io_ring_exit_work() kicks in and starts
doing cancellations via io_uring_try_cancel_requests(). It will go
through io_uring_try_cancel_iowq(), which uses ctx->tctx_list, but as
SQPOLL task don't have a ctx note, its io-wq won't be reachable and so
is left not cancelled.

It will eventually cancelled when one of the tasks dies, but if a thread
group survives for long and changes rings, it will spawn lots of
unreclaimed resources and live locked works.

Cancel SQPOLL task's io-wq separately in io_ring_exit_work().

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