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

io-wq: wait for io_wq_create() to setup necessary workers



We currently have a race where if setup is really slow, we can be
calling io_wq_destroy() before we're done setting up. This will cause
the caller to get stuck waiting for the manager to set things up, but
the manager already exited.

Fix this by doing a sync setup of the manager. This also fixes the case
where if we failed creating workers, we'd also get stuck.

In practice this race window was really small, as we already wait for
the manager to start. Hence someone would have to call io_wq_destroy()
after the task has started, but before it started the first loop. The
reported test case forked tons of these, which is why it became an
issue.

Reported-by: default avatar <syzbot+0f1cc17f85154f400465@syzkaller.appspotmail.com>
Fixes: 771b53d0

 ("io-wq: small threadpool implementation for io_uring")
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent fba38c27
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