summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-01-29 11:54:18 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-16 19:10:56 +0100
commiteac52bfe2333acb382cf03db5186587ee96eda4a (patch)
treefd75aeeccd9cb5219b5fcc06f7805d7a32f1dd38 /io_uring
parent0848bf7e539aa33975c4a216444139532e4b526a (diff)
downloadlinux-riscv-eac52bfe2333acb382cf03db5186587ee96eda4a.tar.gz
linux-riscv-eac52bfe2333acb382cf03db5186587ee96eda4a.tar.bz2
linux-riscv-eac52bfe2333acb382cf03db5186587ee96eda4a.zip
io_uring/net: un-indent mshot retry path in io_recv_finish()
Commit 91e5d765a82fb2c9d0b7ad930d8953208081ddf1 upstream. In preparation for putting some retry logic in there, have the done path just skip straight to the end rather than have too much nesting in here. No functional changes in this patch. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/net.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index fb265c9dda5f..5662733f5eed 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -645,23 +645,27 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
return true;
}
- if (!mshot_finished) {
- if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
- *ret, cflags | IORING_CQE_F_MORE)) {
- io_recv_prep_retry(req);
- /* Known not-empty or unknown state, retry */
- if (cflags & IORING_CQE_F_SOCK_NONEMPTY ||
- msg->msg_inq == -1)
- return false;
- if (issue_flags & IO_URING_F_MULTISHOT)
- *ret = IOU_ISSUE_SKIP_COMPLETE;
- else
- *ret = -EAGAIN;
- return true;
- }
- /* Otherwise stop multishot but use the current result. */
- }
+ if (mshot_finished)
+ goto finish;
+ /*
+ * Fill CQE for this receive and see if we should keep trying to
+ * receive from this socket.
+ */
+ if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
+ *ret, cflags | IORING_CQE_F_MORE)) {
+ io_recv_prep_retry(req);
+ /* Known not-empty or unknown state, retry */
+ if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1)
+ return false;
+ if (issue_flags & IO_URING_F_MULTISHOT)
+ *ret = IOU_ISSUE_SKIP_COMPLETE;
+ else
+ *ret = -EAGAIN;
+ return true;
+ }
+ /* Otherwise stop multishot but use the current result. */
+finish:
io_req_set_res(req, *ret, cflags);
if (issue_flags & IO_URING_F_MULTISHOT)