Skip to contentSkip to conversation

io_uring: fix mshot read defer taskrun cqe posting

PATCH Applied Pavel Begunkov 2 participants 5 messages Mar 6, 2024 – Mar 7, 2024 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix mshot read defer taskrun cqe posting

We can't post CQEs from io-wq with DEFER_TASKRUN set, normal completions are handled but aux should be explicitly disallowed by opcode handlers.

Fixes fc68fcda04910 ("io_uring/rw: add support for IORING_OP_READ_MULTISHOT")
---
 io_uring/rw.c | 2 ++
 1 file changed, 2 insertions(+)
io_uring/rw.c +2 -0
index d5e79d9bdc71..8756e367acd9 100644
@@ -932,6 +932,8 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
 	 */
 	if (!file_can_poll(req->file))
 		return -EBADFD;
+	if (issue_flags & IO_URING_F_IOWQ)
+		return -EAGAIN;
 
 	ret = __io_read(req, issue_flags);
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Pavel Begunkov

We can't post CQEs from io-wq with DEFER_TASKRUN set, normal completions are handled but aux should be explicitly disallowed by opcode handlers.

Applied, thanks!

[1/1] io_uring: fix mshot read defer taskrun cqe posting
(no commit info)

Best regards,

Signature · 1 line
Jens Axboe
maintainer
#2 lore raw
In reply to Pavel Begunkov
Quoted 2 lines · Pavel Begunkov

We can't post CQEs from io-wq with DEFER_TASKRUN set, normal completions are handled but aux should be explicitly disallowed by opcode handlers.

Looks good - but I can't help but think that it'd be nice to handle this from io_wq_submit_work() instead, and take it out of the opcode handlers themselves (like this one, and the recv/recvmsg part). That'd put it in the slow path instead.

Anyway, it's applied, as it's a real fix and any work like the above should be done separately of course.

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Pavel Begunkov

We can't post CQEs from io-wq with DEFER_TASKRUN set, normal completions are handled but aux should be explicitly disallowed by opcode handlers.

Looks good - but I can't help but think that it'd be nice to handle this from io_wq_submit_work() instead, and take it out of the opcode handlers themselves (like this one, and the recv/recvmsg part). That'd put it in the slow path instead.

I have a follow up cleanup patch, but I like this idea even more

Quoted 2 lines

Anyway, it's applied, as it's a real fix and any work like the above should be done separately of course.

Signature · 1 line
Pavel Begunkov
maintainer
#4 lore raw
Quoted 11 lines · Pavel Begunkov
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Pavel Begunkov

We can't post CQEs from io-wq with DEFER_TASKRUN set, normal completions are handled but aux should be explicitly disallowed by opcode handlers.

Looks good - but I can't help but think that it'd be nice to handle this from io_wq_submit_work() instead, and take it out of the opcode handlers themselves (like this one, and the recv/recvmsg part). That'd put it in the slow path instead.

I have a follow up cleanup patch, but I like this idea even more

Excellent, looking forward to that :)

Signature · 1 line
Jens Axboe