Re: [RFC PATCH v4 08/10] nfs: add provenance time (ptime) via FATTR4_TIME_CREATE

From: koraynilay

Date: Fri Nov 20 2026 - 08:34:13 EST


On Fri Nov 20, 2026 at 7:45 AM CET, Amir Goldstein wrote:
> On Thu, Nov 19, 2026 at 11:10 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>>
>> On Thu Nov 19, 2026 at 7:06 PM CET, Amir Goldstein wrote:
>> > On Sun, Nov 15, 2026 at 7:04 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>> >>
>> >> Implement provenance time (ptime) in the NFS client, as introduced in a
>> >> previous commit ("vfs: add provenance time (ptime)").
>> >> [...]
>> >> if (do_update) {
>> >> @@ -1061,6 +1061,7 @@ int nfs_getattr(const struct mnt_idmap *idmap, const struct path *path,
>> >> if (S_ISDIR(inode->i_mode))
>> >> stat->blksize = NFS_SERVER(inode)->dtsize;
>> >> stat->btime = NFS_I(inode)->btime;
>> >> + stat->ptime = NFS_I(inode)->btime;
>> >>
>> >
>> > As an example of what would be needed per the mutable btime proposal,
>> > adding stat->ptime and STATX_PTIME will not be needed...
>> >
>> >> /* Special handling for STATX_DIOALIGN and STATX_DIO_READ_ALIGN
>> >> * - NFS doesn't have DIO alignment constraints, avoid getting
>> >> @@ -1092,10 +1093,26 @@ int nfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
>> >> }
>> >> if (nfs_server_capable(inode, NFS_CAP_CASE_NONPRESERVING))
>> >> fa->fsx_xflags |= FS_XFLAG_CASENONPRESERVING;
>> >
>> > This would need:
>> > fa->fsx_xflags |= FS_XFLAG_CASEFOLD;
>> > + fa->fsx_xflags_mask |= FS_XFLAG_CASEFOLD;
>> > + fa->fsx_xflags_ro_mask |= FS_XFLAG_CASEFOLD;
>> > + /* unlink other fs FS_CASEFOLD_FL is read-only */
>> (oh, s/unlink/unlike/?)
>
> Yeh :)
> It's a comment for you not for the code
>
>>
>> > fa->flags |= FS_CASEFOLD_FL;
>> With the new API and vfs helpers, this would need to get removed, as vfs
>> would already handle this for legacy ioctls, correct?
>>
>> > }
>> > fa->fsx_xflags |= FS_XFLAG_CASENONPRESERVING;
>> > + fa->fsx_xflags_mask |= FS_XFLAG_CASENONPRESERVING;
>> > + fa->fsx_xflags_ro_mask |= FS_XFLAG_CASENONPRESERVING;
>> Uhm, why both in _mask and _ro_mask? If it's a RDONLY flag shouldn't
>> it *only* be in _ro_mask? (same for CASEFOLD)
>>
>
> Good question. Maybe
> I guess if you want to follow some percent
> FS_FL_USER_MODIFIABLE is a subset of FS_FL_USER_VISIBLE
> but I think that exporting ro_mask and _mask is going to be easier and
> cleaner than rw_mask but not sure.

Hmm I asked that also because you said in the xfs shared extent thread:

> The advantage being that it makes the interface symmetric.
> User can alway setattr() with the buffer they got from getattr()
> and instead of randomly ignoring flags in set, the fsx_ro_mask
> along with fsx_mask defines the behavior exactly.

But by putting the ro flags in _mask too, a user would have to clean
them out or vfs will reject the call with -EINVAL/something else, since
in that case the vfs would see the user say "I want to change this [ro]
flag".

>> >> + if (NFS_SERVER(inode)->fattr_valid & NFS_ATTR_FATTR_BTIME) {
>> >> + fa->fsx_xflags |= FS_XFLAG_PTIME;
>> >> + fa->fsx_xflags_mask |= FS_XFLAG_PTIME;
>> >> + fa->fsx_ptime = NFS_I(inode)->btime;
>> >> + }
>> >
>> > + fa->fsx_xflags |= FS_XFLAG_BTIME;
>> > + fa->fsx_xflags_mask |= FS_XFLAG_BTIME;
>> > + fa->fsx_btime = NFS_I(inode)->btime;
>> >
>> > Fs with immutable btime could either not advertise the BTIME flag
>> > in xflags/xflags_mask or advertise the flag also in xflags_ro_mask.
>>
>> That makes sense.
>>
>> >> return 0;
>> >> }
>> >> EXPORT_SYMBOL_GPL(nfs_fileattr_get);
>> >>
>> >> +int nfs_fileattr_set(const struct mnt_idmap *idmap, struct dentry *dentry,
>> >> [...]
>> >> + if (!(server->fattr_valid & NFS_ATTR_FATTR_BTIME))
>> >> + return -EOPNOTSUPP;
>> >> +
>> >> + if (fa->flags_valid)
>> >> + return -EOPNOTSUPP;
>> >> +
>> >> + if (fileattr_has_fsx_mask(fa, NFS4_SUPPORTED_XFLAGS))
>> >> + return -EOPNOTSUPP;
>> >> +
>> >> + if (fa->fsx_xflags_mask & ~NFS4_SUPPORTED_XFLAGS)
>> >> + return -EOPNOTSUPP;
>> >> +
>> >
>> > These two checks look semantically identical.
>> > I am not sure yet what you intention was with the
>> > fileattr_has_fsx_mask() helper - I know you had reservations about it
>> > but at least in this code, it doesn't look like it is needed at all.
>>
>> Eh, the name is not the best, but they aren't, _mask & check the _mask
>> field, has_fsx_mask checks the xflags field (which is why I added the
>> question of keeping its name as it is or changing it to
>> "fileattr_has_unsupported_fsx").
>> But I'm not even sure we still need this helper, so I may just drop it.
>>
>
> I don't care either way as long as the code reads fine.

Fair.

Thanks,
koraynilay

> Thanks,
> Amir.

Attachment: signature.asc
Description: PGP signature