]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commite0b47ca5bd6470b10e5df8a581df667ff1486cbd
tree5da5a4787a2f03207d74cf1f72d9ed4eb903b774
parent652b2e1ee8d0846720490e97d240114c2323c086
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