]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFS: check if suid/sgid was cleared after a write as needed
authorScott Mayhew <smayhew@redhat.com>
Thu, 9 Oct 2025 20:42:12 +0000 (16:42 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Nov 2025 09:37:26 +0000 (10:37 +0100)
[ Upstream commit 9ff022f3820a31507cb93be6661bf5f3ca0609a4 ]

I noticed xfstests generic/193 and generic/355 started failing against
knfsd after commit e7a8ebc305f2 ("NFSD: Offer write delegation for OPEN
with OPEN4_SHARE_ACCESS_WRITE").

I ran those same tests against ONTAP (which has had write delegation
support for a lot longer than knfsd) and they fail there too... so
while it's a new failure against knfsd, it isn't an entirely new
failure.

Add the NFS_INO_REVAL_FORCED flag so that the presence of a delegation
doesn't keep the inode from being revalidated to fetch the updated mode.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/write.c

index 647c53d1418ae674dd3cca426d7eb6ee33238b53..d9edcc36b0b448aeafd9d0a357a88df66a8791a3 100644 (file)
@@ -1521,7 +1521,8 @@ static int nfs_writeback_done(struct rpc_task *task,
        /* Deal with the suid/sgid bit corner case */
        if (nfs_should_remove_suid(inode)) {
                spin_lock(&inode->i_lock);
-               nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE);
+               nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE
+                               | NFS_INO_REVAL_FORCED);
                spin_unlock(&inode->i_lock);
        }
        return 0;