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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDD13C46CA1 for ; Mon, 18 Sep 2023 19:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbjIRTjr (ORCPT ); Mon, 18 Sep 2023 15:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjIRTjq (ORCPT ); Mon, 18 Sep 2023 15:39:46 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91731101; Mon, 18 Sep 2023 12:39:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A13B6C433C9; Mon, 18 Sep 2023 19:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695065981; bh=hR/nLlP8z29UKnEn3m5fjx9kJXqIXzhgNBoFQGa+RFo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=IQfVRv7jHDsn4cdMac4PvP2FVTTYv8ZRlbnK3UvnbA+lIGAfWaFw5N2aB/0GoZspF a8z5wOhp5uLxQLqyG7jzj3YiKe342Cz8fpJVv37j4D7YT/vtdSZcv0QtObuGbgAYo5 RmRXzzSC71HXN5PkIgqJ50uRIlIGxWjSaaLXPMGSp4Kqj/H96L9JAcWB478G43zFTS aiI/41M9M88gpQjqp45WPPhBCGz0WkuYPr5F/SvwthF9FQWIkUYW7CBIWe24+FAHtw O8noAbCM7XCdhLe30I1q5e6MTV86JXtKOZYGXjgfv+hrZYs5w1EUEvy9ZhyEw8rsa+ Ga0LAePE+n/+w== Message-ID: Subject: Re: [GIT PULL] timestamp fixes From: Jeff Layton To: Linus Torvalds , Christian Brauner , Jan Kara Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 18 Sep 2023 15:39:39 -0400 In-Reply-To: References: <20230918-hirte-neuzugang-4c2324e7bae3@brauner> 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, 2023-09-18 at 11:24 -0700, Linus Torvalds wrote: > On Mon, 18 Sept 2023 at 04:54, Christian Brauner wro= te: > >=20 > > * Only update the atime if "now" is later than the current value. This > > can happen when the atime gets updated with a fine-grained timestamp > > and then later gets updated using a coarse-grained timestamp. >=20 > I pulled this, and then I unpulled it again. >=20 > I think this is fundamentally wrong. >=20 > If somebody has set the time into the future (for whatever reason - > maybe the clocks were wrong at some point), afaik accessing a file > should reset it, and very much used to do that. >=20 > Am I missing something? Because this really seems *horribly* broken garba= ge. >=20 > Any "go from fine-grained back to coarse-grained" situation needs to > explicitly test *that* case. >=20 > Not some kind of completely broken "don't update to past value" like this= . >=20 Fair point.=A0 Now that I've considered it some more, I think that commit 7df48e7d99a4 (fs: don't update the atime if existing atime is newer than "now") is not necessary. What prompted this was a bug report from the kernel test robot that showed the atime going backward on a STRICTATIME LTP test, but I think the root cause of that was the missing ctime initialization after allocation that we fixed in 0a22d3ff61b7 (fs: initialize inode->__i_ctime to the epoch). In general, we always update the atime with a coarse-grained timestamp, since atime and ctime updates are never done together during normal read and write operations. As you note, things are a little more murky with utimes() updates but I think we should be safe to overwrite the atime with a coarse-grained timestamp unconditionally. We should be able to just drop that patch from the series. Whether you want to pull the rest now or wait for a bit, I'll leave up to you and Christian to decide. Thanks, --=20 Jeff Layton