]> www.infradead.org Git - users/dwmw2/linux.git/commit
fs: handle delegated timestamps in setattr_copy_mgtime
authorJeff Layton <jlayton@kernel.org>
Wed, 2 Oct 2024 21:27:20 +0000 (17:27 -0400)
committerChristian Brauner <brauner@kernel.org>
Thu, 10 Oct 2024 08:20:51 +0000 (10:20 +0200)
commit7f2c86cba3c584c7227cddaabdf0ab54c8151e60
tree5c103c27044de0ed4231b961bd405aeef1448005
parentb82f92d5dd1a365ab1e13518c8bf799f6fec4518
fs: handle delegated timestamps in setattr_copy_mgtime

An update to the inode ctime typically requires the latest clock
value possible. The exception to this rule is when there is a nfsd write
delegation and the server is proxying timestamps from the client.

When nfsd gets a CB_GETATTR response, update the timestamp value in the
inode to the values that the client is tracking. The client doesn't send
a ctime value (since that's always determined by the exported
filesystem), but it can send a mtime value. In the case where it does,
update the ctime to a value commensurate with that instead of the
current time.

If ATTR_DELEG is set, then use ia_ctime value instead of setting the
timestamp to the current time.

With the addition of delegated timestamps, the server may receive a
request to update only the atime, which doesn't involve a ctime update.
Trust the ATTR_CTIME flag in the update and only update the ctime when
it's set.

Tested-by: Randy Dunlap <rdunlap@infradead.org> # documentation bits
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20241002-mgtime-v10-5-d1c4717f5284@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/attr.c
fs/inode.c
include/linux/fs.h