Re: [RFC PATCH v4 07/10] nfsd: add provenance time (ptime) via FATTR4_TIME_CREATE
From: Chuck Lever
Date: Wed Nov 18 2026 - 11:11:20 EST
On Wed, Nov 18, 2026, at 2:44 AM, Amir Goldstein wrote:
> On Tue, Nov 17, 2026 at 11:02 PM Chuck Lever <cel@xxxxxxxxxx> 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.
>
> In other words, for some server filesystems FATTR4_TIME_CREATE is
> settable and for others it is not.
>
> Isn't the NFSv4 protocol equipt to deal with this complexity?
Not a question of whether NFSv4 _can_ do it. It's whether it _should_
and whether opaquely choosing a settable vs. an immutable timestamp
on the server is the right design.
>> Essentially this changes the semantics of existing files that have
>> a btime set -- technically that's a regression.
>
> I fail to see in what situation this is a regression. Please explain.
Any consumer that depends on btime being read-only is now screwed.
--
Chuck Lever (Come to NFS bake-a-thon! https://nfsv4bat.org)