Re: [PATCH v3] io_uring/register: add IORING_REGISTER_CLONE_FILES opcode

Greg KH <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel
Message-ID <2026061902-clerk-common-4c84@gregkh>
On Fri, Jun 19, 2026 at 12:27:00PM +0530, harshal24-chavan wrote:
> Currently, if an application wants to duplicate registered file
> descriptors from one io_uring instance to another, it must manually
> unregister and re-register them, incurring unnecessary overhead.
> 
> Add IORING_REGISTER_CLONE_FILES to allow direct cloning of the file
> table from a source ring to a destination ring. This implementation
> strictly mirrors the io_clone_buffers UAPI, supporting partial offsets
> and the IORING_REGISTER_DST_REPLACE flag.
> 
> To ensure lock synchronization safety, destination nodes are strictly
> allocated as new, private io_rsrc_nodes rather than sharing references
> across rings.
> 
> ---
> v3:
>   - Rewrote the cloning loop to allocate private destination nodes via io_rsrc_node_alloc to fix non-atomic ref lock synchronization (Jens).
>   - Maintained partial offset/copy support to mirror io_clone_buffers UAPI (Jens).
>   - Gated the replacement free check on ctx->file_table.data.nr (Gabriel).
>   - Prevented self-cloning by checking ctx == src_ctx (Gabriel).
>   - Removed submitter_task check to allow cross-thread pooling setups (Gabriel).
> v2: Dropped unrelated whitespace formatting changes from v1
> 
> Signed-off-by: harshal24-chavan <[email protected]>

Needs to be a name, not an email alias, and above the --- line.

thanks,

greg k-h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.