Skip to content

Commit

Permalink
NFSv4: Don't invalidate inode attributes on delegation return
Browse files Browse the repository at this point in the history
There is no need to declare attributes such as the ctime, mtime and
block size invalid when we're just returning a delegation, so it is
inappropriate to call nfs_post_op_update_inode_force_wcc().
Instead, just call nfs_refresh_inode() after faking up the change
attribute. We know that the GETATTR op occurs before the DELEGRETURN, so
we are safe when doing this.

Fixes: 0bc2c9b ("NFSv4: Don't discard the attributes returned by asynchronous DELEGRETURN")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Trond Myklebust committed Apr 26, 2022
1 parent e13433b commit 00c94eb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
kunmap_atomic(start);
}

static void nfs4_fattr_set_prechange(struct nfs_fattr *fattr, u64 version)
{
if (!(fattr->valid & NFS_ATTR_FATTR_PRECHANGE)) {
fattr->pre_change_attr = version;
fattr->valid |= NFS_ATTR_FATTR_PRECHANGE;
}
}

static void nfs4_test_and_free_stateid(struct nfs_server *server,
nfs4_stateid *stateid,
const struct cred *cred)
Expand Down Expand Up @@ -6553,7 +6561,9 @@ static void nfs4_delegreturn_release(void *calldata)
pnfs_roc_release(&data->lr.arg, &data->lr.res,
data->res.lr_ret);
if (inode) {
nfs_post_op_update_inode_force_wcc(inode, &data->fattr);
nfs4_fattr_set_prechange(&data->fattr,
inode_peek_iversion_raw(inode));
nfs_refresh_inode(inode, &data->fattr);
nfs_iput_and_deactive(inode);
}
kfree(calldata);
Expand Down

0 comments on commit 00c94eb

Please sign in to comment.