public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: io-uring <[email protected]>
Cc: Breno Leitao <[email protected]>
Subject: [PATCH for-next] io_uring/msg-ring: ensure flags passing works for task_work completions
Date: Thu, 19 Jan 2023 10:58:41 -0700	[thread overview]
Message-ID: <[email protected]> (raw)

If the target ring is using IORING_SETUP_SINGLE_ISSUER and we're posting
a message from a different thread, then we need to ensure that the
fallback task_work that posts the CQE knwos about the flags passing as
well. If not we'll always be posting 0 as the flags.

Fixes: 5ffd63f2b73e ("io_uring/msg_ring: Pass custom flags to the cqe")
Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c
index dc233f72a541..5d052d2f3d93 100644
--- a/io_uring/msg_ring.c
+++ b/io_uring/msg_ring.c
@@ -49,11 +49,15 @@ static void io_msg_tw_complete(struct callback_head *head)
 	struct io_msg *msg = container_of(head, struct io_msg, tw);
 	struct io_kiocb *req = cmd_to_io_kiocb(msg);
 	struct io_ring_ctx *target_ctx = req->file->private_data;
+	u32 flags = 0;
 	int ret = 0;
 
+	if (msg->flags & IORING_MSG_RING_FLAGS_PASS)
+		flags = msg->cqe_flags;
+
 	if (current->flags & PF_EXITING)
 		ret = -EOWNERDEAD;
-	else if (!io_post_aux_cqe(target_ctx, msg->user_data, msg->len, 0))
+	else if (!io_post_aux_cqe(target_ctx, msg->user_data, msg->len, flags))
 		ret = -EOVERFLOW;
 
 	if (ret < 0)

-- 
Jens Axboe

                 reply	other threads:[~2023-01-19 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox