From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Josef Bacik <josef@toxicpanda.com>,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 7.2 48/88] io_uring/wait: no early -ETIME if min_wait finds work
Date: Wed, 28 Oct 2026 17:59:56 +0100 [thread overview]
Message-ID: <20261028165943.245015581@linuxfoundation.org> (raw)
In-Reply-To: <20261028165942.107695352@linuxfoundation.org>
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
Commit 83cce67298ab1f4d2e9205a49f56975475cdb154 upstream.
When the min wait time is over and there is work to run, which for
DEFER_TASKRUN includes task_work that was queued lazily and didn't wake
the waiter, io_cqring_min_timer_wakeup() ends the wait via
io_cqring_timer_wakeup(). That flags it as timed out. io_cqring_wait()
runs the work, leaves the loop, and returns 0 if the CQ ring holds
something.
Running task_work doesn't have to result in a CQE, though. A poll wake up
can turn out to be spurious, for instance if somebody else has read the
data by the time the request is retried. The application then gets -ETIME
once the min wait time has passed, no matter how far away the timeout it
asked for is.
Wake the task without declaring a timeout. From now on a single CQE
satisfies the wait, like in the case where the timer is switched over to
the normal timeout. If running the work doesn't post one, the loop in
io_cqring_wait() goes back to sleep with the normal timeout.
Fixes: 1100c4a2656d ("io_uring: add support for batch wait timeout")
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261015-b4-io-uring-fixes-v1-32-c1556f5d7bf5@toxicpanda.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
io_uring/wait.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/io_uring/wait.c
+++ b/io_uring/wait.c
@@ -77,9 +77,16 @@ static enum hrtimer_restart io_cqring_mi
if (iowq->timeout == KTIME_MAX ||
ktime_compare(iowq->min_timeout, iowq->timeout) >= 0)
goto out_wake;
- /* work we may need to run, wake function will see if we need to wake */
- if (io_has_work(ctx))
- goto out_wake;
+ /*
+ * Work we need to run. It isn't known if that is going to post a CQE,
+ * so this isn't a timeout. Carry on with the normal one if it doesn't.
+ */
+ if (io_has_work(ctx)) {
+ iowq->min_timeout = 0;
+ iowq->cq_tail = iowq->cq_min_tail + 1;
+ wake_up_process(iowq->wq.private);
+ return HRTIMER_NORESTART;
+ }
/* got events since we started waiting, min timeout is done */
scoped_guard(rcu) {
struct io_rings *rings = io_get_rings(ctx);
next prev parent reply other threads:[~2026-10-28 17:07 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 16:59 [PATCH 7.2 00/88] 7.2.14-rc1 review Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 01/88] sched_ext: Wait for SCX_OPSS_DISPATCHING before moving tasks off DSQs Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 02/88] ntfs: fix race between fallocate and mmap reads Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 03/88] ntfs: take invalidate_lock in ntfs_filemap_page_mkwrite() Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 04/88] mm/damon/core: error damos_commit_quota_goal() for zero target_value Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 05/88] sched/fair: Avoid overflow in place_entity() Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 06/88] Bluetooth: L2CAP: refuse __l2cap_chan_add if chan already has conn Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 07/88] tools/dma: fix building with O= Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 08/88] tracing: Hold trace_types_lock when updating modules in persistent instances Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 09/88] tracing: Hold trace_types_lock when resetting last boot data from readers Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 10/88] tracing: Reject incomplete event filter expressions Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 11/88] tracing: Save the event file instead of the compatible histogram Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 12/88] tracing: Unregister field variable histograms when the command fails Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 13/88] tracing: Fix 64-bit and signed histogram fields on 32-bit kernels Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 14/88] tracing/histograms: Verify event_call identity when updating synth_event refcount Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 15/88] tracing/syscalls: Use copy_from_user for the faultable syscall buffer Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 16/88] io-wq: order the exit bit against worker creation task work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 17/88] io_uring/waitid: own the request before clearing ->head Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 18/88] io_uring/cmd: dont leave list poison in ->hash_node Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 19/88] io_uring/wait: dont spin on a stuck overflow list Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 20/88] io_uring/io-wq: dont lose the signal that ends work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 21/88] io_uring/io-wq: dont hide a link from cancellations Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 22/88] io_uring: dont flood a cancelling task with task_work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 23/88] io_uring: dont lose the DEFER_TASKRUN wake up Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 24/88] io_uring/cancel: rearm local work wake up before sleep Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 25/88] io_uring/mpscq: disable preemption while pushing Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 26/88] io_uring/io-wq: dont go to sleep on pending work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 27/88] io_uring/io-wq: dont strand work when a worker exits Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 28/88] io_uring/io-wq: dont exit with a creation pending Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 29/88] io_uring/io-wq: let cancel find picked up hashed work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 30/88] io_uring/poll: dont lose a cancel as io-wq arms poll Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 31/88] io_uring: dont lose a cancel as io-wq parks a request Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 32/88] io_uring/cancel: dont forget that the work was running Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 33/88] io_uring/cancel: recognize "no timeout" on 32-bit Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 34/88] io_uring/cancel: let CANCEL_ALL find parked requests Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 35/88] io_uring: wake ring pollers for local task_work Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 36/88] io_uring/wait: look at all CQ waiters on wake up Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 37/88] io_uring/poll: drop stale double poll entry on rearm Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 38/88] io_uring/futex: allocate private hash before waiting Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 39/88] io_uring: drop the CQE cache if a refill fails Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 40/88] io_uring: dont split 128b SQEs at the SQPOLL cap Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 41/88] io_uring/register: dont wrap 32b CQEs when resizing Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 42/88] io_uring/register: handle index wrap " Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 43/88] io_uring/register: keep 128b SQEs intact on resize Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 44/88] io_uring/fdinfo: fix CQE dump of CQE32 rings Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 45/88] io_uring/timeout: dont skip over reached sequences Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 46/88] io_uring/timeout: keep repeat count on multishot update Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 47/88] io_uring/timeout: use the right clock for ABS updates Greg Kroah-Hartman
2026-10-28 16:59 ` Greg Kroah-Hartman [this message]
2026-10-28 16:59 ` [PATCH 7.2 49/88] io_uring/napi: make stale entries time out after 60s Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 50/88] io_uring/napi: dont busy poll past an expired timeout Greg Kroah-Hartman
2026-10-28 16:59 ` [PATCH 7.2 51/88] io_uring/zcrx: fix buffer offsets in areas above 4GB Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 52/88] io_uring/kbuf: handle index wrap in last buffer check Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 53/88] io_uring/sqpoll: let the thread sleep on disabled rings Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 54/88] io_uring/openclose: keep the lock in io_pipe_fixed() Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 55/88] io_uring: dont pass restart error codes to userspace Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 56/88] io_uring/net: dont retry recv on uncommitted buffers Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 57/88] io_uring/timeout: no ABS update of multishot timeouts Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 58/88] io_uring/timeout: dont end a linked timeout with 1 Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 59/88] io_uring: look up the file before queueing to io-wq Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 60/88] io_uring/poll: avoid retry wakeup loss when dropping ownership Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 61/88] io_uring/timeout: dont put a sequence target behind the last flush Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 62/88] io_uring/timeout: dont flush with the sequence " Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 63/88] io_uring/timeout: dont lose a cancel as io-wq arms a timeout Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 64/88] io_uring/poll: dont loop on HUP with multiple references Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 65/88] io_uring/net: keep recv buffer select length within MAX_RW_COUNT Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 66/88] io_uring/wait: wake real-time waiters from hard interrupt context Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 67/88] io_uring/waitid: prevent cancel reference wrap Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 68/88] io_uring: end the drain when the drain request completes Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 69/88] io_uring: keep the drain active when a deferred drain request is started Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 70/88] keys: Avoid the owner account dereference in named keyring lookup Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 71/88] keys: Check the authorization payload in process keyring searches Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 72/88] keys: Protect the type name while describing a key Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 73/88] keys: make keyring indexes independent of kernel addresses Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 74/88] keys: Protect the read method check against type removal Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 75/88] KEYS: Fix key_reject_and_link() race with keyring restriction Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 76/88] KEYS: trusted: Fix blob allocation size in tpm2_key_decode() Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 77/88] keys/trusted_keys: return immediately after TPM unseal failure Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 78/88] asymmetric_keys: reject trust keys without IDs Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 79/88] ftrace: Initialize modname and offset in print_rec() Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 80/88] coredump: hold RCU while releasing parked threads Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 81/88] signal: only SIGKILL and the freezers interrupt a coredumping task Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 82/88] signal: dont retarget shared signals in a dying thread group Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 83/88] ptrace: refuse to change the signal mask of a user worker Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 84/88] fork: release the files of a failed fork after sched_cancel_fork() Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 85/88] exit: hang up the tty before closing the files Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 86/88] coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 87/88] pid_namespace: prevent TIF_NOTIFY_SIGNAL from interrupting the reaper Greg Kroah-Hartman
2026-10-28 17:00 ` [PATCH 7.2 88/88] signal: allow taks to temporarily block TIF_NOTIFY_SIGNAL Greg Kroah-Hartman
2026-10-28 19:39 ` [PATCH 7.2 00/88] 7.2.14-rc1 review Brett A C Sheffield
2026-10-29 4:09 ` Peter Schneider
2026-10-29 10:08 ` Pavel Machek
2026-10-29 13:49 ` Miguel Ojeda
2026-10-29 14:17 ` Ron Economos
2026-10-29 14:43 ` SJ Park
2026-10-29 15:19 ` Shuah Khan
2026-10-29 15:57 ` Barry K. Nathan
2026-10-29 16:56 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028165943.245015581@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.