Re: [PATCH] io_uring/cancel: don't spin on local work the task can't run

From: Jens Axboe

Date: Fri Oct 09 2026 - 10:44:06 EST



On Thu, 08 Oct 2026 15:16:02 -0400, Cen Zhang (Microsoft) wrote:
> io_uring_cancel_generic() refuses to sleep while any ring on the exiting
> task's tctx has local work pending. It assumes the task is that ring's
> submitter and that the next io_uring_try_cancel_requests() pass will run
> the work. This does not hold for a ring that was still
> IORING_SETUP_R_DISABLED when the task got its tctx node from
> io_uring_create() or io_ringfd_register(). The submitter is set later by
> IORING_REGISTER_ENABLE_RINGS, possibly from another task, and only the
> submitter may run local work on an IORING_SETUP_DEFER_TASKRUN ring. To
> the exiting task the work stays pending forever, the loop never reaches
> schedule(), and the task trips the WARN_ON_ONCE() once and then spins in
> do_exit().
>
> [...]

Applied, thanks!

[1/1] io_uring/cancel: don't spin on local work the task can't run
commit: fddcf4c5321b3ea5f72166c3fd36a9d1c34f80c7

Best regards,
--
Jens Axboe