summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2026-02-16 14:48:52 +0300
committerJens Axboe <axboe@kernel.dk>2026-03-09 16:23:29 +0300
commitcb9487333652b2cfb4f10ef596fc5b675241cae9 (patch)
treeda120aac6fdbf344a6e29822cb2d185aeb179350
parentdce00c83035b880deebf7b2f0a204f740cb90d64 (diff)
downloadlinux-cb9487333652b2cfb4f10ef596fc5b675241cae9.tar.xz
io_uring/zctx: separate notification user_data
People previously asked for the notification CQE to have a different user_data value from the main request completion. It's useful to separate buffer and request handling logic and avoid separately refcounting the request. Let the user pass the notification user_data in sqe->addr3. If zero, it'll inherit sqe->user_data as before. It doesn't change the rules for when the user can expect a notification CQE, and it should still check the IORING_CQE_F_MORE flag. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/net.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 3e68593e8164..3f9d08b78c21 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1333,11 +1333,12 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
struct io_ring_ctx *ctx = req->ctx;
struct io_async_msghdr *iomsg;
struct io_kiocb *notif;
+ u64 user_data;
int ret;
zc->done_io = 0;
- if (unlikely(READ_ONCE(sqe->__pad2[0]) || READ_ONCE(sqe->addr3)))
+ if (unlikely(READ_ONCE(sqe->__pad2[0])))
return -EINVAL;
/* we don't support IOSQE_CQE_SKIP_SUCCESS just yet */
if (req->flags & REQ_F_CQE_SKIP)
@@ -1346,7 +1347,11 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
notif = zc->notif = io_alloc_notif(ctx);
if (!notif)
return -ENOMEM;
- notif->cqe.user_data = req->cqe.user_data;
+ user_data = READ_ONCE(sqe->addr3);
+ if (!user_data)
+ user_data = req->cqe.user_data;
+
+ notif->cqe.user_data = user_data;
notif->cqe.res = 0;
notif->cqe.flags = IORING_CQE_F_NOTIF;
req->flags |= REQ_F_NEED_CLEANUP | REQ_F_POLL_NO_LAZY;