Commit 0a741f59 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4: Fix up delegated attributes in nfs_setattr

nfs_setattr calls nfs_update_inode() directly, so we have to reset the
m/ctime there.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarLance Shelton <lance.shelton@hammerspace.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent b81aca09
......@@ -606,6 +606,28 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
}
EXPORT_SYMBOL_GPL(nfs_fhget);
static void
nfs_fattr_fixup_delegated(struct inode *inode, struct nfs_fattr *fattr)
{
unsigned long cache_validity = NFS_I(inode)->cache_validity;
if (nfs_have_delegated_mtime(inode)) {
if (!(cache_validity & NFS_INO_INVALID_CTIME))
fattr->valid &= ~(NFS_ATTR_FATTR_PRECTIME |
NFS_ATTR_FATTR_CTIME);
if (!(cache_validity & NFS_INO_INVALID_MTIME))
fattr->valid &= ~(NFS_ATTR_FATTR_PREMTIME |
NFS_ATTR_FATTR_MTIME);
if (!(cache_validity & NFS_INO_INVALID_ATIME))
fattr->valid &= ~NFS_ATTR_FATTR_ATIME;
} else if (nfs_have_delegated_atime(inode)) {
if (!(cache_validity & NFS_INO_INVALID_ATIME))
fattr->valid &= ~NFS_ATTR_FATTR_ATIME;
}
}
void nfs_update_delegated_atime(struct inode *inode)
{
spin_lock(&inode->i_lock);
......@@ -2164,6 +2186,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
*/
nfsi->read_cache_jiffies = fattr->time_start;
/* Fix up any delegated attributes in the struct nfs_fattr */
nfs_fattr_fixup_delegated(inode, fattr);
save_cache_validity = nfsi->cache_validity;
nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR
| NFS_INO_INVALID_ATIME
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment