linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] nfsd/vfs: fix handling of delegated timestamp updates
@ 2025-07-26 14:31 Jeff Layton
  2025-07-26 14:31 ` [PATCH v2 1/7] vfs: add ATTR_CTIME_SET flag Jeff Layton
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Jeff Layton @ 2025-07-26 14:31 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Chuck Lever, NeilBrown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: Trond Myklebust, Anna Schumaker, linux-fsdevel, linux-kernel,
	linux-trace-kernel, linux-nfs, Jeff Layton

After my last posting, Trond pointed out that my interpretation of RFC
9754 was wrong. The "original time" as mentioned in the spec is the time
of the grant of the delegation, and not the current timestamp in the
inode before the update.

Given that, there is no longer a need to do any sort of complicated
handling of delegated timestamps at the VFS layer, so this set removes
inode_set_ctime_deleg(). We do however need a way to set a ctime that
isn't current_time() via notify_change(). This patchset adds an
ATTR_CTIME_SET flag, which mirrors ATTR_ATIME_SET and ATTR_MTIME_SET
semantics. The rest of the patchset reworks nfsd to properly vet
timestamp updates on its own and just call down into the OS to do a
normal notify_change().

With this patchset in place I haven't seen any git regression suite
failures yet (4 passes so far under kdevops in the "stress"
configuration).

I should point out that there is at least one potential problem with
this implementation:

The kernel does not block getattr operations when there is a delegation
outstanding. When the client issues read and write ops to the server,
while holding the delegation, the timestamps on the file get updated to
the server's time as usual. Later, the client will send a SETATTR (or a
CB_GETTTR reply) that may have times that are earlier than the
timestamps currently on the inode.

This means that userland applications running on the NFS server can
observe timestamps going backward. This applies even for the ctime. NFS
clients should be fine, as the server will do a CB_GETATTR to satisfy
them. Server-side applications can't do much else with the inode without
recalling the delegation, so my thinking is that the effect should be
"mostly harmless".

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Changes in v2:
- add ATTR_CTIME_SET and remove inode_set_ctime_deleg()
- track original timestamps in struct nfs4_delegation
- fix delegated timestamp updates to respect saved timestamps
- Link to v1: https://lore.kernel.org/r/20250722-nfsd-testing-v1-0-31321c7fc97f@kernel.org

---
Jeff Layton (7):
      vfs: add ATTR_CTIME_SET flag
      nfsd: ignore ATTR_DELEG when checking ia_valid before notify_change()
      nfsd: use ATTR_CTIME_SET for delegated ctime updates
      nfsd: track original timestamps in nfs4_delegation
      nfsd: fix SETATTR updates for delegated timestamps
      nfsd: fix timestamp updates in CB_GETATTR
      vfs: remove inode_set_ctime_deleg()

 fs/attr.c           | 34 ++++++++++---------------
 fs/inode.c          | 73 -----------------------------------------------------
 fs/nfsd/nfs4proc.c  | 31 ++++++++++++++++++++++-
 fs/nfsd/nfs4state.c | 44 +++++++++++++++++---------------
 fs/nfsd/nfs4xdr.c   |  5 ++--
 fs/nfsd/state.h     |  8 ++++++
 fs/nfsd/vfs.c       |  2 +-
 include/linux/fs.h  |  3 +--
 8 files changed, 79 insertions(+), 121 deletions(-)
---
base-commit: b05f077b59098b4760e3f675b00a4e6a1ad4b0ad
change-id: 20250722-nfsd-testing-5e861a3cf3a0

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-07-26 22:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-26 14:31 [PATCH v2 0/7] nfsd/vfs: fix handling of delegated timestamp updates Jeff Layton
2025-07-26 14:31 ` [PATCH v2 1/7] vfs: add ATTR_CTIME_SET flag Jeff Layton
2025-07-26 14:31 ` [PATCH v2 2/7] nfsd: ignore ATTR_DELEG when checking ia_valid before notify_change() Jeff Layton
2025-07-26 14:31 ` [PATCH v2 3/7] nfsd: use ATTR_CTIME_SET for delegated ctime updates Jeff Layton
2025-07-26 18:48   ` Chuck Lever
2025-07-26 19:03     ` Jeff Layton
2025-07-26 19:57       ` Chuck Lever
2025-07-26 22:25         ` Jeff Layton
2025-07-26 14:31 ` [PATCH v2 4/7] nfsd: track original timestamps in nfs4_delegation Jeff Layton
2025-07-26 14:31 ` [PATCH v2 5/7] nfsd: fix SETATTR updates for delegated timestamps Jeff Layton
2025-07-26 14:32 ` [PATCH v2 6/7] nfsd: fix timestamp updates in CB_GETATTR Jeff Layton
2025-07-26 14:32 ` [PATCH v2 7/7] vfs: remove inode_set_ctime_deleg() Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).