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 17:10:30 +0000 (10:10 -0700)
commit8046335cf37b7a6cbbd4d0c23caf200d75b6d64b
treed2c76b9b697d21c6e2d6f563baeae71499793938
parentb3efbf955b14a2c6447741dcb8ede65cee4283c7
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