OSDN Git Service

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>
Thu, 1 Jul 2021 19:40:17 +0000 (13:40 -0600)
commit9011bf9a13e3b5710c3cfc330da829ee25b5a029
treeadf37b6e077ca6e39a75257f4854a257087962d0
parentc288d9cd710433e5991d58a0764c4d08a933b871
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