Skip to content

Commit 00c94eb

Browse files
author
Trond Myklebust
committed
NFSv4: Don't invalidate inode attributes on delegation return
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>
1 parent e13433b commit 00c94eb

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

fs/nfs/nfs4proc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
363363
kunmap_atomic(start);
364364
}
365365

366+
static void nfs4_fattr_set_prechange(struct nfs_fattr *fattr, u64 version)
367+
{
368+
if (!(fattr->valid & NFS_ATTR_FATTR_PRECHANGE)) {
369+
fattr->pre_change_attr = version;
370+
fattr->valid |= NFS_ATTR_FATTR_PRECHANGE;
371+
}
372+
}
373+
366374
static void nfs4_test_and_free_stateid(struct nfs_server *server,
367375
nfs4_stateid *stateid,
368376
const struct cred *cred)
@@ -6553,7 +6561,9 @@ static void nfs4_delegreturn_release(void *calldata)
65536561
pnfs_roc_release(&data->lr.arg, &data->lr.res,
65546562
data->res.lr_ret);
65556563
if (inode) {
6556-
nfs_post_op_update_inode_force_wcc(inode, &data->fattr);
6564+
nfs4_fattr_set_prechange(&data->fattr,
6565+
inode_peek_iversion_raw(inode));
6566+
nfs_refresh_inode(inode, &data->fattr);
65576567
nfs_iput_and_deactive(inode);
65586568
}
65596569
kfree(calldata);

0 commit comments

Comments
 (0)