public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting
@ 2024-03-06 16:02 Pavel Begunkov
  2024-03-07 13:31 ` Jens Axboe
  2024-03-07 13:33 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Begunkov @ 2024-03-06 16:02 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

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.

Cc: [email protected]
Fixes: fc68fcda04910 ("io_uring/rw: add support for IORING_OP_READ_MULTISHOT")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/rw.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/io_uring/rw.c b/io_uring/rw.c
index d5e79d9bdc71..8756e367acd9 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -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);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting
  2024-03-06 16:02 [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting Pavel Begunkov
@ 2024-03-07 13:31 ` Jens Axboe
  2024-03-07 13:33 ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-03-07 13:31 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Wed, 06 Mar 2024 16:02:25 +0000, Pavel Begunkov wrote:
> 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,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting
  2024-03-06 16:02 [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting Pavel Begunkov
  2024-03-07 13:31 ` Jens Axboe
@ 2024-03-07 13:33 ` Jens Axboe
  2024-03-07 13:47   ` Pavel Begunkov
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2024-03-07 13:33 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 3/6/24 9:02 AM, Pavel Begunkov wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting
  2024-03-07 13:33 ` Jens Axboe
@ 2024-03-07 13:47   ` Pavel Begunkov
  2024-03-07 13:58     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2024-03-07 13:47 UTC (permalink / raw)
  To: Jens Axboe, io-uring

On 3/7/24 13:33, Jens Axboe wrote:
> On 3/6/24 9:02 AM, Pavel Begunkov wrote:
>> 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


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

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting
  2024-03-07 13:47   ` Pavel Begunkov
@ 2024-03-07 13:58     ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-03-07 13:58 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 3/7/24 6:47 AM, Pavel Begunkov wrote:
> On 3/7/24 13:33, Jens Axboe wrote:
>> On 3/6/24 9:02 AM, Pavel Begunkov wrote:
>>> 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 :)

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-07 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06 16:02 [PATCH 1/1] io_uring: fix mshot read defer taskrun cqe posting Pavel Begunkov
2024-03-07 13:31 ` Jens Axboe
2024-03-07 13:33 ` Jens Axboe
2024-03-07 13:47   ` Pavel Begunkov
2024-03-07 13:58     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox