From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01D3BC00144 for ; Sat, 30 Jul 2022 00:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbiG3ADU (ORCPT ); Fri, 29 Jul 2022 20:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbiG3ADT (ORCPT ); Fri, 29 Jul 2022 20:03:19 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14ACE43311 for ; Fri, 29 Jul 2022 17:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jZTXnZCkES6wzSPyhtcYp7hetRxIybqtgcazoIDp/uE=; b=ZdO2h0EsQ5Hb22jUa14hvNqxNf 5VDikyIuaTHoOPtn1Fj0R/6F2IMDWGMySlmNzfJM8zNnxjSPVqExON+MTd2k7TPxWim6hYLLlAwMJ xGGzj/f6ix8ABjXl/8xF0o1EhhZb2jKgqCOCMeq/GkTTnI46w0gabmxOmyE3MkxKGzuEoZEHHGALf MDQUt1l1OXfYZGf5jNY/x+LUGX41tqduOK9Mb+240BQKOLpVv15HUC24V//sxEC2gn0eMUWqMe8WV YX+uX5AkOPYLmg+3ZJlrNdluybtjdE91b/z3beJ8ZHEj8qb2B1MbYEB07eId2X2HXTwU4Lb0AJthG DVdOA9Iw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oHZwo-00HCy0-Lx; Sat, 30 Jul 2022 00:03:14 +0000 Date: Sat, 30 Jul 2022 01:03:14 +0100 From: Al Viro To: Alexander Gordeev Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds , Jens Axboe , Christoph Hellwig , Matthew Wilcox , David Howells , Dominique Martinet , Christian Brauner Subject: Re: [PATCH 9/44] new iov_iter flavour - ITER_UBUF Message-ID: References: <20220622041552.737754-1-viro@zeniv.linux.org.uk> <20220622041552.737754-9-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Jul 29, 2022 at 11:12:45PM +0200, Alexander Gordeev wrote: > On Fri, Jul 29, 2022 at 06:21:23PM +0100, Al Viro wrote: > > > Hi Al, > > > > > > This changes causes sendfile09 LTP testcase fail in linux-next > > > (up to next-20220727) on s390. In fact, not this change exactly, > > > but rather 92d4d18eecb9 ("new iov_iter flavour - ITER_UBUF") - > > > which differs from what is posted here. > > > > > > AFAICT page_cache_pipe_buf_confirm() encounters !PageUptodate() > > > and !page->mapping page and returns -ENODATA. > > > > > > I am going to narrow the testcase and get more details, but please > > > let me know if I am missing something. > > > > Grrr.... > > > > - } else if (iter_is_iovec(to)) { > > + } else if (!user_backed_iter(to)) { > > > > in mm/shmem.c. Spot the typo... > > > > Could you check if replacing that line with > > } else if (user_backed_iter(to)) { > > > > fixes the breakage? > > Yes, it does! So just to be sure - this is the fix: FWIW, there'd been another braino, caught by test from Hugh Dickins; this one in ITER_PIPE: allocate buffers as we go in copy-to-pipe primitives Incremental follows; folded and pushed out. diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 642841ce7595..939078ffbfb5 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -469,7 +469,7 @@ static size_t copy_pipe_to_iter(const void *addr, size_t bytes, struct page *page = append_pipe(i, n, &off); chunk = min_t(size_t, n, PAGE_SIZE - off); if (!page) - break; + return bytes - n; memcpy_to_page(page, off, addr, chunk); addr += chunk; } @@ -774,7 +774,7 @@ static size_t pipe_zero(size_t bytes, struct iov_iter *i) char *p; if (!page) - break; + return bytes - n; chunk = min_t(size_t, n, PAGE_SIZE - off); p = kmap_local_page(page); memset(p + off, 0, chunk); diff --git a/mm/shmem.c b/mm/shmem.c index 6b83f3971795..6c8a84a1fbbb 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2603,7 +2603,7 @@ static ssize_t shmem_file_read_iter(struct kiocb *iocb, struct iov_iter *to) ret = copy_page_to_iter(page, offset, nr, to); put_page(page); - } else if (!user_backed_iter(to)) { + } else if (user_backed_iter(to)) { /* * Copy to user tends to be so well optimized, but * clear_user() not so much, that it is noticeably