io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix accounting of dropped CQEs in backlog flush
@ 2019-11-09 14:20 Jens Axboe
  0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2019-11-09 14:20 UTC (permalink / raw)
  To: io-uring; +Cc: Pavel Begunkov

We really should increment the overflow count if we drop events from
the overflow backlog, even if we only do this from the path where
either the task or the ring is going way.

Fixes: c28f37817b7c ("io_uring: add support for backlogged CQ ring")
Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 321ccc38397c..f2769f5f9662 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -628,6 +628,9 @@ static void io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)
 			WRITE_ONCE(cqe->user_data, req->user_data);
 			WRITE_ONCE(cqe->res, req->result);
 			WRITE_ONCE(cqe->flags, 0);
+		} else {
+			WRITE_ONCE(ctx->rings->cq_overflow,
+				atomic_inc_return(&ctx->cached_cq_overflow));
 		}
 	}
 
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-09 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 14:20 [PATCH] io_uring: fix accounting of dropped CQEs in backlog flush Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).