The second check in io_run_task_work() is there only for SQPOLL, for which we use TWA_NONE. Remove the check and hand code SQPOLL specific task_work running where it makes sense. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index ea7b0c71ca8b..6397348748ad 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2793,9 +2793,7 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx) static inline bool io_run_task_work(void) { - struct io_uring_task *tctx = current->io_uring; - - if (test_thread_flag(TIF_NOTIFY_SIGNAL) || (tctx && tctx->task_running)) { + if (test_thread_flag(TIF_NOTIFY_SIGNAL)) { __set_current_state(TASK_RUNNING); clear_notify_signal(); io_uring_task_work_run(); @@ -10382,6 +10380,10 @@ static __cold void io_uring_cancel_generic(bool cancel_all, prepare_to_wait(&tctx->wait, &wait, TASK_INTERRUPTIBLE); io_run_task_work(); + if (tctx->task_running) { + __set_current_state(TASK_RUNNING); + io_uring_task_work_run(); + } io_uring_drop_tctx_refs(current); /* -- 2.36.0