fs/nfsd: accept a backdated timestamp from a delegation holder
Get series with b4
b4 am [email protected] change-id 20260901-delegts-e91a648f1427Versions newest first
- v3 Latest3 patches 0 repliesNew
- v23 patches 5 repliesSuperseded
- v11 patch 2 repliesSuperseded
Changes in v3 from the cover letter
- Compare after the clamp and truncate in inode_set_ctime_deleg(), not before, so a clamped update stamps too
- Compare a SETATTR report against the inode before clamping, so an untouched file with a future time keeps it
- Set dl_setattr only once nfsd_setattr() has applied the update, and hold the stateid reference until then
- Note the SETATTR/DELEGRETURN race on dl_setattr in a comment
- Link to v2: https://lore.kernel.org/r/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | fs: stamp the current time for a stale delegated ctime updatefs/ | +16 | 0 replies | |
| 2/3 | nfsd: accept a backdated timestamp from a delegation holderfs/ | +72 | 0 replies | |
| 3/3 | nfsd: compare CB_GETATTR times against the inodefs/ fs/ | +31 | 0 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Jan Kara | Chuck Lever |
|---|---|---|
| 1/3 | R-b | A-b |
| 2/3 | A-b | |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/3] fs/nfsd: accept a backdated timestamp from a delegation holder
This version fixes a couple of issues that Sashiko's review pointed out.
The main problem is that an attribute delegation has strict rules about updates can be done, and that prevents applications that backdate timestamps on files after writing them, (e.g. tar -x, cp -p, etc.) from setting them properly.
We could fix this on the client by making it always issue an RPC for the SETATTR, but that would harm performance in these common use-cases. This set allows the server to accept some of these backdated mtime updates, by changing how the ctime is handled.
It'd be nice to see this in v7.4.
---
Changes in v3:
- Compare after the clamp and truncate in inode_set_ctime_deleg(), not before, so a clamped update stamps too
- Compare a SETATTR report against the inode before clamping, so an untouched file with a future time keeps it
- Set dl_setattr only once nfsd_setattr() has applied the update, and hold the stateid reference until then
- Note the SETATTR/DELEGRETURN race on dl_setattr in a comment
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Split the change into three patches
- Stamp now in inode_set_ctime_deleg() for a stale update, so nfsd need not compare
- Drop a SETATTR report that matches the inode, so an untouched file keeps its change attribute
- Set dl_setattr only on the branch that carries a c/mtime update
- Compare against the inode, not the grant-time snapshots (Chuck)
- Set the ctime whenever a CB_GETATTR moves the mtime
- Take i_rwsem before the CB_GETATTR comparison
- Drop the unused dl_atime, dl_mtime and dl_ctime, and make nfsd4_vet_deleg_time() static
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Jeff Layton (3):
fs: stamp the current time for a stale delegated ctime update
nfsd: accept a backdated timestamp from a delegation holder
nfsd: compare CB_GETATTR times against the inode
fs/inode.c | 25 +++++++++------ fs/nfsd/nfs4proc.c | 92 +++++++++++++++++++++++++++++++++++++++++------------ fs/nfsd/nfs4state.c | 49 +++++++++++++++++----------- fs/nfsd/state.h | 8 ----- 4 files changed, 119 insertions(+), 55 deletions(-)
---
base-commit: ac579868af0c900d8fd9c8cfe9e10db46ccc5a75
change-id: 20260901-delegts-e91a648f1427
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>