Commit 4e2fcac7 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Use correct inode in _nfs4_opendata_to_nfs4_state()

When doing open by filehandle we don't really want to lookup a new inode,
but rather update the one we've got. Add a helper which does this for us.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent ef954844
...@@ -1659,6 +1659,28 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) ...@@ -1659,6 +1659,28 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
return state; return state;
} }
static struct inode *
nfs4_opendata_get_inode(struct nfs4_opendata *data)
{
struct inode *inode;
switch (data->o_arg.claim) {
case NFS4_OPEN_CLAIM_NULL:
case NFS4_OPEN_CLAIM_DELEGATE_CUR:
case NFS4_OPEN_CLAIM_DELEGATE_PREV:
if (!(data->f_attr.valid & NFS_ATTR_FATTR))
return ERR_PTR(-EAGAIN);
inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh,
&data->f_attr, data->f_label);
break;
default:
inode = d_inode(data->dentry);
ihold(inode);
nfs_refresh_inode(inode, &data->f_attr);
}
return inode;
}
static struct nfs4_state * static struct nfs4_state *
_nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data) _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
{ {
...@@ -1672,10 +1694,7 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data) ...@@ -1672,10 +1694,7 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
goto out; goto out;
} }
ret = -EAGAIN; inode = nfs4_opendata_get_inode(data);
if (!(data->f_attr.valid & NFS_ATTR_FATTR))
goto err;
inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, &data->f_attr, data->f_label);
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
goto err; goto err;
...@@ -2071,7 +2090,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) ...@@ -2071,7 +2090,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
data->o_arg.open_bitmap = &nfs4_open_noattr_bitmap[0]; data->o_arg.open_bitmap = &nfs4_open_noattr_bitmap[0];
case NFS4_OPEN_CLAIM_FH: case NFS4_OPEN_CLAIM_FH:
task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR];
nfs_copy_fh(&data->o_res.fh, data->o_arg.fh);
} }
data->timestamp = jiffies; data->timestamp = jiffies;
if (nfs4_setup_sequence(data->o_arg.server->nfs_client, if (nfs4_setup_sequence(data->o_arg.server->nfs_client,
......
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