Messages in this thread | | | From | Matt Whitlock <> | Subject | Re: [RFC PATCH 0/4] splice: Fix corruption in data spliced to pipe | Date | Thu, 29 Jun 2023 14:05:16 -0400 |
| |
On Thursday, 29 June 2023 13:56:04 EDT, Linus Torvalds wrote: > On Thu, 29 Jun 2023 at 08:55, David Howells <dhowells@redhat.com> wrote: >> >> Matt Whitlock, Matthew Wilcox and Dave Chinner are of the >> opinion that data >> in the pipe must not be seen to change and that if it does, this is a bug. > > I'm not convinced. > > The whole *point* of vmsplice (and splicing from a file) is the zero-copy. > > If you don't want the zero-copy, then you should use just "write()".
If you want zero copies, then call splice() *with* SPLICE_F_MOVE.
If you want one copy (kernel-to-kernel), then call splice() *without* SPLICE_F_MOVE.
If you want two copies (kernel-to-user + user-to-kernel), call read() and write().
I don't know why SPLICE_F_MOVE is being ignored in this thread. Sure, maybe the way it has historically been implemented was only relevant when the input FD is a pipe, but that's not what the man page implies. You have the opportunity to make it actually do what it says on the tin.
| |