diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2025-02-23 17:22:30 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-02-24 12:11:06 -0700 |
commit | 185523ebc85342ed90c5a80034f281ac09fd29db (patch) | |
tree | f8ae13e62270374322972a063ed754f5e188051e /io_uring/net.c | |
parent | f6a89bf5278d6e15016a736db67043560d1b50d5 (diff) |
io_uring/net: canonise accept mshot handling
Use a more recognisable pattern for mshot accept, first try to post an
mshot cqe if needed and after do terminating handling.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/daf5c0df7e2966deb0a115021c065fc6161a52d7.1740331076.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/net.c')
-rw-r--r-- | io_uring/net.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index 926cdb8d3350..8283a1f55192 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1612,7 +1612,6 @@ retry: } if (ret == -ERESTARTSYS) ret = -EINTR; - req_set_fail(req); } else if (!fixed) { fd_install(fd, file); ret = fd; @@ -1625,14 +1624,8 @@ retry: if (!arg.is_empty) cflags |= IORING_CQE_F_SOCK_NONEMPTY; - if (!(req->flags & REQ_F_APOLL_MULTISHOT)) { - io_req_set_res(req, ret, cflags); - return IOU_OK; - } - - if (ret < 0) - return ret; - if (io_req_post_cqe(req, ret, cflags | IORING_CQE_F_MORE)) { + if (ret >= 0 && (req->flags & REQ_F_APOLL_MULTISHOT) && + io_req_post_cqe(req, ret, cflags | IORING_CQE_F_MORE)) { if (cflags & IORING_CQE_F_SOCK_NONEMPTY || arg.is_empty == -1) goto retry; if (issue_flags & IO_URING_F_MULTISHOT) @@ -1641,6 +1634,8 @@ retry: } io_req_set_res(req, ret, cflags); + if (ret < 0) + req_set_fail(req); if (!(issue_flags & IO_URING_F_MULTISHOT)) return IOU_OK; return IOU_STOP_MULTISHOT; |