Skip to content

Commit 5b03d2c

Browse files
committed
* 'master' of https://github.com/sohambagchi/liburing: smp_load_acquire(ring->cq.khead) in __io_uring_peek_cqe() for consistent dereferencing
2 parents 0272bfa + 81cb947 commit 5b03d2c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/include/liburing.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,12 @@ IOURINGINLINE int __io_uring_peek_cqe(struct io_uring *ring,
15761576

15771577
do {
15781578
unsigned tail = io_uring_smp_load_acquire(ring->cq.ktail);
1579-
unsigned head = *ring->cq.khead;
1579+
1580+
/**
1581+
* A load_acquire on the head prevents reordering with the
1582+
* cqe load below, ensuring that we see the correct cq entry.
1583+
*/
1584+
unsigned head = io_uring_smp_load_acquire(ring->cq.khead);
15801585

15811586
cqe = NULL;
15821587
available = tail - head;

0 commit comments

Comments
 (0)