Skip to contentSkip to conversation

nfsd: delegated timestamp fix

PATCH In review Jeff Layton 2 participants 4 messages Dec 3, 2025

Subsystems (2)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

cover nfsd: delegated timestamp fix

The first patch fixes a bug I found with delegated timestamps, and the second makes the warning message that prompted the fix more distinct.

This is probably fine to wait until v7.0, but I think it's safe to take them sooner since it is a bugfix.

---
Jeff Layton (2):
nfsd: use ATTR_DELEG in nfsd4_finalize_deleg_timestamps()
nfsd: prefix notification in nfsd4_finalize_deleg_timestamps() with "nfsd: "

 fs/nfsd/nfs4state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

---
base-commit: 8c83500a552a34821bf9d865aec5a5588b4cfe7c
change-id: 20251203-nfsd-7-0-9b02ed10e407

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
author maintainer
#1 lore raw

PATCH 1/2 nfsd: use ATTR_DELEG in nfsd4_finalize_deleg_timestamps()

When finalizing timestamps that have never been updated and preparing to release the delegation lease, the notify_change() call can trigger a delegation break, and fail to update the timestamps. When this happens, there will be messages like this in dmesg:

    [ 2709.375785] Unable to update timestamps on inode 00:39:263: -11

Since this code is going to release the lease just after updating the timestamps, breaking the delegation is undesirable. Fix this by setting ATTR_DELEG in ia_valid, in order to avoid the delegation break.

Fixes e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
---
 fs/nfsd/nfs4state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
index 1ef560be2d714c138bc8210d9e7dca50a670a342..b0111104e969057486a4b878fffb84b84ca97b7b 100644
@@ -1226,7 +1226,7 @@ static void put_deleg_file(struct nfs4_file *fp)
 
 static void nfsd4_finalize_deleg_timestamps(struct nfs4_delegation *dp, struct file *f)
 {
-	struct iattr ia = { .ia_valid = ATTR_ATIME | ATTR_CTIME | ATTR_MTIME };
+	struct iattr ia = { .ia_valid = ATTR_ATIME | ATTR_CTIME | ATTR_MTIME | ATTR_DELEG };
 	struct inode *inode = file_inode(f);
 	int ret;
 
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH 2/2 nfsd: prefix notification in nfsd4_finalize_deleg_timestamps() with "nfsd: "

In reply to Jeff Layton

Make it distinct that this message comes from nfsd.

---
 fs/nfsd/nfs4state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
index b0111104e969057486a4b878fffb84b84ca97b7b..22246a1d970c3a1fcf1d821e20edd2ca7b1ed488 100644
@@ -1253,7 +1253,7 @@ static void nfsd4_finalize_deleg_timestamps(struct nfs4_delegation *dp, struct f
 	if (ret) {
 		struct inode *inode = file_inode(f);
 
-		pr_notice_ratelimited("Unable to update timestamps on inode %02x:%02x:%lu: %d\n",
+		pr_notice_ratelimited("nfsd: Unable to update timestamps on inode %02x:%02x:%lu: %d\n",
 					MAJOR(inode->i_sb->s_dev),
 					MINOR(inode->i_sb->s_dev),
 					inode->i_ino, ret);
Signature · 1 line
2.52.0
maintainer
#3 lore raw
In reply to Jeff Layton

From: Chuck Lever <[email protected]>

Quoted 8 lines · Jeff Layton

The first patch fixes a bug I found with delegated timestamps, and the second makes the warning message that prompted the fix more distinct.

This is probably fine to wait until v7.0, but I think it's safe to take them sooner since it is a bugfix.

[...]

Applied to nfsd-testing, thanks!

[1/2] nfsd: use ATTR_DELEG in nfsd4_finalize_deleg_timestamps()

      commit: f0cba9453ad1a29679bd3d872aee5dd691b84d1d
[2/2] nfsd: prefix notification in nfsd4_finalize_deleg_timestamps() with "nfsd: "
      commit: 1f0bbd7fd62f1f00ecf0df3dc53083d2205d994d

--
Chuck Lever