io_uring: fix stuck fallback reqs
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 30 Jun 2021 20:54:03 +0000 (21:54 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Jun 2021 21:24:39 +0000 (15:24 -0600)
commit8a380cb46baed91cb59159deb34355e2cb90c412
tree3c702bd91bbbeabb567d237ee6c3e1559c58b26d
parente149bd742b2db6a63fc078b1ea6843dc9b22678d
io_uring: fix stuck fallback reqs

When task_work_add() fails, we use ->exit_task_work to queue the work.
That will be run only in the cancellation path, which happens either
when the ctx is dying or one of tasks with inflight requests is exiting
or executing. There is a good chance that such a request would just get
stuck in the list potentially hodling a file, all io_uring rsrc
recycling or some other resources. Nothing terrible, it'll go away at
some point, but we don't want to lock them up for longer than needed.

Replace that hand made ->exit_task_work with delayed_work + llist
inspired by fput_many().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c