]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: remove poll entry from list when canceling all
authorJens Axboe <axboe@kernel.dk>
Tue, 22 Mar 2022 01:03:24 +0000 (19:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 22 Mar 2022 01:03:24 +0000 (19:03 -0600)
commit08d4ce7824346838a57980086d01d3c170b80945
tree7f96500cac4217995f120dbc129f2ea2145a87bb
parentc88608a8b5ff04f54f76a503ec21711a6be416e2
io_uring: remove poll entry from list when canceling all

When the ring is exiting, as part of the shutdown, poll requests are
removed. But io_poll_remove_all() does not remove entries when finding
them, and since completions are done out-of-band, we can find and remove
the same entry multiple times.

We do guard the poll execution by poll ownership, but that does not
exclude us from reissuing a new one once the previous removal ownership
goes away.

This can race with poll execution as well, where we then end up seeing
req->apoll be NULL because a previous task_work requeue finished the
request.

Remove the poll entry when we find it and get ownership of it. This
prevents multiple invocations from finding it.

Fixes: e81427005683 ("io_uring: poll rework")
Reported-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c