Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5542321rwb; Wed, 7 Sep 2022 04:39:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Bm2fXLqE0WY3a0vZaY7HZwxol07OS/9wfXqlXh8RJfqxMT1LozVBUxKqSDjR9vI1YrIXj X-Received: by 2002:a17:907:7f91:b0:741:a071:cdb3 with SMTP id qk17-20020a1709077f9100b00741a071cdb3mr2029372ejc.522.1662550757179; Wed, 07 Sep 2022 04:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662550757; cv=none; d=google.com; s=arc-20160816; b=ZOTtzJUmwn0ifzQCp685HN0+AVg1tyUT/kZPgbrjp7C/LdYif45Hcr5iSCw4dsc6LP b7+HSIK8j5RNoFj+1/bvBrNm/yUfC7/PaaVjPldaXzkuDQi9gFL/daXaE9wczHukYDS3 KG5KB03mPnX673IQaa0a7l3Exe2O8KSlDWSLE2HAmqMvRHPlh76tlpu/r5nYe5vV1qLh my0oc9Wr4gnXqelT4N8VlsucdU7ifS04BFtWV7W/VsEKG8imBkc9XIuYLDrWHcxG7nRa rq96qUmJ2Pmwuzsw6YYtxG2GOAswVchxzJYb0ORP62P11iJVT+q01WPB3JZ7tJOw493o 7yKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=tE1XoLgnrZpzEH6euiwkJypGJJUmLz4xR9DexdFjOJ4=; b=oivXT+oEXKahp3w0hlKXPfbIiMnSN9mHwkM5sM4YO64jNW13mYQH0WD5EUG6S8lXql ada/8BzmENvcgSiogVL/WEOXYCgTvBPPi4TqWJ5En8R63Xe8r/V0StyTnkx6KNnG8hfh JefX4xkvgE85YXUiWjjNmMOIkrnRowT4oN5XWRL3CiVf935alqPRkidMZMhMp5AEhx5d 7xxtDOH24xNDJGMyF3i3mMDIECkog8ktC1pHY2bllMUhEwBo4H1cUSfjp8DgoFT96vPq oMwl5jq+o0Z5g8gc21Fko4R1izjj+ZEMQAaoI8w24S04p8Rfd3XvqujTZqK7WZSjY9tD uF0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LyYRljNg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vJIO9PbE; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170906641200b0073d7f0bf549si10495740ejm.228.2022.09.07.04.38.53; Wed, 07 Sep 2022 04:39:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LyYRljNg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vJIO9PbE; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiIGLiN (ORCPT + 99 others); Wed, 7 Sep 2022 07:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbiIGLiF (ORCPT ); Wed, 7 Sep 2022 07:38:05 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43BAA5F92; Wed, 7 Sep 2022 04:38:03 -0700 (PDT) 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-out1.suse.de (Postfix) with ESMTPS id EE90333D2D; Wed, 7 Sep 2022 11:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662550681; 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=tE1XoLgnrZpzEH6euiwkJypGJJUmLz4xR9DexdFjOJ4=; b=LyYRljNgc6/VnQIjrYS3ds20eTshSKH1VN/tPWbBizpjZwVtt/BfaE1/B/uezZe493ox11 JQp/scL3B/xjpcHU7VQ0kTcADmJQjr2X9rEn6hkfimr+YkfNnuPRQY+ZKgGxgM9HPo9uLp VTy6gabBcTuULJAZDGZrxzmWk+vJjGI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662550681; 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=tE1XoLgnrZpzEH6euiwkJypGJJUmLz4xR9DexdFjOJ4=; b=vJIO9PbEDGCWsa1EILbbdT5it51xjU0T7ZIZqInKIK1bhQuspB00LHW++WhsaDxfBXS5ax QfwLzY4/7oC7fWDw== 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 861BC13486; Wed, 7 Sep 2022 11:37:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WsufDpKCGGMmaAAAMHmgww (envelope-from ); Wed, 07 Sep 2022 11:37:54 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: tytso@mit.edu, adilger.kernel@dilger.ca, djwong@kernel.org, david@fromorbit.com, trondmy@hammerspace.com, viro@zeniv.linux.org.uk, zohar@linux.ibm.com, xiubli@redhat.com, chuck.lever@oracle.com, lczerner@redhat.com, jack@suse.cz, bfields@fieldses.org, brauner@kernel.org, fweimer@redhat.com, linux-man@vger.kernel.org, linux-api@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [man-pages RFC PATCH v4] statx, inode: document the new STATX_INO_VERSION field In-reply-to: <20220907111606.18831-1-jlayton@kernel.org> References: <20220907111606.18831-1-jlayton@kernel.org> Date: Wed, 07 Sep 2022 21:37:33 +1000 Message-id: <166255065346.30452.6121947305075322036@noble.neil.brown.name> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, 07 Sep 2022, Jeff Layton wrote: > I'm proposing to expose the inode change attribute via statx [1]. Document > what this value means and what an observer can infer from it changing. >=20 > Signed-off-by: Jeff Layton >=20 > [1]: https://lore.kernel.org/linux-nfs/20220826214703.134870-1-jlayton@kern= el.org/T/#t > --- > man2/statx.2 | 8 ++++++++ > man7/inode.7 | 39 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 47 insertions(+) >=20 > v4: add paragraph pointing out the lack of atomicity wrt other changes >=20 > I think these patches are racing with another change to add DIO > alignment info to statx. I imagine this will go in after that, so this > will probably need to be respun to account for contextual differences. >=20 > What I'm mostly interested in here is getting the sematics and > description of the i_version counter nailed down. >=20 > diff --git a/man2/statx.2 b/man2/statx.2 > index 0d1b4591f74c..d98d5148a442 100644 > --- a/man2/statx.2 > +++ b/man2/statx.2 > @@ -62,6 +62,7 @@ struct statx { > __u32 stx_dev_major; /* Major ID */ > __u32 stx_dev_minor; /* Minor ID */ > __u64 stx_mnt_id; /* Mount ID */ > + __u64 stx_ino_version; /* Inode change attribute */ > }; > .EE > .in > @@ -247,6 +248,7 @@ STATX_BTIME Want stx_btime > STATX_ALL The same as STATX_BASIC_STATS | STATX_BTIME. > It is deprecated and should not be used. > STATX_MNT_ID Want stx_mnt_id (since Linux 5.8) > +STATX_INO_VERSION Want stx_ino_version (DRAFT) > .TE > .in > .PP > @@ -407,10 +409,16 @@ This is the same number reported by > .BR name_to_handle_at (2) > and corresponds to the number in the first field in one of the records in > .IR /proc/self/mountinfo . > +.TP > +.I stx_ino_version > +The inode version, also known as the inode change attribute. See > +.BR inode (7) > +for details. > .PP > For further information on the above fields, see > .BR inode (7). > .\" > +.TP > .SS File attributes > The > .I stx_attributes > diff --git a/man7/inode.7 b/man7/inode.7 > index 9b255a890720..8e83836594d8 100644 > --- a/man7/inode.7 > +++ b/man7/inode.7 > @@ -184,6 +184,12 @@ Last status change timestamp (ctime) > This is the file's last status change timestamp. > It is changed by writing or by setting inode information > (i.e., owner, group, link count, mode, etc.). > +.TP > +Inode version (i_version) > +(not returned in the \fIstat\fP structure); \fIstatx.stx_ino_version\fP > +.IP > +This is the inode change counter. See the discussion of > +\fBthe inode version counter\fP, below. > .PP > The timestamp fields report time measured with a zero point at the > .IR Epoch , > @@ -424,6 +430,39 @@ on a directory means that a file > in that directory can be renamed or deleted only by the owner > of the file, by the owner of the directory, and by a privileged > process. > +.SS The inode version counter > +.PP > +The > +.I statx.stx_ino_version > +field is the inode change counter. Any operation that would result in a > +change to \fIstatx.stx_ctime\fP must result in an increase to this value. > +The value must increase even in the case where the ctime change is not > +evident due to coarse timestamp granularity. > +.PP > +An observer cannot infer anything from amount of increase about the > +nature or magnitude of the change. If the returned value is different > +from the last time it was checked, then something has made an explicit > +data and/or metadata change to the inode. > +.PP > +The change to \fIstatx.stx_ino_version\fP is not atomic with respect to the > +other changes in the inode. On a write, for instance, the i_version it usu= ally > +incremented before the data is copied into the pagecache. Therefore it is > +possible to see a new i_version value while a read still shows the old dat= a. Doesn't that make the value useless? Surely the change number must change no sooner than the change itself is visible, otherwise stale data could be cached indefinitely. If currently implementations behave this way, surely they are broken. NeilBrown