From patchwork Tue Jul 25 14:58:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13326614 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 AFB69C0015E for ; Tue, 25 Jul 2023 14:59:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 227DC6B0078; Tue, 25 Jul 2023 10:59:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B1D76B007B; Tue, 25 Jul 2023 10:59:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02A5E6B007D; Tue, 25 Jul 2023 10:59:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E81426B0078 for ; Tue, 25 Jul 2023 10:59:14 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3D32840ED3 for ; Tue, 25 Jul 2023 14:59:14 +0000 (UTC) X-FDA: 81050442228.08.051FBC9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 471CE80004 for ; Tue, 25 Jul 2023 14:59:11 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n2fO+6f3; spf=pass (imf02.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=1690297152; 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=45kX4Trfhh0EzQKD2sNHlzuaIV3bhKy6hyUD4UcV9LjCYGxraQcfsNPYnh284Z73KYvu1K 0ZNhSs8n3nXNQSZjrykJ0JLIShBNJXZmv9pwNsnA4oWiyJhJg55oR+5Wxxi63MegqR1DYZ xPBoDDkKz76wLj/DWg/anwrGHTyJsQo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690297152; a=rsa-sha256; cv=none; b=djPJL3qqVbI8/FQ6m2+JSWtrWoEjo/qssakVsGSYVCOp/8UGrTWH/iGA4lRD4TktNgXmsk jtK5YgQm6Z4bRwzNy1vhR1i6CQ9sFBXyL0u5onO/e28ar8O/fEKB2FX32/HL6L+EoCp30d xKKvR2xZ5B2nUTTybk/qnPcJ38vw27Y= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n2fO+6f3; spf=pass (imf02.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 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 7490661788; Tue, 25 Jul 2023 14:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EC60C433B6; Tue, 25 Jul 2023 14:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690297150; bh=2uDpIMGQVMt/gC4T/BxJPAgKQID6PeU0gqKfksNKWnI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=n2fO+6f3o9pY7IlFzt0rPNlCPvC97bsCNM+BfmqJUquIMuUUrh8omevU9O4/AHkm1 BUhGetnUcCuK1rxWP8h5CviIrVUp9eXO8jpGbYi5hteTH5Xqe5ITh/GzhKNHYCKlZk vlcYpaRegzQJvuY8ntTnypuLjutaWGFpxjpGt7wd4i0rEDrs0fPNKp6yIhyqEEdtAb 8/r999SguPHVOPOVMoBGAZsACOuuAASF/w90W4MAecKdLt6gEneLVh/fG/faExs3M6 nCO0XjvC7eMTX9Xqd+6QSmh67WMiduueljqyzpsqyRjLawhI4Oj6HHr3+rEmH8yk8G 2Ixb9ASBBSh0Q== From: Jeff Layton Date: Tue, 25 Jul 2023 10:58:16 -0400 Subject: [PATCH v6 3/7] tmpfs: bump the mtime/ctime/iversion when page becomes writeable MIME-Version: 1.0 Message-Id: <20230725-mgctime-v6-3-a794c2b7abca@kernel.org> References: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> In-Reply-To: <20230725-mgctime-v6-0-a794c2b7abca@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 , Anthony Iliopoulos , 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/ZANAwAIAQAOaEEZVoIVAcsmYgBkv+MjNDHnc3VpUZs/F8L9rjN3Zof/qnAfmWfPJ HHeEPSmh46JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZL/jIwAKCRAADmhBGVaC FcRQEAC4JBQVQ/gYYTowPETQ4WpI/KRmcf8ArByri6vezI/PnnC+6/c78VVo2CeuLvo39NWHvEc WjMBGKoIjC/rRO0g9ZTnQyG5xMCVFJm+txy5uj0RrkqVeSajWVGMi40jIG0PKIJonSTnuHRNnvv r0qqzIRryKNHPBIqhnaRnVE7lXDmsMo5PQmseWqdieD39P983bSTK3hdLBday25rstPj4a2TwIt U65Yd+CzgPnnCD8f/dWD0LThNK7BtgniJDaWOop13mmeXYnImIgU1M8iY29eCS+EPq8YjysZad3 /bEH2S2nqMnbI/nw3UQ941Rxnnmw6bEPVJnqJAOILyOesX5D82MfHRraU5UCMLp1UUkr/S/iRZf +CarYlZ09IaFEzrA5A2xvr7M4KiNkRaOEhxzDIsQnsRlyqq5jSyU3JRapUwrSogBCkWuAMZRIyG JCaLNaT6v0B5u06FAdINF6uBlVGTmgb4jdavZFZgdI9vrNqAhU42ctOi+vRusrge9q3OR0LDnTU qMHqNtWGe3Hsc2mZEDzSRaXyzcEYKHXBLlXvun2i/eibMafbVx3qIaTbmDNpFzpim2LoIXyGBld HgWK8WxTS/Hc2mF2qYRoCmLCYwcXO/X1WknZcNwcoUCIy50fLXiWyW+IvPAQjYx/4uETnI8jV8R chM8OWlWlDNeYjA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: awnyyrzkjrsutnekxmmqpx7uz8gnpnur X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 471CE80004 X-Rspam-User: X-HE-Tag: 1690297151-37937 X-HE-Meta: U2FsdGVkX198cf3b8gOhDX4o7aFvDFm6xlHfD0Q/sKnQVyRVP26eyvNaovX2SC1cdzsg99TUlH0k9b4Leu7orZLVJ8sykuJKTuscqbxvw8t0oWYPqaUHGayzNqwU0K6PKiA4e31YHY5ldPHkm9B4qWFxhIF11RgDLsqxxxQeGMJgNe6CRjajawVhcNJxF/2HlAr6tTnuJG7/+6OFLbPVon9nS7ed7TeOJETivkP0vgvsGVyldhFaOLyVwxfh6cz3EE/Gvz/yLIuvN+tdBH2NY5c6rRpDqj394uJ7oa6Hgrw0Aw/zQCuAg5sq7LBJ8uLk8Mt1IN1YhM0qPDbPZ6CNRqyQhWF3TS0e7IgTXpgvsVS75a+wvNCQbIl4XmwOZO+0V+Cnp8tbqO+rl9YuqwtXADa/1VVgAiwxJEh6/2XnrnKO3Y6n0xxb1QO0rP7I8Kjbdq/E0U11YGYqQsuLMOj+hikQM+h4978JzKFzPaqdraMoD6gvMFAbbMuP/GzJizO3lkJHAVGp2gY56tTPtrKkcJlVHY/EiI1hZpLO893dZymWEY27iW0L8R48b0mEnFSM2BYE9oGxTwpxzmmUTqdnuRsWrleQG1bRhOl5a8sm3aaacChr6D9dljjz9HM/6hK0Eb206c9fhi7uHM/smmtVGIskv6oI+Ae+37mtsZKzz8h9A4E8+gTDehPROfdBOKsfEQPMnDegDrFXmDqQe5KKPKmv49ytH13S4dltzTD32Y2f14S4x0wu3tizUA8CEV5EjC9QnKztBFh9TCDBDe10n/a0+BX/wik43sqxgaBnzf0KjxliiR88cecGZymU6xTFgV/4INIDanzZc5SHHK03fxs/+QZ5cOsgtKWohHzcpbexnDYSJQ3oRF9+cfgAOaGnXCiYPjVEIce3V8i3AlW7A6V9+Sq+fT+7FKXyEHYrOFsEzYm3KG4zHPFgsV3WsxKR6vEQPQ0U+qik52Yjj46 kzCOIJ9d cLooc1i9801na7Rz24rnNpdNrnJYthldb40qtZjNhUxiZHjAbrJOm6a9W6bYQPSrr6QjPcK09sJjhoETvEDx5uo+nPyeDLg3b1qxfGQ/3HWlYYu0TBD4Hy5QNi6pax/HadbpoGKbuI3S6IzcvCeCgx16DrCdN62+4l3MJp10HG1HrF5YlnCU9/DWuELzl3SxKOxkfFZ/sDbkiuTq2VZao/dRxyu7RAKvTqj90MTLnpzR/nPfZIpXNetCozRNYoB4O1VSYxQU8ADXBcCeDMPsQZrBNu6GV0mFA808NsUcyx/wZtPkk8PcJGYw9DTq0CWqXSvh3WiOp2F8dzSjgsMv5GE6ARoWRTepJ6ibo 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,