OSDN Git Service

io-wq: improve manager/worker handling over exec
authorJens Axboe <axboe@kernel.dk>
Thu, 25 Feb 2021 17:17:09 +0000 (10:17 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 25 Feb 2021 17:17:09 +0000 (10:17 -0700)
commit4fb6ac326204b3ab81e6e7a914ccd44d957c1d2c
tree0462f8ea106520c3426001230a5f858d229bf9ec
parenteb85890b29e4d7ae1accdcfba35ed8b16ba9fb97
io-wq: improve manager/worker handling over exec

exec will cancel any threads, including the ones that io-wq is using. This
isn't a problem, in fact we'd prefer it to be that way since it means we
know that any async work cancels naturally without having to handle it
proactively.

But it does mean that we need to setup a new manager, as the manager and
workers are gone. Handle this at queue time, and cancel work if we fail.
Since the manager can go away without us noticing, ensure that the manager
itself holds a reference to the 'wq' as well. Rename io_wq_destroy() to
io_wq_put() to reflect that.

In the future we can now simplify exec cancelation handling, for now just
leave it the same.

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