]> git.itanic.dy.fi Git - linux-stable/commitdiff
io_uring/net: un-indent mshot retry path in io_recv_finish()
authorJens Axboe <axboe@kernel.dk>
Mon, 29 Jan 2024 18:54:18 +0000 (11:54 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 29 Jan 2024 20:19:26 +0000 (13:19 -0700)
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>
io_uring/net.c

index 75d494dad7e2c7b22a53f50fc422d807a0559000..740c6bfa5b5900034824ae115b1041935d762813 100644 (file)
@@ -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)