Skip to content

Commit b40b1ba

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: fix timestamp updates in CB_GETATTR
When updating the local timestamps from CB_GETATTR, the updated values are not being properly vetted. Compare the update times vs. the saved times in the delegation rather than the current times in the inode. Also, ensure that the ctime is properly vetted vs. its original value. Fixes: 6ae30d6 ("nfsd: add support for delegated timestamps") Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 3952f1c commit b40b1ba

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

fs/nfsd/nfs4state.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9175,20 +9175,19 @@ static int cb_getattr_update_times(struct dentry *dentry, struct nfs4_delegation
91759175
int ret;
91769176

91779177
if (deleg_attrs_deleg(dp->dl_type)) {
9178-
struct timespec64 atime = inode_get_atime(inode);
9179-
struct timespec64 mtime = inode_get_mtime(inode);
91809178
struct timespec64 now = current_time(inode);
91819179

91829180
attrs.ia_atime = ncf->ncf_cb_atime;
91839181
attrs.ia_mtime = ncf->ncf_cb_mtime;
91849182

9185-
if (nfsd4_vet_deleg_time(&attrs.ia_atime, &atime, &now))
9183+
if (nfsd4_vet_deleg_time(&attrs.ia_atime, &dp->dl_atime, &now))
91869184
attrs.ia_valid |= ATTR_ATIME | ATTR_ATIME_SET;
91879185

9188-
if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &mtime, &now)) {
9189-
attrs.ia_valid |= ATTR_CTIME | ATTR_CTIME_SET |
9190-
ATTR_MTIME | ATTR_MTIME_SET;
9186+
if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &dp->dl_mtime, &now)) {
9187+
attrs.ia_valid |= ATTR_MTIME | ATTR_MTIME_SET;
91919188
attrs.ia_ctime = attrs.ia_mtime;
9189+
if (nfsd4_vet_deleg_time(&attrs.ia_ctime, &dp->dl_ctime, &now))
9190+
attrs.ia_valid |= ATTR_CTIME | ATTR_CTIME_SET;
91929191
}
91939192
} else {
91949193
attrs.ia_valid |= ATTR_MTIME | ATTR_CTIME;

0 commit comments

Comments
 (0)