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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2120AC0015E for ; Wed, 9 Aug 2023 17:59:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 519146B0075; Wed, 9 Aug 2023 13:59:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A2E96B0078; Wed, 9 Aug 2023 13:59:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31C206B007B; Wed, 9 Aug 2023 13:59:39 -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 1C49E6B0075 for ; Wed, 9 Aug 2023 13:59:39 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 847E680FB1 for ; Wed, 9 Aug 2023 17:59:38 +0000 (UTC) X-FDA: 81105328836.15.737552A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id ACE6F120024 for ; Wed, 9 Aug 2023 17:59:35 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=meGLBjWx; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691603976; 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=ZJYkWobh6KEl/9KBdVbAet9rd5oJbzUXYYantWtSSuI=; b=ab43ZlcbDsMXNTegmoUt6CCFlDR42mNEZ5FTQOWwytY6qCvKR/XxT7NFXeIRAhITBkiq06 i9GJ2iB+HzrNww6i5kG9bFGNyY0VonM9aW/FqnQWPuTX7WwdXi1yBqgrf4LqD3Np8hU187 4M5tuNbyR1zhNIIT3Ok/1aX0xscV2YU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=meGLBjWx; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691603976; a=rsa-sha256; cv=none; b=PkC+Xs7g5ed1EitBZl0XIM3310VJEts1obtFU8WFUlxn0oCTPC/L6ya4ouAXzYCiXXhwaR TbKZejmtP80DLRZNZ6fbZF5UjbJXSAQAWUUoXDDkasLbeSis6WDMm4OzWQN0Spu+/HdYtL mzwpDx1j3hlcK75UKGDHjPspcq10bOA= 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 6A7C864360; Wed, 9 Aug 2023 17:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5192AC433C8; Wed, 9 Aug 2023 17:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691603973; bh=xOe+Vz95v0qUUg0QOdDgphymvgENzflkYZLnMMULJfc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=meGLBjWxluzaOBNuo8p0RmOQwgxUuFNZjvOIrqHLsT0YVm/rgDHwnHDJAx99/2L/o bhtobjoD8C6zGB5rdBPrQ785IrHaS3N4jJtTCfHc34NT0geG1/U9IaQFq3S4WuZ+t8 gzoPyUaQOM1ROi1uUYhm2o1c3laLFRiCZK/Lx2Wm4O80TbvA4CQm+kAJim7vyqiQ1H 44XIoEDh201mHVX5XJvZmC/E4Ogx1IKt/t/nyvPCcopm66rc52em9DBbgLmnfaxUsA shBRwdOI1wQgTtwpw38zZcoHm5c5hE7yNnsry2zyL7HvpHmwfSKALId/x1hyiXL2cb CwGZoXi1fmKhQ== Message-ID: Subject: Re: [PATCH v7 05/13] fat: make fat_update_time get its own timestamp From: Jeff Layton To: OGAWA Hirofumi Cc: Jan Kara , Alexander Viro , Christian Brauner , 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 , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , 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 , Amir Goldstein , "Darrick J. Wong" , Benjamin Coddington , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@telemann.coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.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-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org Date: Wed, 09 Aug 2023 13:59:26 -0400 In-Reply-To: <87leek6rh1.fsf@mail.parknet.co.jp> References: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> <20230807-mgctime-v7-5-d1dec143a704@kernel.org> <87msz08vc7.fsf@mail.parknet.co.jp> <52bead1d6a33fec89944b96e2ec20d1ea8747a9a.camel@kernel.org> <878rak8hia.fsf@mail.parknet.co.jp> <20230809150041.452w7gucjmvjnvbg@quack3> <87v8do6y8q.fsf@mail.parknet.co.jp> <2cb998ff14ace352a9dd553e82cfa0aa92ec09ce.camel@kernel.org> <87leek6rh1.fsf@mail.parknet.co.jp> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 51yrud999gbf5f7fk9rbzgj4napc54dx X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: ACE6F120024 X-HE-Tag: 1691603975-452108 X-HE-Meta: U2FsdGVkX1+tCU9e8DFsZsnOVCxVrm9OSZbKS2WkUXwPx3A3kRhMA3aRBC2gE9hEQUrKBw26CmRSbsEZVKb6m4CtjoYHYjOU8sPBel+gZUYhvxkui+3tXtfhK2+4NUI3ixDsBigVCusGrzxbyYb797S0XBT/h3fgyQTM68ZItOaEovnREWJMB/snjztuoOGLB2hkHU+LU7zkA/heybeA187q8PPyr0opsuqSuepXUGUpr5f7mZZ3P14jM8XjzzTqTMcPcjrdbCU8uhurC5+EPmEZWEWuyUEY2fSDy8jdj2TY0RB1v9p0UNlob+uPYVI2T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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: On Thu, 2023-08-10 at 02:44 +0900, OGAWA Hirofumi wrote: > Jeff Layton writes: >=20 > > On Thu, 2023-08-10 at 00:17 +0900, OGAWA Hirofumi wrote: > > > Jan Kara writes: >=20 > [...] >=20 > > My mistake re: lazytime vs. relatime, but Jan is correct that this > > shouldn't break anything there. >=20 > Actually breaks ("break" means not corrupt fs, means it breaks lazytime > optimization). It is just not always, but it should be always for some > userspaces. >=20 > > The logic in the revised generic_update_time is different because FAT i= s > > is a bit strange. fat_update_time does extra truncation on the timestam= p > > that it is handed beyond what timestamp_truncate() does. > > fat_truncate_time is called in many different places too, so I don't > > feel comfortable making big changes to how that works. > >=20 > > In the case of generic_update_time, it calls inode_update_timestamps > > which returns a mask that shows which timestamps got updated. It then > > marks the dirty_flags appropriately for what was actually changed. > >=20 > > generic_update_time is used across many filesystems so we need to ensur= e > > that it's OK to use even when multigrain timestamps are enabled. Those > > haven't been enabled in FAT though, so I didn't bother, and left it to > > dirtying the inode in the same way it was before, even though it now > > fetches its own timestamps from the clock. Given the way that the mtime > > and ctime are smooshed together in FAT, that seemed reasonable. > >=20 > > Is there a particular case or flag combination you're concerned about > > here? >=20 > Yes. Because FAT has strange timestamps that different granularity on > disk . This is why generic time truncation doesn't work for FAT. >=20 > Well anyway, my concern is the only following part. In > generic_update_time(), S_[CM]TIME are not the cause of I_DIRTY_SYNC if > lazytime mode. >=20 > - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false)) > + if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && inode_maybe_inc_iversion(i= node, false)) > dirty_flags |=3D I_DIRTY_SYNC; >=20 That would be wrong. The problem is that we're changing how update_time works: Previously, update_time was given a timestamp and a set of S_* flags to indicate which fields should be updated. Now, update_time is not given a timestamp. It needs to fetch it itself, but that subtly changes the meaning of the flags field. It now means "these fields needed to be updated when I last checked". The timestamp and i_version may now be different from when the flags field was set. This means that if any of S_CTIME/S_MTIME/S_VERSION were set that we need to attempt to update all 3 of them. They may now be different from the timestamp or version that we ultimately end up with. The above may look to you like it would always cause I_DIRTY_SYNC to be set on any ctime or mtime update, but inode_maybe_inc_iversion only returns true if it actually updated i_version, and it only does that if someone issued a ->getattr against the file since the last time it was updated. So, this shouldn't generate any more DIRTY_SYNC updates than it did before. --=20 Jeff Layton