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 13BD9CD54BA for ; Tue, 19 Sep 2023 11:05:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86B4B6B04F4; Tue, 19 Sep 2023 07:05:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F1F76B04F5; Tue, 19 Sep 2023 07:05:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 644426B04F7; Tue, 19 Sep 2023 07:05:04 -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 504B26B04F4 for ; Tue, 19 Sep 2023 07:05:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1B18BB3D7D for ; Tue, 19 Sep 2023 11:05:04 +0000 (UTC) X-FDA: 81253064928.30.1EA93FE Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf16.hostedemail.com (Postfix) with ESMTP id C1D4F18002B for ; Tue, 19 Sep 2023 11:05:00 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=cJr+PwvU; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=meYxUUYP; dmarc=none; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695121501; 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=2a6e2yyPMgqeI3y+2Rnc2fZeeo+kgiK2m70Hco9fnr4=; b=QsaVfYPr1U9VbApYJyMBDDejmaNIXFT8e9dkVM1DvCZwdB3S1oBijVXKDyaHgcPI/UmP0w 5UZjrPo8IZbPcxwy4/7DYDU64iTR5hSalDVlNAvZtq462wDFwMQhXrK3SB0lhfo/DFS0fa vi5iZu1In1hMl4jPy4S3xjWubuUXf+4= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=cJr+PwvU; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=meYxUUYP; dmarc=none; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695121501; a=rsa-sha256; cv=none; b=xDud1dCn8DP6SaW2FI2K4ROoHAaRiuZeObqAqGWr+4+LvqySsHZzv9byM6Y0X66R/1JHQG weKuujKD1IGFp3HednqtbscYb/89exxyGIlp1C7Ij716oz4t2TC4AsUdhLUzbCyk/X4YdA HLpWiP/0O4YT8k9oq8g/gpWVpBFNdyw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5342D1FE31; Tue, 19 Sep 2023 11:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1695121498; h=from:from:reply-to: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; bh=2a6e2yyPMgqeI3y+2Rnc2fZeeo+kgiK2m70Hco9fnr4=; b=cJr+PwvUYyZH2t3upcBw0eryf4DE/LlFfn7Ufm2eAWd1VY02qygFmTzBIaJahVSz94O4Vb yGqIOI0jCW0Ip0Sk2rToBmP3VAYVKS3al3oLycPIe7d7v/sSOaNYyizpxk5ZIrSJFN93/P SUBM4OkiK17iPKtzTKMO612fqmtdvLg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1695121498; h=from:from:reply-to: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; bh=2a6e2yyPMgqeI3y+2Rnc2fZeeo+kgiK2m70Hco9fnr4=; b=meYxUUYPlIj0HPS4xS8OLRDZWnsHTMsdExQo9ACa74+dnEYe0U3v8eAO6qjvM08RQNmwM8 rVywJglnBJnDHgDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0A0D613A49; Tue, 19 Sep 2023 11:04:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wCZPAFqACWVOYAAAMHmgww (envelope-from ); Tue, 19 Sep 2023 11:04:58 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 11C86A0759; Tue, 19 Sep 2023 13:04:57 +0200 (CEST) Date: Tue, 19 Sep 2023 13:04:57 +0200 From: Jan Kara To: Xi Ruoyao Cc: Jeff Layton , 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 , OGAWA Hirofumi , 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@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, Jan Kara , bug-gnulib@gnu.org Subject: Re: [PATCH v7 12/13] ext4: switch to multigrain timestamps Message-ID: <20230919110457.7fnmzo4nqsi43yqq@quack3> References: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> <20230807-mgctime-v7-12-d1dec143a704@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: C1D4F18002B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-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hTpZesTaFOpqDxawEK2jOy8G9LmCFJYmBYW74hdOclLSDWGRU5zpxFLb7aEA2n5OQxXdlxSTRbTGAywOr6wlYjJHvMohoregesC/uZDzpMeM9HwA4V2kYKME4gHTCEyJy5TmBFsU9EhOT9JMNqv0UhBQtaZHVTyM6pHQf/nFULiNErtMPsRExW5It2gjSWA/IP93bYWVe7rXv04JOTDTCNVC2KgcOAcKHQpaD05pjvSMhb5oHOI/rfBP2MscMM31Q4EqNYWwkvRsIhzw792+Ghl9/mvG+DaxZ02mL35y5yPnf+Xg/PUB4/0hEkAZp+L78jB2m4a946yw== 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: On Tue 19-09-23 15:05:24, Xi Ruoyao wrote: > On Mon, 2023-08-07 at 15:38 -0400, Jeff Layton wrote: > > Enable multigrain timestamps, which should ensure that there is an > > apparent change to the timestamp whenever it has been written after > > being actively observed via getattr. > > > > For ext4, we only need to enable the FS_MGTIME flag. > > Hi Jeff, > > This patch causes a gnulib test failure: > > $ ~/sources/lfs/grep-3.11/gnulib-tests/test-stat-time > test-stat-time.c:141: assertion 'statinfo[0].st_mtime < statinfo[2].st_mtime || (statinfo[0].st_mtime == statinfo[2].st_mtime && (get_stat_mtime_ns (&statinfo[0]) < get_stat_mtime_ns (&statinfo[2])))' failed > Aborted (core dumped) > > The source code of the test: > https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-stat-time.c > > Is this an expected change? Kind of yes. The test first tries to estimate filesystem timestamp granularity in nap() function - due to this patch, the detected granularity will likely be 1 ns so effectively all the test calls will happen immediately one after another. But we don't bother setting the timestamps with more than 1 jiffy (usually 4 ms) precision unless we think someone is watching. So as a result timestamps of all stamp1 and stamp2 files are going to be equal which makes the test fail. The ultimate problem is that a sequence like: write(f1) stat(f2) write(f2) stat(f2) write(f1) stat(f1) can result in f1 timestamp to be (slightly) lower than the final f2 timestamp because the second write to f1 didn't bother updating the timestamp. That can indeed be a bit confusing to programs if they compare timestamps between two files. Jeff? Honza > > Acked-by: Theodore Ts'o > > Reviewed-by: Jan Kara > > Signed-off-by: Jeff Layton > > --- > >  fs/ext4/super.c | 2 +- > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > > index b54c70e1a74e..cb1ff47af156 100644 > > --- a/fs/ext4/super.c > > +++ b/fs/ext4/super.c > > @@ -7279,7 +7279,7 @@ static struct file_system_type ext4_fs_type = { > >   .init_fs_context = ext4_init_fs_context, > >   .parameters = ext4_param_specs, > >   .kill_sb = kill_block_super, > > - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, > > + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | > > FS_MGTIME, > >  }; > >  MODULE_ALIAS_FS("ext4"); > >   > > > -- Jan Kara SUSE Labs, CR