Skip to contentSkip to conversation

io_uring/rw: keep CQE flags on iopoll requests when adding kbuf flags

PATCH Applied Caleb Sander Mateos 3 participants 3 messages Sep 2 – Sep 10 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring/rw: keep CQE flags on iopoll requests when adding kbuf flags

io_do_iopoll() assigns the result of io_put_kbuf() to the request's CQE flags upon completion. This overwrites any CQE flags that may have been set by the opcode-specific layer. (For example, if __io_uring_cmd_done() had set IORING_CQE_F_32, it would be cleared.) Switch the = to an |= so the kbuf flags are added to the existing CQE flags rather than replacing them. io_req_rw_complete() does the same with the io_put_kbuf() result.

Fixes e26dca67fde1 ("io_uring: add support for IORING_SETUP_CQE_MIXED")
Reported-by [email protected]
---
 io_uring/rw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/rw.c +1 -1
index 95106dd1d7eb..f2bbb0b1c30a 100644
@@ -1371,11 +1371,11 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
 		if (!smp_load_acquire(&req->iopoll_completed))
 			continue;
 		list_del(&req->iopoll_node);
 		wq_list_add_tail(&req->comp_list, &ctx->submit_state.compl_reqs);
 		nr_events++;
-		req->cqe.flags = io_put_kbuf(req, max(req->cqe.res, 0), NULL);
+		req->cqe.flags |= io_put_kbuf(req, max(req->cqe.res, 0), NULL);
 		if (!io_is_uring_cmd(req))
 			io_req_rw_cleanup(req, 0);
 	}
 	if (nr_events)
 		__io_submit_flush_completions(ctx);
Signature · 1 line
2.55.0
maintainer Applied
#2 lore raw
In reply to Caleb Sander Mateos
Quoted 8 lines · Caleb Sander Mateos

io_do_iopoll() assigns the result of io_put_kbuf() to the request's CQE flags upon completion. This overwrites any CQE flags that may have been set by the opcode-specific layer. (For example, if __io_uring_cmd_done() had set IORING_CQE_F_32, it would be cleared.) Switch the = to an |= so the kbuf flags are added to the existing CQE flags rather than replacing them. io_req_rw_complete() does the same with the io_put_kbuf() result.

[...]

Applied, thanks!

[1/1] io_uring/rw: keep CQE flags on iopoll requests when adding kbuf flags
(no commit info)

Best regards,

Signature · 1 line
Jens Axboe