Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfs: fix utimensat() for atime with delegated timestamps

xfstest generic/221 is failing with delegated timestamps enabled. When
the client holds a WRITE_ATTRS_DELEG delegation, and a userland process
does a utimensat() for only the atime, the ctime is not properly
updated. The problem is that the client tries to cache the atime update,
but there is no mtime update, so the delegated attribute update never
updates the ctime.

Delegated timestamps don't have a mechanism to update the ctime in
accordance with atime-only changes due to utimensat() and the like.
Change the client to issue an RPC in this case, so that the ctime gets
properly updated alongside the atime.

Fixes: 40f45ab3814f ("NFS: Further fixes to attribute delegation a/mtime changes")
Reported-by: Olga Kornievskaia <aglo@umich.edu>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Jeff Layton and committed by
Trond Myklebust
16d99dce 3a06bac5

+1 -8
+1 -8
fs/nfs/inode.c
··· 757 757 } else if (nfs_have_delegated_atime(inode) && 758 758 attr->ia_valid & ATTR_ATIME && 759 759 !(attr->ia_valid & ATTR_MTIME)) { 760 - if (attr->ia_valid & ATTR_ATIME_SET) { 761 - if (uid_eq(task_uid, owner_uid)) { 762 - spin_lock(&inode->i_lock); 763 - nfs_set_timestamps_to_ts(inode, attr); 764 - spin_unlock(&inode->i_lock); 765 - attr->ia_valid &= ~(ATTR_ATIME|ATTR_ATIME_SET); 766 - } 767 - } else { 760 + if (!(attr->ia_valid & ATTR_ATIME_SET)) { 768 761 nfs_update_delegated_atime(inode); 769 762 attr->ia_valid &= ~ATTR_ATIME; 770 763 }