From: Pavel Begunkov Date: Sat, 17 May 2025 12:27:37 +0000 (+0100) Subject: io_uring: fix overflow resched cqe reordering X-Git-Tag: v6.14.9~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4e689932af3db304c7444886459470121fa36d4;p=thirdparty%2Fkernel%2Fstable.git io_uring: fix overflow resched cqe reordering [ Upstream commit a7d755ed9ce9738af3db602eb29d32774a180bc7 ] Leaving the CQ critical section in the middle of a overflow flushing can cause cqe reordering since the cache cq pointers are reset and any new cqe emitters that might get called in between are not going to be forced into io_cqe_cache_refill(). Fixes: eac2ca2d682f9 ("io_uring: check if we need to reschedule during overflow flush") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/90ba817f1a458f091f355f407de1c911d2b93bbf.1747483784.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 52c9fa6c06450..1f60883d78c64 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -632,6 +632,7 @@ static void __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool dying) * to care for a non-real case. */ if (need_resched()) { + ctx->cqe_sentinel = ctx->cqe_cached; io_cq_unlock_post(ctx); mutex_unlock(&ctx->uring_lock); cond_resched();