fs/nfsd: fix update of inode attrs in CB_GETATTR
authorJeff Layton <jlayton@kernel.org>
Mon, 26 Aug 2024 14:32:34 +0000 (10:32 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Aug 2024 23:04:00 +0000 (19:04 -0400)
commit7e8ae8486e4471513e2111aba6ac29f2357bed2a
treead3822cd62bc216375fac05bd1cfb3a45ab837bc
parent1116e0e372eb16dd907ec571ce5d4af325c55c10
fs/nfsd: fix update of inode attrs in CB_GETATTR

Currently, we copy the mtime and ctime to the in-core inode and then
mark the inode dirty. This is fine for certain types of filesystems, but
not all. Some require a real setattr to properly change these values
(e.g. ceph or reexported NFS).

Fix this code to call notify_change() instead, which is the proper way
to effect a setattr. There is one problem though:

In this case, the client is holding a write delegation and has sent us
attributes to update our cache. We don't want to break the delegation
for this since that would defeat the purpose. Add a new ATTR_DELEG flag
that makes notify_change bypass the try_break_deleg call.

Fixes: c5967721e106 ("NFSD: handle GETATTR conflict with write delegation")
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/attr.c
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/state.h
include/linux/fs.h