NFSv4: Also ask for attributes when downgrading to a READ-only state

If we're downgrading from a READ+WRITE mode to a READ-only mode, then
ask for cache consistency attributes so that we avoid the revalidation
in nfs_close_context()

Fixes: 3947b74d0f ("NFSv4: Don't request a GETATTR on open_downgrade.")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
Trond Myklebust 2016-12-19 11:36:41 -05:00
parent a5f925bccc
commit 9413a1a1bf
1 changed files with 2 additions and 1 deletions

View File

@ -3200,9 +3200,10 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
goto out_wait; goto out_wait;
} }
if (calldata->arg.fmode == 0) { if (calldata->arg.fmode == 0)
task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE];
if (calldata->arg.fmode == 0 || calldata->arg.fmode == FMODE_READ) {
/* Close-to-open cache consistency revalidation */ /* Close-to-open cache consistency revalidation */
if (!nfs4_have_delegation(inode, FMODE_READ)) if (!nfs4_have_delegation(inode, FMODE_READ))
calldata->arg.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask; calldata->arg.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask;