io_uring/msg_ring: cleanup posting to IOPOLL vs !IOPOLL ring
authorJens Axboe <axboe@kernel.dk>
Thu, 28 Mar 2024 16:42:40 +0000 (10:42 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 1 May 2024 23:13:51 +0000 (17:13 -0600)
Move the posting outside the checking and locking, it's cleaner that
way.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/msg_ring.c

index d74670b39ed6dca79cebec698863db761ad37cc6..81c4a9d437296cbf1d3af90e72e2b436cb0ca648 100644 (file)
@@ -147,13 +147,11 @@ static int io_msg_ring_data(struct io_kiocb *req, unsigned int issue_flags)
        if (target_ctx->flags & IORING_SETUP_IOPOLL) {
                if (unlikely(io_double_lock_ctx(target_ctx, issue_flags)))
                        return -EAGAIN;
-               if (io_post_aux_cqe(target_ctx, msg->user_data, msg->len, flags))
-                       ret = 0;
-               io_double_unlock_ctx(target_ctx);
-       } else {
-               if (io_post_aux_cqe(target_ctx, msg->user_data, msg->len, flags))
-                       ret = 0;
        }
+       if (io_post_aux_cqe(target_ctx, msg->user_data, msg->len, flags))
+               ret = 0;
+       if (target_ctx->flags & IORING_SETUP_IOPOLL)
+               io_double_unlock_ctx(target_ctx);
        return ret;
 }