From patchwork Wed Aug 28 21:02:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13781956 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 52CC2C7113C for ; Wed, 28 Aug 2024 21:03:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E1E156B0099; Wed, 28 Aug 2024 17:03:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF4BA6B009A; Wed, 28 Aug 2024 17:03:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95BC6B009B; Wed, 28 Aug 2024 17:03:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A94C06B0099 for ; Wed, 28 Aug 2024 17:03:40 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6B424A9CB0 for ; Wed, 28 Aug 2024 21:03:40 +0000 (UTC) X-FDA: 82502880600.15.18DD68E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id A642940017 for ; Wed, 28 Aug 2024 21:03:38 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DtD67Plb; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724878947; a=rsa-sha256; cv=none; b=gflCbnSxFIyCBnDblxv5DUuVe9dV6JULBebYgUkOWFqCog5wYdomicMgyFyBP4eARYom0l tfPjkg3KiV9mOxxMCTSqJtVvWOmZaZuqoDxDtuyxy1PkTJogdE7JZtircghTmAKY+1JytQ DXHv0OqI1XdDVcQN/BAw2zDgDWgVzE4= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DtD67Plb; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724878947; 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=gafgwUBwZzk/cup16/E12xqM5SQfOL2Vg1E23SCR1HY=; b=loGu2BA7TOiBagH8OpgGqeEBnX8fC1J6EgZNby197daxmmvE9K7Gw7n9hOKm4zIv3Xu/Vm 3FKWpPXyetfyN7ybXshNaNEf2CHEFOsPhc03ifBgwATle58joR/f42iL6zS7O38w2v6R/H E8MakD7hSICgG0wzzM2cMTtAK3PgC5o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724879017; 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=gafgwUBwZzk/cup16/E12xqM5SQfOL2Vg1E23SCR1HY=; b=DtD67PlbQo9ebJ6xIlK8ueZ+YmfBDtyTv6bHjHEYBwpcPGDLjW4BtjkJOy1sqdRYhB78UP zwhbSTHGP/8JW+oxGYwL6RDKcku0MusGNuLbCoXPvlqRkgYHsDcZeXKG6UQ5+iBsbCq6aY yAiuHz+2iyrMVlsb1L9P3EINtyptTPk= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-nlBAerB_MSuc8tJsU0uD8A-1; Wed, 28 Aug 2024 17:03:34 -0400 X-MC-Unique: nlBAerB_MSuc8tJsU0uD8A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 060FE1955BEE; Wed, 28 Aug 2024 21:03:30 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.30]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74A7019560A3; Wed, 28 Aug 2024 21:03:21 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French Cc: David Howells , Paulo Alcantara , Tom Talpey , Dominique Martinet , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Miklos Szeredi , Trond Myklebust , Christoph Hellwig , Andrew Morton , Alexander Viro , Christian Brauner , devel@lists.orangefs.org Subject: [PATCH 4/6] mm: Fix filemap_invalidate_inode() to use invalidate_inode_pages2_range() Date: Wed, 28 Aug 2024 22:02:45 +0100 Message-ID: <20240828210249.1078637-5-dhowells@redhat.com> In-Reply-To: <20240828210249.1078637-1-dhowells@redhat.com> References: <20240828210249.1078637-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A642940017 X-Stat-Signature: 4kzo5nisnzihgo6gwb4emusaqiwqd6hb X-Rspam-User: X-HE-Tag: 1724879018-304602 X-HE-Meta: U2FsdGVkX19Mr+WVegBZQn6GChzDMFS7f8cyRbjqSiLC9nOepcuizFvac+ExbzThpfwUF93V788PRGhLnCFoCAQU9wo/lHhMA1BAHTWnOCEeQmj/FMWMef3IWOIht/gglk9U0X/8GZ33Mr0yY6JcaTAit+dGI6kxAQLn4lPLbP/WbeU6PYwIKP4YO+TB8CcZwTHBK8nQfEAIhz5/ADTBKkn7f7suooJm9VLIrda99VTQsi3WaBrxpQhgMxB8yA3mzFZj/nrYJTj4FxdIia/aCeB7EW6rioX5kcCZMOogJdZV+3lTfrePibMw250evfVjmKYtpDta1dulctCNeyLTp1s5jjSwoupbS6+e6WK6PdcXG5vJzuy3HJKwFmj/5Eqj7yXCy6TPvgoCTd09xfpGz6OPxEm4oCr1k0unkhJVF/z9nQ5MgjwhKsuArNQUrWs82nYK1K/Xllgkpq8tRJwij3sqxPPVzTlUvXbTkBCNb+4GfWcXYE9oS97uuxGHJNMNbZVpuYYS3nwMPHsk7UUPLaKiE2nwvJ7cUzpdR4CXr95vjpbtDWRbNoT2UeV++H5Ni6meRltBnAl0T9Wd8wmPZVb6x+7KkOXDdZdfNHj5VkgeJUPUqJ189kimLB0B81TaDhVRmKYV3+c2kCNEgLDAc0MFNriand7bp9sTb4RmHrI1YNZvCIFWRLCif+GK14DgmwdzqdNqEaZgdxViZSob/mOmydMdXySp0cuYJFQKf1gP1Pfu8AF5rXhWIrT4cTAq7D0EaY1NJF379SshziQMmGQDticcNA+o8kSKxb+XpqNsTQBNorWQx2YQ+6wKnKZ/Gr2lsW4nfU9tOffcinvTtIX3LtJHM3ls9id/z8HB/A6KFMl6awnsSukH5qacDI1WLepe8ymDDpbgJYqopnFSRo/0WCh82DLtUeHairDmhbjVp3mqQhSlq9TOOi51nWZ4nkIFTkt2dDyPRGSDk5y AHD39c/m Rw5/3+cy5oM3kfwTQV0BXS0UGsEWJcdqE2EXlkmO7+cIlGtR76fYwhUZ2VENP+pQL+4iCnrAQazFs/5Xiffvu9M3prUfZhzMhhqfov8n3HhJrg76/g3Ahh8hbUmnr2jCKa5JeV0aIqfFc5IU/R3AFsjC0wtr5Rcza7hURzAxPpLmVXIayjz7FCuk38u+7e6yJiBn9eIpxv42R55f0HNMXTflgzvSRFayY9zlJcSUl641oqndWx2Cc+VkgtAJSrvD6ndDJLouvKmp8dYwd2oeQlQiDfiDuY0k36wc9LGgCQGaasopLPZi2LtalFj59WbOKc8Wg/wxEdLfcp/gC9atYTmFaTnOwp/GdhcQw3Vtiijmp9Xqtz2PXNTGYjlcfPdiGYwyJkdITos1UF9Ok90u64uK8RwNXp2g2Kotlhf3UGO9NzGwvO1YjsN3EIjx0XQRmIUzGccQeL9H5hF85QSAfejoBWxroGDFdXqJBwacRwZTOlpFAo+d0ZVdu8vHn3xazJ8RN6s4dDMRSeOK8YJdR/yknABHSyXL0oH1JAcldDIBwFDgqZQ2xTTFfTYRnDDrBafVdLXKWW8qKYjklu7mda5Z56o83lMD0ugCL2DCNbHVV/Ohpc7i9tD3jEnGVj/lL0mUWBkWgXXDZUHuUOkA9c+ATTza7b3nJEnbTalzTs+JN229L5IEjBgaRpZxL0/HETJIhg98iaD5HLgvZNuUGIaRQ7rQjrkolhOTMCRk9Vqorv7A1ziZnxVykt9x6EOn0hya7W7poqodXzNdGGfhdTX0CsK2VM6mlfosw 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: List-Subscribe: List-Unsubscribe: Fix filemap_invalidate_inode() to use invalidate_inode_pages2_range() rather than truncate_inode_pages_range(). The latter clears the invalidated bit of a partial pages rather than discarding it entirely. This causes copy_file_range() to fail on cifs because the partial pages at either end of the destination range aren't evicted and reread, but rather just partly cleared. This causes generic/075 and generic/112 xfstests to fail. Fixes: 74e797d79cf1 ("mm: Provide a means of invalidation without using launder_folio") Signed-off-by: David Howells cc: Matthew Wilcox cc: Miklos Szeredi cc: Trond Myklebust cc: Christoph Hellwig cc: Andrew Morton cc: Alexander Viro cc: Christian Brauner cc: Jeff Layton cc: linux-mm@kvack.org cc: linux-fsdevel@vger.kernel.org cc: netfs@lists.linux.dev cc: v9fs@lists.linux.dev cc: linux-afs@lists.infradead.org cc: ceph-devel@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: linux-nfs@vger.kernel.org cc: devel@lists.orangefs.org --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index d62150418b91..0ca9c1377b68 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -4231,7 +4231,7 @@ int filemap_invalidate_inode(struct inode *inode, bool flush, } /* Wait for writeback to complete on all folios and discard. */ - truncate_inode_pages_range(mapping, start, end); + invalidate_inode_pages2_range(mapping, start / PAGE_SIZE, end / PAGE_SIZE); unlock: filemap_invalidate_unlock(mapping);