From f6a03bde232e4d0c53c6f3ce3422af37bf34cce7 Mon Sep 17 00:00:00 2001 From: Roman Penyaev Date: Mon, 27 May 2019 21:05:10 +0200 Subject: queue: always fill in sq->array on io_uring_submit() io_uring_submit() is a last commit point when a caller has to be sure that all prepared sqes eventually lands to the kernel. If SQ thread is running it is quite possible that khead != ktail, thus charging of sq->array is skipped, which leads to IO hang. Nasty hang is well reproduced when submitter and completion harverster are different threads. Signed-off-by: Roman Penyaev Signed-off-by: Jens Axboe --- src/queue.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/queue.c b/src/queue.c index eec26c9..d10fbaf 100644 --- a/src/queue.c +++ b/src/queue.c @@ -85,17 +85,6 @@ int io_uring_submit(struct io_uring *ring) unsigned ktail, ktail_next, submitted, to_submit; int ret; - /* - * If we have pending IO in the kring, submit it first. We need a - * read barrier here to match the kernels store barrier when updating - * the SQ head. - */ - read_barrier(); - if (*sq->khead != *sq->ktail) { - submitted = *sq->kring_entries; - goto submit; - } - if (sq->sqe_head == sq->sqe_tail) return 0; @@ -135,7 +124,6 @@ int io_uring_submit(struct io_uring *ring) write_barrier(); } -submit: if (sq_ring_needs_enter(ring)) { unsigned flags = 0; -- cgit