Re: [RFC PATCH v4 07/10] nfsd: add provenance time (ptime) via FATTR4_TIME_CREATE
From: koraynilay
Date: Tue Nov 17 2026 - 19:35:31 EST
Hello and thanks for replying,
On Tue Nov 17, 2026 at 11:01 PM CET, Chuck Lever wrote:
>
>
> On Sun, Nov 15, 2026, at 1:03 PM, koraynilay wrote:
>> Implement provenance time (ptime) in NFSD, as introduced in a
>> previous commit ("vfs: add provenance time (ptime)").
>>
>> Map ptime to FATTR4_TIME_CREATE, allowing clients to set it across
>> CREATE, OPEN and SETATTR compounds.
>>
>> If the underlying filesystem supports it, use __vfs_fileattr_set_locked()
>> to set it, returning -EOPNOTSUPP in case it's not supported (i.e. when
>> __vfs_fileattr_set_locked() returns -ENOIOCTLCMD).
>>
>> When querying FATTR4_TIME_CREATE, request both STATX_PTIME and
>> STATX_BTIME, preferring ptime over btime if available, and advertise
>> FATTR4_TIME_CREATE support if either ptime or btime is available.
>>
>> Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.7
>> Signed-off-by: koraynilay <koray.fra@xxxxxxxxx>
>
>> @@ -3646,7 +3649,14 @@ static __be32
>> nfsd4_encode_fattr4_time_access(struct xdr_stream *xdr,
>> static __be32 nfsd4_encode_fattr4_time_create(struct xdr_stream *xdr,
>> const struct nfsd4_fattr_args *args)
>> {
>> - return nfsd4_encode_nfstime4(xdr, &args->stat.btime);
>> + const struct timespec64 *ts;
>> +
>> + if (args->stat.result_mask & STATX_PTIME)
>> + ts = &args->stat.ptime;
>> + else
>> + ts = &args->stat.btime;
>> +
>> + return nfsd4_encode_nfstime4(xdr, ts);
>> }
>
> I have trouble with this approach.
>
> We've already established that, for the Linux in-kernel NFS server
> implementation, FATTR4_TIME_CREATE reports a file's birth time and
> does not permit NFS clients to modify that.
>
> After this patch is applied, the server reports the ptime instead
> of the btime on some filesystems but not others.
I implemented it in this way to have a proof-of-concept of how ptime
could be use by filesystems that already support settable btime (as was
suggested to me in [1]).
There was also a discussion in v3[2] on NFS's FATTR4_TIME_CREATE as an
example of such a filesystem
> Essentially this changes the semantics of existing files that have
> a btime set -- technically that's a regression.
and since the NFS protocol itself states that FATTR4_TIME_CREATE should
be user-settable, I think adhering more to it would be better.
This would be fine even for already existing files IMO, since btime =ptime if the user doesn't manually change it (or with --preserve=ptime
for the various copying tools).
Thanks,
koraynilay
[1]: https://lore.kernel.org/CAOQ4uxiuy0VwZj+3M-zRqQ49WTpHZpiaQ+6MZ8z8WdLjyQM_zA@xxxxxxxxxxxxxx/
[2]: https://lore.kernel.org/20261103094906.n55n5dhrpct5ykmw@pali/
Attachment:
signature.asc
Description: PGP signature