linux-yocto/io_uring
Ming Lei 704cced8ed io_uring: move local task_work in exit cancel loop
commit da579f05ef0faada3559e7faddf761c75cdf85e1 upstream.

With IORING_SETUP_DEFER_TASKRUN, task work is queued to ctx->work_llist
(local work) rather than the fallback list. During io_ring_exit_work(),
io_move_task_work_from_local() was called once before the cancel loop,
moving work from work_llist to fallback_llist.

However, task work can be added to work_llist during the cancel loop
itself. There are two cases:

1) io_kill_timeouts() is called from io_uring_try_cancel_requests() to
cancel pending timeouts, and it adds task work via io_req_queue_tw_complete()
for each cancelled timeout:

2) URING_CMD requests like ublk can be completed via
io_uring_cmd_complete_in_task() from ublk_queue_rq() during canceling,
given ublk request queue is only quiesced when canceling the 1st uring_cmd.

Since io_allowed_defer_tw_run() returns false in io_ring_exit_work()
(kworker != submitter_task), io_run_local_work() is never invoked,
and the work_llist entries are never processed. This causes
io_uring_try_cancel_requests() to loop indefinitely, resulting in
100% CPU usage in kworker threads.

Fix this by moving io_move_task_work_from_local() inside the cancel
loop, ensuring any work on work_llist is moved to fallback before
each cancel attempt.

Cc: stable@vger.kernel.org
Fixes: c0e0d6ba25 ("io_uring: add IORING_SETUP_DEFER_TASKRUN")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-01-23 11:21:13 +01:00
..
advise.c
advise.h
alloc_cache.c
alloc_cache.h
cancel.c io_uring: don't include filetable.h in io_uring.h 2025-09-08 13:20:46 -06:00
cancel.h
cmd_net.c io_uring/cmd_net: fix wrong argument types for skb_queue_splice() 2025-11-20 11:40:15 -07:00
epoll.c
epoll.h
eventfd.c
eventfd.h
fdinfo.c io_uring/sqpoll: switch away from getrusage() for CPU accounting 2025-10-22 10:51:20 -06:00
fdinfo.h
filetable.c io_uring: correct __must_hold annotation in io_install_fixed_file 2025-10-23 07:25:07 -06:00
filetable.h
fs.c
fs.h
futex.c io_uring: add async data clear/free helpers 2025-08-27 11:24:25 -06:00
futex.h
io_uring.c io_uring: move local task_work in exit cancel loop 2026-01-23 11:21:13 +01:00
io_uring.h for-6.18/io_uring-20250929 2025-10-02 09:56:23 -07:00
io-wq.c io_uring/io-wq: fix incorrect io_wq_for_each_worker() termination logic 2026-01-17 16:35:14 +01:00
io-wq.h
kbuf.c io_uring/kbuf: use READ_ONCE() for userspace-mapped memory 2025-12-18 14:03:36 +01:00
kbuf.h io-uring: move struct io_br_sel into io_uring_types.h 2025-08-24 11:41:12 -06:00
Kconfig
Makefile io_uring: introduce io_uring querying 2025-09-08 08:06:37 -06:00
memmap.c io_uring: fix types for region size calulation 2025-11-05 11:45:07 -07:00
memmap.h
mock_file.c
msg_ring.c io_uring/msg_ring: kill alloc_cache for io_kiocb allocations 2025-09-18 13:59:15 -06:00
msg_ring.h
napi.c
napi.h
net.c io_uring/net: ensure vectored buffer node import is tied to notification 2025-11-24 10:59:02 -07:00
net.h
nop.c io_uring/nop: add support for IORING_SETUP_CQE_MIXED 2025-08-27 11:24:15 -06:00
nop.h
notif.c for-6.18/io_uring-20250929 2025-10-02 09:56:23 -07:00
notif.h
opdef.c io_uring: uring_cmd: add multishot support 2025-08-24 11:41:12 -06:00
opdef.h
openclose.c io_uring: fix filename leak in __io_openat_prep() 2026-01-02 12:57:06 +01:00
openclose.h
poll.c io_uring/poll: correctly handle io_poll_add() return value on update 2026-01-02 12:57:06 +01:00
poll.h
query.c io_uring/query: return number of available queries 2025-11-10 14:59:35 -07:00
query.h io_uring: introduce io_uring querying 2025-09-08 08:06:37 -06:00
refs.h
register.c io_uring/zcrx: remove sync refill uapi 2025-11-03 08:55:58 -07:00
register.h
rsrc.c io_uring/rsrc: fix lost entries after cloned range 2026-01-02 12:57:30 +01:00
rsrc.h io_uring: export io_[un]account_mem 2025-07-16 16:23:28 -06:00
rw.c io_uring/rw: ensure allocated iovec gets cleared for early failure 2025-11-10 14:59:08 -07:00
rw.h
slist.h
splice.c io_uring: don't include filetable.h in io_uring.h 2025-09-08 13:20:46 -06:00
splice.h
sqpoll.c io_uring/sqpoll: be smarter on when to update the stime usage 2025-10-22 10:55:33 -06:00
sqpoll.h io_uring/sqpoll: switch away from getrusage() for CPU accounting 2025-10-22 10:51:20 -06:00
statx.c
statx.h
sync.c
sync.h
tctx.c
tctx.h
timeout.c io_uring: include dying ring in task_work "should cancel" state 2025-09-18 10:24:50 -06:00
timeout.h
truncate.c
truncate.h
uring_cmd.c for-6.18/io_uring-20250929 2025-10-02 09:56:23 -07:00
uring_cmd.h io_uring/cmd: remove struct io_uring_cmd_data 2025-07-18 12:34:56 -06:00
waitid.c io_uring: fix incorrect unlikely() usage in io_waitid_prep() 2025-10-20 09:22:09 -06:00
waitid.h
xattr.c
xattr.h
zcrx.c io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock 2025-12-18 14:02:56 +01:00
zcrx.h io_uring/zcrx: remove sync refill uapi 2025-11-03 08:55:58 -07:00