From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751430AbdAMKdN (ORCPT ); Fri, 13 Jan 2017 05:33:13 -0500 Received: from wylie.me.uk ([82.68.155.94]:43006 "EHLO mail.wylie.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbdAMKdL (ORCPT ); Fri, 13 Jan 2017 05:33:11 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <22648.44239.218544.707210@wylie.me.uk> Date: Fri, 13 Jan 2017 10:32:47 +0000 X-Clacks-Overhead: GNU Terry Pratchett From: "Alan J. Wylie" To: Al Viro Cc: Linus Torvalds , Thorsten Leemhuis , linux-kernel Subject: Re: 4.9.0 regression in pipe-backed iov_iter with systemd-nspawn In-Reply-To: <20170113102019.GK1555@ZenIV.linux.org.uk> References: <22647.59020.331664.632444@wylie.me.uk> <22648.1838.747474.51727@wylie.me.uk> <22648.32903.752857.203733@wylie.me.uk> <20170113093359.GJ1555@ZenIV.linux.org.uk> <22648.41914.351371.678606@wylie.me.uk> <20170113102019.GK1555@ZenIV.linux.org.uk> X-Mailer: VM 8.2.0b under 24.5.1 (x86_64-pc-linux-gnu) X-Clacks-Overhead: GNU Terry Pratchett Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org at 10:20 on Fri 13-Jan-2017 Al Viro (viro@ZenIV.linux.org.uk) wrote: > OK, so it is iov_iter_advance() failing to free the shit allocated, either > due to some breakage in pipe_advance() or buggered 'copied'... Let's > see which one; could you apply the following and run your reproducer? The > only difference from the previous is that it collects and prints a bit more, > so it should be just as reproducible... git reset --hard HEAD vi ~/mail/INBOX patch2 git apply patch2 # uname -a Linux frodo 4.9.3-dirty #2 SMP PREEMPT Fri Jan 13 10:22:47 GMT 2017 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux [hanging as expected] # dmesg | tail ... [ 141.553455] nr: 0->16, cur: 5->5, buffers: 16->16 [ 141.553461] copied: 0, count:2147479552, idx:5, offs:0 > > diff --git a/fs/splice.c b/fs/splice.c > index 873d83104e79..11477609e7f7 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -393,6 +393,10 @@ 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; > + int idx, count, offs; > > if (pipe->nrbufs == pipe->buffers) > return -EAGAIN; > @@ -444,7 +448,22 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos, > for (i = 0; i < nr_pages; i++) > put_page(pages[i]); > kvfree(pages); > + count = to.count; > + idx = to.idx; > + offs = to.iov_offset; > 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); > + printk(KERN_ERR "copied: %zd, count:%d, idx:%d, offs:%d\n", > + copied, count, idx, offs); > + } > return res; > } > -- Alan J. Wylie http://www.wylie.me.uk/ Dance like no-one's watching. / Encrypt like everyone is. Security is inversely proportional to convenience