Skip to contentSkip to conversation

io_uring: compare cached_cq_tail with cq.head in_io_uring_poll

PATCH In review yangerkun 2 participants 2 messages Sep 24, 2019

Subsystems (2)
lore
Share & tools
lore

yangerkun

author
#0 lore raw

PATCH 1/1 io_uring: compare cached_cq_tail with cq.head in_io_uring_poll

After 75b28af("io_uring: allocate the two rings together"), we compare sq.head with cached_cq_tail to determine does there any cq invalid. Actually, we should use cq.head.

Fixes 75b28af ("io_uring: allocate the two rings together")
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index 0dadbdbead0f..63cbefba1fb5 100644
@@ -3263,7 +3263,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
 	if (READ_ONCE(ctx->rings->sq.tail) - ctx->cached_sq_head !=
 	    ctx->rings->sq_ring_entries)
 		mask |= EPOLLOUT | EPOLLWRNORM;
-	if (READ_ONCE(ctx->rings->sq.head) != ctx->cached_cq_tail)
+	if (READ_ONCE(ctx->rings->cq.head) != ctx->cached_cq_tail)
 		mask |= EPOLLIN | EPOLLRDNORM;
 
 	return mask;
Signature · 1 line
2.17.2
maintainer
#1 lore raw
Quoted 3 lines · yangerkun

After 75b28af("io_uring: allocate the two rings together"), we compare sq.head with cached_cq_tail to determine does there any cq invalid. Actually, we should use cq.head.

Nice catch, applied. BTW, note for future submissions, this:

Quoted 1 line
Fixes 75b28af ("io_uring: allocate the two rings together")

sha should be 12 characters. I will fix it up in this one.

Signature · 1 line
Jens Axboe