]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfsd: use ATTR_DELEG in nfsd4_finalize_deleg_timestamps()
authorJeff Layton <jlayton@kernel.org>
Wed, 3 Dec 2025 15:52:15 +0000 (10:52 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Thu, 25 Dec 2025 02:32:34 +0000 (21:32 -0500)
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")
Cc: stable@vger.kernel.org
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index 11877b96dc4c6f643c5a7f79a509ee5096f371d8..8145014d70d579ca82cb78acafd2825bf4d4d734 100644 (file)
@@ -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;