public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 6.0] io_uring/net: copy addr for zc on POLL_FIRST
@ 2022-09-08 13:01 Pavel Begunkov
  2022-09-08 14:28 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2022-09-08 13:01 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

Every time we return from an issue handler and expect the request to be
retried we should also setup it for async exec ourselves. Do that when
we return on IORING_RECVSEND_POLL_FIRST in io_sendzc(), otherwise it'll
re-read the address, which might be a surprise for the userspace.

Fixes: 092aeedb750a9 ("io_uring: allow to pass addr into sendzc")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/net.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 7047c1342541..e9efed40cf3d 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1003,9 +1003,6 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
 	unsigned msg_flags, cflags;
 	int ret, min_ret = 0;
 
-	if (!(req->flags & REQ_F_POLLED) &&
-	    (zc->flags & IORING_RECVSEND_POLL_FIRST))
-		return -EAGAIN;
 	sock = sock_from_file(req->file);
 	if (unlikely(!sock))
 		return -ENOTSOCK;
@@ -1030,6 +1027,10 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
 		msg.msg_namelen = zc->addr_len;
 	}
 
+	if (!(req->flags & REQ_F_POLLED) &&
+	    (zc->flags & IORING_RECVSEND_POLL_FIRST))
+		return io_setup_async_addr(req, addr, issue_flags);
+
 	if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
 		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
 					(u64)(uintptr_t)zc->buf, zc->len);
-- 
2.37.2


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

* Re: [PATCH 6.0] io_uring/net: copy addr for zc on POLL_FIRST
  2022-09-08 13:01 [PATCH 6.0] io_uring/net: copy addr for zc on POLL_FIRST Pavel Begunkov
@ 2022-09-08 14:28 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-09-08 14:28 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On Thu, 8 Sep 2022 14:01:10 +0100, Pavel Begunkov wrote:
> Every time we return from an issue handler and expect the request to be
> retried we should also setup it for async exec ourselves. Do that when
> we return on IORING_RECVSEND_POLL_FIRST in io_sendzc(), otherwise it'll
> re-read the address, which might be a surprise for the userspace.
> 
> 

Applied, thanks!

[1/1] io_uring/net: copy addr for zc on POLL_FIRST
      commit: 3c8400532dd8305024ff6eea38707de20b1b9822

Best regards,
-- 
Jens Axboe



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

end of thread, other threads:[~2022-09-08 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-08 13:01 [PATCH 6.0] io_uring/net: copy addr for zc on POLL_FIRST Pavel Begunkov
2022-09-08 14:28 ` Jens Axboe

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