From patchwork Thu Jul 13 23:00:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312718 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 63486C04E69 for ; Thu, 13 Jul 2023 23:01:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E87EE6B007E; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5F846B0080; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D002C6B0081; Thu, 13 Jul 2023 19:01:31 -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 C17576B007E for ; Thu, 13 Jul 2023 19:01:31 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 857A9B06A7 for ; Thu, 13 Jul 2023 23:01:31 +0000 (UTC) X-FDA: 81008111982.21.D62B473 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id A29D340005 for ; Thu, 13 Jul 2023 23:01:29 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=liyRtyj0; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689289289; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0DDHRiPYhr0sd9J4288j38yiPCPs8WpS9B9X3tWRhbs=; b=kDaBUSgk3jMtRMl4DppwlYFZVcYFOG5MRkPpXO1l++K/sL+uzIg5lPpA6YlEzGrU7zlI1B 9zM/RSJZu69rnGfxmLdsVgZqprXEaGZ/5I0PkRfD2ZsHOPfTe6KG+cJ7buB5Aw1yzjm/Su AYLC2/u2Fob44ybPvWFgSSJJ0wP6AEg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=liyRtyj0; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689289289; a=rsa-sha256; cv=none; b=qXrjHHuLYQb9viCZN3HJPdqOWnozFGjYYpGvlku3JB98naO6Xig/bq7ttNBhIl/vdg8kH/ hwWaMQa4OJLzNS9WhFXvNzXQ9vJvRLFbgeo7xv+ZIOUyGRjjTVjFonqoB61SfWWfziL5dM wdjEos9RNKkVyKJn2xOTnlLrDYITdWI= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3CDD61B23; Thu, 13 Jul 2023 23:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285D7C433B7; Thu, 13 Jul 2023 23:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289288; bh=2uDpIMGQVMt/gC4T/BxJPAgKQID6PeU0gqKfksNKWnI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=liyRtyj08RhKgd05d/GbjIK8eAKSM10LdUJBz7UuFOcUyezObweCSPR4L5Jm7d/3+ J9oIvEYe6CWGwt55Hx9zbqLwPbb7BBKC8OMsAe7qX+kkwyjZAQBfJ+ADRMrXxSSmW8 Xzwhwg78up7SO0XMuFLZ6g+/2Pu108+rBwN7yk/z/7oyzpziWvzwOA3XIxMpCer4y9 lDdui9+QJ0qeG2V6Gtk4RHRd2VjBrRFJoqgHMQsHg6pmArcdKXD18EFN0CSdElLHCP iu0JCzqZtl2wBu87Ybj2JDoeOy/UseVuaxAORwjKb983nHW0GT8ewtb0Icu2w+Gl8j yMGVOCivsa/7g== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:52 -0400 Subject: [PATCH v5 3/8] tmpfs: bump the mtime/ctime/iversion when page becomes writeable MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-3-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Alexander Viro , Christian Brauner , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , "Darrick J. Wong" Cc: Dave Chinner , v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1641; i=jlayton@kernel.org; h=from:subject:message-id; bh=2uDpIMGQVMt/gC4T/BxJPAgKQID6PeU0gqKfksNKWnI=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIusbBzLs0MybgDecBYC1rFLHPwWpvQ+zecR awgGePAm6qJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FcSGEACub8Fc5S/WfyUSGxfmCSi3555ycDn+zVKXSPPiQKW1TR9LYRkybKANZmP0XYzYILSUfkU ORbNjYimhQNCSxlPeeC40MyHzjga0VRHqurUT8qqaVIVJ0nl+StBd40KLXAljpP3WXM1fGUAjvH vqO6pP6I3K3R/4qwCRMhWrNAcqt+qYKWVUUztTablCUbuklzQoblG24U2NK2DUfGepPumyDoeLH wYod7Y1kJ92qyEoEOPNjj1+tfqjWvN7+tAsFQwpD+N0sljCCXcg2XWKOgVJBsYaXx5OEbRfi6s3 ryBXi9Xk0/jA6otq2rUp6HaQyJkl6teNxs+4rz75eCu8rN02oQaqFzL83u3vBt3uPmVA1pHdS8E cYZhQx3P7nvLTFlUjA0Rbi4sH0FtHNJd3k1Gzcl8UkDcxVz29S7geHX+Nfj1BSUqKI8uA6NsJuI nzON+pBrEdS0RRFHXzAKsdPlG285eEeNPzqWMmCPQ8I0XVLSP4vbJ+WFJhx6uO+c2gz3VEz5rKg 46OipSdHjwUcz6Ps1TPvZpf/Z2bvpL5yiA+tPHgQX1nrRyMepOjxjN4vJX/dTEcENn7ySGN2vWY /RoI7eVxl9z18K25MgUs7+5WZGKkUPepl/96nVkOPQyWbt7euX8Tx6c+OgzD7T9pvDRi9idRO+a oNvcYRCw+z4sY9A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: A29D340005 X-Rspam-User: X-Stat-Signature: 7cwszx1cjaqq7xqmfqi381samhu3aaj5 X-Rspamd-Server: rspam01 X-HE-Tag: 1689289289-73476 X-HE-Meta: U2FsdGVkX1/xPD9pIGXaghXQRRJ5FF+5CG8TPUGtlfwXzP24sFvGKAzL+PRY2ZhOnb3lpv8b3hbukgL3lKhXrv8U4hU/7Uk4Nb9fyP4rl81RESfiBuw76wHKrXcjKV9lGylLfuKoloiWGKB9jk6FJ5nPBw5aqsRlmPEl3UwGwse7iBO9E9fQAZSScag8XtPScOFFkoaxOb4Tb3sNvVsrEB7GmvuyE0rG57YYpDHvTta3jWO7+XtFxIWMlKejM36fly6zIN6Z5/RHbjjsIRRzxCIm/ys/65FCDplwjfdmWiNFdktV2i9VWtjJ54xoubwKHPxHIntS2f+qU7Hu6CF13HeMdyKeVymmL8pe0mMYbwulCEtTY2Jm3oxtBSMjoPCk1JbZUnwaOUVIUwY3lFlil/mPB1kDyGlc5hbbYl1YB6y/fCwHqC+ctHYz3TkFe2xwslrF71SQ85kCAM+5QhEuK8QPJHu0ctTrOkdnXdjrLhoy/k56k2vkgcPz14yeAtDnQjWVKELT3vge0FLCmHm5zY+NIL9Y/QA8FAPPAbASMM81KjaxcRfMKT8iYvH1DOngSj0wNzQ5IL7YiHtZLGbmv5rj06XkoezQ1gLmkep29x0sEKhrEKJx3/buKFh+h0jf27YpsdHlqrUl1OopmRgWt66O1EZIBjGyDNxVeVF0esqtWESI/XOKly5k8ksuBWCR+VBAvLISzb7p8O8XXqO1ms7ZSdl/oaAw+LRVIAssHwI+77YId50LgrG8z0eWKo3iVQ/k6smKTc5a4YA3TCNHFsdWAj+Ll+BcrgX1dh8d+MQ7ZnX4k0R23SK/DHCNGpRhk1sdFdzc0EsMViHSpbzVKId1hQdb4EGUXvS056Y4T2Mz09/QgfTL2G5j9RCoPG6gyC6gQBgDe9FnzjBY42qIjMSEqnkVmLVRZdJEdTGNpVnp1w91SlNIma1zfracNwo0N/jJ6lpJo2nxecS50dK k4hStTUA Q8ic4hLBQBj9HepD4BwUn9Xex6ihfNmZSBhC6IOaOQlawCNy2PlmOZh4CKKyGdILhlA1QihmlF9t3zYVZoYlEWmRhllEbPCAtcaZZ78cWHq4nYjBP4spJSq7DBZQTJTp+TBYZ1X/5MluGDjJV1F7ukR0OS20opGvFHjQI+0ag2Oue75ltzRu16EFgLmNiX1vig20vkteE1bHqY2Gz7h1i0pp4RXrQVx8LOAKV92CxDnV3womyMa74vmDBulNBfFCaTDI0rdTD1H/9ZlT1tIPsY9qcaX+CDP/iQO1omBd5GntyPm9ntmckoCJ9UrwdJxMIXdZrCbuDxnRRC6gIN+5nYKJBLqyv2xzYevTx 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: Most filesystems that use the pagecache will update the mtime, ctime, and change attribute when a page becomes writeable. Add a page_mkwrite operation for tmpfs and just use it to bump the mtime, ctime and change attribute. This fixes xfstest generic/080 on tmpfs. Signed-off-by: Jeff Layton --- mm/shmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index b154af49d2df..654d9a585820 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2169,6 +2169,16 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf) return ret; } +static vm_fault_t shmem_page_mkwrite(struct vm_fault *vmf) +{ + struct vm_area_struct *vma = vmf->vma; + struct inode *inode = file_inode(vma->vm_file); + + file_update_time(vma->vm_file); + inode_inc_iversion(inode); + return 0; +} + unsigned long shmem_get_unmapped_area(struct file *file, unsigned long uaddr, unsigned long len, unsigned long pgoff, unsigned long flags) @@ -4210,6 +4220,7 @@ static const struct super_operations shmem_ops = { static const struct vm_operations_struct shmem_vm_ops = { .fault = shmem_fault, + .page_mkwrite = shmem_page_mkwrite, .map_pages = filemap_map_pages, #ifdef CONFIG_NUMA .set_policy = shmem_set_policy, @@ -4219,6 +4230,7 @@ static const struct vm_operations_struct shmem_vm_ops = { static const struct vm_operations_struct shmem_anon_vm_ops = { .fault = shmem_fault, + .page_mkwrite = shmem_page_mkwrite, .map_pages = filemap_map_pages, #ifdef CONFIG_NUMA .set_policy = shmem_set_policy,