diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c index 97523ccc7a71..433c003a83e5 100644 --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -655,9 +655,15 @@ static void io_worker_handle_work(struct io_wq_acct *acct, next_hashed = wq_next_work(work); - if (do_kill && - (work_flags & IO_WQ_WORK_UNBOUND)) + /* + * io_wq_exit_workers() signals us once, so that we + * don't sleep for ever. If that was before this work + * became the current one, the signal is gone. + */ + if (do_kill && (work_flags & IO_WQ_WORK_UNBOUND)) atomic_or(IO_WQ_WORK_CANCEL, &work->flags); + else if (do_kill) + set_notify_signal(current); req = container_of(work, struct io_kiocb, work); kcov_remote_start_common(req->ctx->kcov_handle); io_wq_submit_work(work);