From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755941AbcKWQaF (ORCPT ); Wed, 23 Nov 2016 11:30:05 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36641 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755528AbcKWQaB (ORCPT ); Wed, 23 Nov 2016 11:30:01 -0500 Date: Wed, 23 Nov 2016 08:29:54 -0800 From: Alexei Starovoitov To: Al Viro Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Daniel Borkmann , Martin KaFai Lau Subject: Re: sendfile from 9p fs into af_alg Message-ID: <20161123162952.GA48439@ast-mbp.thefacebook.com> References: <20161123035827.GA43786@ast-mbp.thefacebook.com> <20161123044625.GL1555@ZenIV.linux.org.uk> <20161123045558.GA43893@ast-mbp.thefacebook.com> <20161123061628.GN1555@ZenIV.linux.org.uk> <20161123085809.GA46992@ast-mbp.thefacebook.com> <20161123155301.GP1555@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161123155301.GP1555@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23, 2016 at 03:53:01PM +0000, Al Viro wrote: > On Wed, Nov 23, 2016 at 12:58:11AM -0800, Alexei Starovoitov wrote: > > > if I read it correctly 9p actually responded with 8192 bytes of requests... > > whereas the file size was 9624. > > For large file sizes (in megabytes) the difference between what > > sendfile is reporting and actual file size can be 3x. > > In the small file case (like above dump) it looks rounded to page size for some reason. > > OK, I think I see one bug in there; could you check if this gets it back to > normal? > > diff --git a/fs/splice.c b/fs/splice.c > index dcaf185..5a7750b 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -408,7 +408,8 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos, > if (res <= 0) > return -ENOMEM; > > - nr_pages = res / PAGE_SIZE; > + BUG_ON(dummy); > + nr_pages = DIV_ROUND_UP(res, PAGE_SIZE); Hooray. It fixed it :) Feel free to add my Tested-by: Alexei Starovoitov when you submit it. Thanks for fixing it so quickly!