Re: 4.9.0 regression in pipe-backed iov_iter with systemd-nspawn

Al Viro
2017-01-13T09:34:06Z

On Fri, Jan 13, 2017 at 07:23:51AM +0000, Alan J. Wylie wrote:
> at 15:28 on Thu 12-Jan-2017 Linus Torvalds (torvalds@linux-foundation.org) wrote:
>
> > So assuming Al hasn't figured it out by the time you get back, can
> > you try to send us the same strace for the working case?
>
> Full output at https://wylie.me.uk/tmp/strace1.txt
>
> 1735 splice(5, NULL, 1, NULL, 9223372036854775807, 0) = -1 EAGAIN (Resource temporarily unavailable)

Lovely... So it was getting -EAGAIN all along. Just in case - could you
try the delta below and see if it triggers? Simply to exclude the possibility
that it *is* this call of splice() and the change has somehow buggered cleanup
after the kernel_readv() failure...

diff --git a/fs/splice.c b/fs/splice.c
index 873d83104e79..1a2d1bc7f19e 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -393,6 +393,9 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
size_t offset, dummy, copied = 0;
ssize_t res;
int i;
+ unsigned nrbufs = pipe->nrbufs,
+ curbuf = pipe->curbuf,
+ buffers = pipe->buffers;

if (pipe->nrbufs == pipe->buffers)
return -EAGAIN;
@@ -445,6 +448,16 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
put_page(pages[i]);
kvfree(pages);
iov_iter_advance(&to, copied); /* truncates and discards */
+ if (res == -EAGAIN && (
+ pipe->nrbufs != nrbufs ||
+ pipe->curbuf != curbuf ||
+ pipe->buffers != buffers)
+ ) {
+ printk(KERN_ERR "nr: %d->%d, cur: %d->%d, buffers: %d->%d\n",
+ nrbufs, pipe->nrbufs,
+ curbuf, pipe->curbuf,
+ buffers, pipe->buffers);
+ }
return res;
}