path: root/fs/io-wq.h
diff options
authorPavel Begunkov <>2021-05-23 15:48:39 +0100
committerJens Axboe <>2021-05-25 19:39:58 -0600
commit17a91051fe63b40ec651b80097c9fff5b093fdc5 (patch)
tree2ff23057d8bb5cbbed0b123eb9a8b3dd803c1586 /fs/io-wq.h
parentba5ef6dc8a827a904794210a227cdb94828e8ae7 (diff)
io_uring/io-wq: close io-wq full-stop gap
There is an old problem with io-wq cancellation where requests should be killed and are in io-wq but are not discoverable, e.g. in @next_hashed or @linked vars of io_worker_handle_work(). It adds some unreliability to individual request canellation, but also may potentially get __io_uring_cancel() stuck. For instance: 1) An __io_uring_cancel()'s cancellation round have not found any request but there are some as desribed. 2) __io_uring_cancel() goes to sleep 3) Then workers wake up and try to execute those hidden requests that happen to be unbound. As we already cancel all requests of io-wq there, set IO_WQ_BIT_EXIT in advance, so preventing 3) from executing unbound requests. The workers will initially break looping because of getting a signal as they are threads of the dying/exec()'ing user task. Cc: Signed-off-by: Pavel Begunkov <> Link: Signed-off-by: Jens Axboe <>
Diffstat (limited to 'fs/io-wq.h')
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/io-wq.h b/fs/io-wq.h
index 0e6d310999e8..af2df0680ee2 100644
--- a/fs/io-wq.h
+++ b/fs/io-wq.h
@@ -122,7 +122,7 @@ struct io_wq_data {
struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data);
-void io_wq_put(struct io_wq *wq);
+void io_wq_exit_start(struct io_wq *wq);
void io_wq_put_and_exit(struct io_wq *wq);
void io_wq_enqueue(struct io_wq *wq, struct io_wq_work *work);