io_uring/rsrc: add uncloneable regbuf flag

It's hard to implement cloning if the internal structure needs to be
mutable and/or relies on other ring resources. In preparation to such
buffer types, add a flag indicating that the buffer can't be cloned. It
might be possible to add cloning in the future for them, but that would
likely need reallocating the structure and reacquiring resources in case
by case manner.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/c73c459578981e64a352e46c0db39ad46621c63a.1791975048.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov 2026-10-14 12:02:09 +01:00 committed by Jens Axboe
parent a5819c456b
commit 13b1690bb4
2 changed files with 7 additions and 1 deletions

View File

@ -1458,6 +1458,11 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
if (!src_node) {
dst_node = NULL;
} else {
if (src_node->buf->flags & IO_REGBUF_F_UNCLONEABLE) {
io_rsrc_data_free(ctx, &data);
return -EOPNOTSUPP;
}
dst_node = io_rsrc_node_alloc(ctx, IORING_RSRC_BUFFER);
if (!dst_node) {
io_rsrc_data_free(ctx, &data);

View File

@ -26,7 +26,8 @@ struct io_rsrc_node {
};
enum {
IO_REGBUF_F_KBUF = 1,
IO_REGBUF_F_KBUF = 1 << 0,
IO_REGBUF_F_UNCLONEABLE = 1 << 1,
};
struct io_mapped_ubuf {