From patchwork Thu Jul 27 16:10:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13330339 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60E13C0015E for ; Thu, 27 Jul 2023 16:10:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D621E6B0074; Thu, 27 Jul 2023 12:10:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D121E6B0075; Thu, 27 Jul 2023 12:10:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDA946B0078; Thu, 27 Jul 2023 12:10:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A64A96B0074 for ; Thu, 27 Jul 2023 12:10:31 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7FD921C926D for ; Thu, 27 Jul 2023 16:10:31 +0000 (UTC) X-FDA: 81057879462.13.B032BC3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 8DD73A0010 for ; Thu, 27 Jul 2023 16:10:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="ZOxAp/Cq"; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690474228; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6riGtniLbVW/0RUbKJK18+ZXuUEMwjT27R+MDiLMQAI=; b=uw+GShRYBxf/SBoUo56naz8Ej2IMuAHN4KrznAzpr1UBb/jF5s5ZQ7zW15p94n9sat+xnb PCZfy52uzxle/Ro+c9fwoCjg95VzoUh7E938ek3/RAdy75EVSaNIkwtial0i1DpsBEnVSZ 7DfGwAVvKh4aN4He6a3rFMg8HxONGKs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690474228; a=rsa-sha256; cv=none; b=Js9PR/H1fbEi4dghl199rF5t0mvKGP72LaYTf0ie4gi8eFeVkUQCf8N0MS4BE4198C80Xg XanH7+OPEW5qen1CI1cRafjeu+PQG0zcdxwwTj36/pr9rFHrkwLN4Xr/ObK7H5zMi+Q0Nx +sgFzFDxyVhcZdEUHGfYI8QefjU6Yi8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="ZOxAp/Cq"; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690474227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6riGtniLbVW/0RUbKJK18+ZXuUEMwjT27R+MDiLMQAI=; b=ZOxAp/CqDyg8aN6mT/r3jqFdkPwIWlcN6XksL6GN0YnQrMN5iemQe6I9DdIyQtnr9zu6ML XxrNkipo6f6+aJAVW5NOrF/VvLXF1TF4hxuHiS0nmAOE4X6El1GqmVtdGywWPxsb0eqeJ5 Ai0lXV4Z8sia0JEO134hiD8OJSYq5TY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-nOoNmV6EMre8aO0nn0whDw-1; Thu, 27 Jul 2023 12:10:24 -0400 X-MC-Unique: nOoNmV6EMre8aO0nn0whDw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BE30185A7A5; Thu, 27 Jul 2023 16:10:23 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC402C57964; Thu, 27 Jul 2023 16:10:21 +0000 (UTC) From: David Howells To: Hugh Dickins Cc: David Howells , Andrew Morton , Christoph Hellwig , Jens Axboe , Al Viro , John Hubbard , David Hildenbrand , Matthew Wilcox , Chuck Lever , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] shmem: Fix splice of a missing page Date: Thu, 27 Jul 2023 17:10:15 +0100 Message-ID: <20230727161016.169066-2-dhowells@redhat.com> In-Reply-To: <20230727161016.169066-1-dhowells@redhat.com> References: <20230727161016.169066-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Stat-Signature: qpiznd4hrsa1o4qs5989fjjsea4po7c9 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 8DD73A0010 X-Rspam-User: X-HE-Tag: 1690474228-615448 X-HE-Meta: U2FsdGVkX19A/45q614TaJs5f4HptQCZZzAPO78PtQnsP2e0rL5MoCgdHCFlVFM6Kyr0SlQv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5y0871uXh+wlFfpgG4dXizy+s+f02nut3GFMUlaUoKIAPo3O3Trr7aK6U17G14/z3jyrlwZVKoTjz1kAQyKf1Nk9tQ3GDl76GdKOaMj8D7BBrJnZEFWi+cq5nnkud45yIQCSWmL+J2tgN+MjVbTvc32fExqk8Z90NpnyHq0gL2kB/v3Q6rrM8Z9UrBQLABaJzMJI+10gCRr5pEYsjN/xJTBfpefm/t/Ce2NtWzes20clmzR/HEdkoCNedHAPvEfkdGSTHgUB4DuVWR+a4He6ay9ZclZKnt86w4PZlxX3+enNU6uaDf3qr7Tlbv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Fix shmem_splice_read() to splice only part of the partial page at the end of a splice and not all of it. This can be seen by splicing from a tmpfs file that's not a multiple of PAGE_SIZE in size. Without this fix, it splices extra data to round up to PAGE_SIZE. Fixes: bd194b187115 ("shmem: Implement splice-read") Signed-off-by: David Howells cc: Hugh Dickins cc: Christoph Hellwig cc: Jens Axboe cc: Al Viro cc: John Hubbard cc: David Hildenbrand cc: Matthew Wilcox cc: Chuck Lever cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 2f2e0e618072..0164cccdcd71 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2841,7 +2841,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, folio_put(folio); folio = NULL; } else { - n = splice_zeropage_into_pipe(pipe, *ppos, len); + n = splice_zeropage_into_pipe(pipe, *ppos, part); } if (!n)