Re: [PATCH 1/4] fs/splice: enhance direct pipe & splice for moving pages in kernel

Linus Torvalds
2023-02-11T18:57:32Z

On Sat, Feb 11, 2023 at 7:42 AM Ming Lei <ming.lei@redhat.com> wrote:
>
> +/*
> + * Used by source/sink end only, don't touch them in generic
> + * splice/pipe code. Set in source side, and check in sink
> + * side
> + */
> +#define PIPE_BUF_PRIV_FLAG_MAY_READ 0x1000 /* sink can read from page */
> +#define PIPE_BUF_PRIV_FLAG_MAY_WRITE 0x2000 /* sink can write to page */
> +

So this sounds much more sane and understandable, but I have two worries:

(a) what's the point of MAY_READ? A non-readable page sounds insane
and wrong. All sinks expect to be able to read.

(b) what about 'tee()' which duplicates a pipe buffer that has
MAY_WRITE? Particularly one that may already have been *partially*
given to something that thinks it can write to it?

So at a minimum I think the tee code then needs to clear that flag.
And I think MAY_READ is nonsense.

Linus