From: "koraynilay" <koray.fra@gmail.com>
To: "Amir Goldstein" <amir73il@gmail.com>,
"koraynilay" <koray.fra@gmail.com>
Cc: "David Sterba" <dsterba@suse.com>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Namjae Jeon" <linkinjeon@kernel.org>,
"Sungjong Seo" <sj1557.seo@samsung.com>,
"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
"Chris Mason" <mason@kernel.org>, "Jan Kara" <jack@suse.cz>,
"Yuezhang Mo" <yuezhang.mo@sony.com>,
"Chuck Lever" <cel@kernel.org>,
"Darrick J . Wong" <djwong@kernel.org>,
"Sean Smith" <defendthedisabled@gmail.com>,
"Andrey Albershteyn" <aalbersh@kernel.org>,
"Pedro Falcato" <pfalcato@suse.de>,
"Pali Rohár" <pali@kernel.org>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, exfat@lists.linux.dev,
ntfs3@lists.linux.dev, linux-api@vger.kernel.org
Subject: Re: [RFC PATCH v3 0/5] add provenance time (ptime)
Date: Tue, 03 Nov 2026 12:24:59 +0100 [thread overview]
Message-ID: <DMLJE2Z57AD9.1W22LSE7V9HH2@gmail.com> (raw)
In-Reply-To: <CAOQ4uxjkG=1j1z==Mv4wzkF042rXstodokKnBfMFBf2e-Eztmw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6137 bytes --]
On Mon Nov 2, 2026 at 3:54 PM CET, Amir Goldstein wrote:
> On Sun, Nov 1, 2026 at 2:57 AM koraynilay <koray.fra@gmail.com> wrote:
>>
>> This is an initial implementation of a new timestamp to indicate the
>> time when a file/directory was initially created.
>>
>> This patch series takes inspiration from the one by Sean Smith
>> <defendthedisabled@gmail.com> [1], but using
>> file_setattr()/file_getattr() as suggested by Darrick J. Wong
>> <djwong@kernel.org> in [2].
>>
>> The semantics of this new timestamp should be at least these:
>> - it should be the same as btime on a newly created file
>> - it's user-settable, so it can be preserved for backups, filesystem
>> conversions, archives and any similar operation
>> - it should be preserved every time mtime gets preserved
>>
>> and the correspondence with the other timestamps is as follows:
>>
>> ctime <-> btime
>> mtime <-> ptime
>>
>> Examples:
>> 1) a .zsh_history file created in 2019, then after a few years the user
>> decides to switch to another filesystem, copying the .zsh_history to
>> the new home, in that case btime would have the timestamp of the copy
>> and ptime would have the 2019 timestamp (just like mtime would have
>> been preserved)
>> 2) a symlink created in 2020 from the home directory to a /path going
>> through the same process as the .zsh_history, in this case it would
>> also make sense to sync the ptime to the 2020 timestamp instead of
>> keeping only the btime (so the inode creation time).
>>
>> The proof-of-concept code (for testing) for stat(1) and cp(1) is
>> available at https://github.com/koraynilay/coreutils (master branch)
>> (Note: these coreutils code changes are a prototype and won't be
>> submitted upstream as-is, but they work as expected in simple stat and
>> cp -a/--preserve=ptime tests)
>>
>> Lastly, the name "provenance" and "ptime" are not final, I personally
>> don't have a strong opinion on any name, but while testing with stat(1)
>> I noticed that "Provenance" is definitely too long for the normal
>> output, so another option which would fit well is "Origin time",
>> abbreviated as "ntime" (OrigiN time) and not as "otime", as that would
>> conflict with btrfs' internal naming and create confusion.
>
> FWIW, I agree that given the existing uses of btime and crtime in the
> kernel and various XXXprogs, using 'ptime' for kernel code is probably
> the lesser evil.
What do you think about the origiN time (ntime) (Origin: in stat)?
It would also coincidentally be alphabetically (ntime <-> mtime, n -> m)
the same as btime <-> ctime (b -> c) ahah.
> The question of how to display this in stat and tool is a different question
> that can be left to the userspace developers.
>
> The UAPI headers uses Birth time language and stat displays:
>
> Access: 2026-11-02 15:22:27.067329367 +0100
> Modify: 2026-11-02 15:22:27.067329367 +0100
> Change: 2026-11-02 15:22:27.067329367 +0100
> Birth: 2026-11-02 15:22:27.067329367 +0100
>
> If the UAPI headers will use consistent language:
>
> + /* provenance (settable creation) time */
>
> + __s64 fa_ptime_sec; /* provenance (settable creation) time
> (seconds) */
>
> I think that the man pages could be unambiguous:
>
> stat(1)
> %w time of file birth (immutable), human-readable; - if unknown
> %W time of file birth (immutable), seconds since Epoch; 0 if unknown
> %p time of file creation (mutable), human-readable; - if unknown
> %P time of file creation (mutable), seconds since Epoch; 0 if unknown
>
> statx(2)
> stx_btime
> The file's (immutable) creation timestamp.
> stx_ptime
> The file's (mutable) creation timestamp.
>
> And userspace tools could be displaying ptime as:
>
> Access: 2026-11-02 15:22:27.067329367 +0100
> Modify: 2026-11-02 15:22:27.067329367 +0100
> Change: 2026-11-02 15:22:27.067329367 +0100
> Create: 2026-11-02 15:22:27.067329367 +0100
> Birth: 2026-11-02 15:22:27.067329367 +0100
>
> If they want to, without that being more confusing than Provenance.
That's fair, I don't like too much the fact that this would have a
different name vs the variable name (as all other timestamps do), but it
would be fine IMO.
>>
>> v2 changes:
>> - fix permission bypass leading to ptime update on immutable and
>> append-only files (found by sashiko[3])
>> - normalize ptime timestamp as done in fs/attr.c:notify_change() (found
>> by sashiko[3])
>> - fix wording in vfs patch to be like the cover-letter
>>
>> v3 changes:
>> - vfs: reject setting ptime with -EOPNOTSUPP on filesystems that do not
>> support it instead of silently ignoring it (found by sashiko[4])
>
> Please see my review on patch 1/5 on exporting the supported mask
> to userspace.
>
>> - vfs: fix not being able to clear immutable and append-only on files
>> with ptime, and allow updating immutable/append-only atomically along
>> with ptime (found by sashiko[4])
>> - btrfs: validate on-disk ptime nanoseconds and reset to otime if
>> invalid (found by sashiko[4])
>> - btrfs: avoid re-assigning ptime on unrelated chattr calls (found by
>> sashiko[4])
>> - add ntfs3 and exfat support as suggested by Amir Goldstein[5], but no
>> vfat, smb, or nfs4 yet as they are a bit more complex
>
> Please explain what makes them more complex.
> My concern is that I would like to see that the proposed API fits the existing
> fs and we won't need to change the API again later to support them.
By "more complex" I mean just that when grepping the code I noticed ntfs
and exfat were very straightforward to implement, while vfat had the
msdos/non-msdos handling and smb had a completely different structure,
so I thought it would be fine to have ntfs/exfat as proof-of-concepts at
first.
For v4 I can check and see how easy/difficult to implement ptime in smb
and nfs (and vfat) is if you prefer, or keep that for v5 and v4 for the
mask change.
Thanks,
koraynilay
> Thanks,
> Amir.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-03 11:25 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 1:55 [RFC PATCH v3 0/5] add provenance time (ptime) koraynilay
2026-11-01 1:55 ` [RFC PATCH v3 1/5] vfs: " koraynilay
2026-11-02 14:00 ` Amir Goldstein
2026-11-03 11:13 ` koraynilay
2026-11-03 15:14 ` Amir Goldstein
2026-11-03 17:27 ` koraynilay
2026-11-01 1:55 ` [RFC PATCH v3 2/5] vfs: add fileattr_has_fsx_mask() koraynilay
2026-11-01 1:55 ` [RFC PATCH v3 3/5] ntfs3: make crtime user-settable using ptime koraynilay
2026-11-02 14:24 ` Pali Rohár
2026-11-02 15:09 ` Amir Goldstein
2026-11-02 15:38 ` Pali Rohár
2026-11-03 1:19 ` Andreas Dilger
2026-11-03 8:23 ` Amir Goldstein
2026-11-03 9:49 ` Pali Rohár
2026-11-03 11:04 ` koraynilay
2026-11-03 11:38 ` Pali Rohár
2026-11-03 12:11 ` koraynilay
2026-11-03 12:48 ` Pali Rohár
2026-11-03 13:37 ` koraynilay
2026-11-03 15:10 ` Amir Goldstein
2026-11-03 15:25 ` Pali Rohár
2026-11-03 17:07 ` koraynilay
2026-11-03 17:28 ` Pali Rohár
2026-11-03 17:20 ` koraynilay
2026-11-03 17:32 ` Pali Rohár
2026-11-03 17:40 ` koraynilay
2026-11-01 1:55 ` [RFC PATCH v3 4/5] exfat: " koraynilay
2026-11-01 1:55 ` [RFC PATCH v3 5/5] btrfs: add provenance time (ptime) koraynilay
2026-11-02 14:54 ` [RFC PATCH v3 0/5] " Amir Goldstein
2026-11-03 11:24 ` koraynilay [this message]
2026-11-03 15:12 ` Amir Goldstein
2026-11-03 17:21 ` koraynilay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DMLJE2Z57AD9.1W22LSE7V9HH2@gmail.com \
--to=koray.fra@gmail.com \
--cc=aalbersh@kernel.org \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=defendthedisabled@gmail.com \
--cc=djwong@kernel.org \
--cc=dsterba@suse.com \
--cc=exfat@lists.linux.dev \
--cc=jack@suse.cz \
--cc=linkinjeon@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=pali@kernel.org \
--cc=pfalcato@suse.de \
--cc=sj1557.seo@samsung.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yuezhang.mo@sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox