Skip to content
Commit 500f9fba authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring: fix potential hang with polled IO



If a request issue ends up being punted to async context to avoid
blocking, we can get into a situation where the original application
enters the poll loop for that very request before it has been issued.
This should not be an issue, except that the polling will hold the
io_uring uring_ctx mutex for the duration of the poll. When the async
worker has actually issued the request, it needs to acquire this mutex
to add the request to the poll issued list. Since the application
polling is already holding this mutex, the workqueue sleeps on the
mutex forever, and the application thus never gets a chance to poll for
the very request it was interested in.

Fix this by ensuring that the polling drops the uring_ctx occasionally
if it's not making any progress.

Reported-by: default avatarJeffrey M. Birnbaum <jmbnyc@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent d1abaeb3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment