@@ -512,6 +512,8 @@ static void __io_commit_cqring(struct io_ring_ctx *ctx)
{
struct io_rings *rings = ctx->rings;
+ lockdep_assert_held(&ctx->completion_lock);
+
if (ctx->cached_cq_tail != READ_ONCE(rings->cq.tail)) {
/* order cqe stores with ring update */
smp_store_release(&rings->cq.tail, ctx->cached_cq_tail);
@@ -841,7 +843,9 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
}
}
+ spin_lock_irq(&ctx->completion_lock);
io_commit_cqring(ctx);
+ spin_unlock_irq(&ctx->completion_lock);
io_free_req_many(ctx, reqs, &to_free);
}