io-wq: provide an io_wq_put_and_exit() helper
authorJens Axboe <axboe@kernel.dk>
Fri, 26 Feb 2021 20:48:19 +0000 (13:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 1 Mar 2021 21:56:15 +0000 (14:56 -0700)
commit2aa3fa29a64027333fd067f5a7839fe8244d58d3
tree106ef40e59a06b577527d06dc874b819e2f55d67
parent4c136eabf8838061716a95e3a20bc4a4bfc20328
io-wq: provide an io_wq_put_and_exit() helper

If we put the io-wq from io_uring, we really want it to exit. Provide
a helper that does that for us. Couple that with not having the manager
hold a reference to the 'wq' and the normal SQPOLL exit will tear down
the io-wq context appropriate.

On the io-wq side, our wq context is per task, so only the task itself
is manipulating ->manager and hence it's safe to check and clear without
any extra locking. We just need to ensure that the manager task stays
around, in case it exits.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c
fs/io-wq.h
fs/io_uring.c