On Mon, Oct 5, 2020 at 5:14 AM Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote: > > splice() from pipe should return 0 when there is no pipe writer. However, > since commit a194dfe6e6f6f720 ("pipe: Rearrange sequence in pipe_write() > to preallocate slot") started inserting empty pages, splice() from pipe > also returns 0 when all ready buffers are empty pages. Well... Only if you had writers that intentionally did that whole "no valid data write" thing. Which could be seen as a feature. That said, if this actually broke some code, then we need to fix it - but I really hate how you have that whole !pipe_empty() loop around the empty buffers. That case is very unlikely, and you have a loop with !pipe_empty() *anyway* with the whole "goto refill". So the loop is completely pointless. Also, what if we have a packet pipe? Do we perhaps want to return at packet boundaries? I don't think splice() has cared, so probably not, but it's worth perhaps thinking about. Anyway, I'd be a lot happier with the patch being structured something like this instead.. UNTESTED Linus
Attachment:
patch
Description: Binary data