mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
NFSv4: Use the nfs4_state being recovered in _nfs4_opendata_to_nfs4_state()
If we're recovering a nfs4_state, then we should try to use that instead of looking up a new stateid. Only do that if the inodes match, though. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
4e2fcac773
commit
75e8c48b9e
1 changed files with 25 additions and 16 deletions
|
@ -1681,12 +1681,30 @@ nfs4_opendata_get_inode(struct nfs4_opendata *data)
|
||||||
return inode;
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct nfs4_state *
|
||||||
|
nfs4_opendata_find_nfs4_state(struct nfs4_opendata *data)
|
||||||
|
{
|
||||||
|
struct nfs4_state *state;
|
||||||
|
struct inode *inode;
|
||||||
|
|
||||||
|
inode = nfs4_opendata_get_inode(data);
|
||||||
|
if (IS_ERR(inode))
|
||||||
|
return ERR_CAST(inode);
|
||||||
|
if (data->state != NULL && data->state->inode == inode) {
|
||||||
|
state = data->state;
|
||||||
|
atomic_inc(&state->count);
|
||||||
|
} else
|
||||||
|
state = nfs4_get_open_state(inode, data->owner);
|
||||||
|
iput(inode);
|
||||||
|
if (state == NULL)
|
||||||
|
state = ERR_PTR(-ENOMEM);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct nfs4_state *state;
|
||||||
struct nfs4_state *state = NULL;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!data->rpc_done) {
|
if (!data->rpc_done) {
|
||||||
state = nfs4_try_open_cached(data);
|
state = nfs4_try_open_cached(data);
|
||||||
|
@ -1694,26 +1712,17 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = nfs4_opendata_get_inode(data);
|
state = nfs4_opendata_find_nfs4_state(data);
|
||||||
ret = PTR_ERR(inode);
|
if (IS_ERR(state))
|
||||||
if (IS_ERR(inode))
|
goto out;
|
||||||
goto err;
|
|
||||||
ret = -ENOMEM;
|
|
||||||
state = nfs4_get_open_state(inode, data->owner);
|
|
||||||
if (state == NULL)
|
|
||||||
goto err_put_inode;
|
|
||||||
if (data->o_res.delegation_type != 0)
|
if (data->o_res.delegation_type != 0)
|
||||||
nfs4_opendata_check_deleg(data, state);
|
nfs4_opendata_check_deleg(data, state);
|
||||||
update_open_stateid(state, &data->o_res.stateid, NULL,
|
update_open_stateid(state, &data->o_res.stateid, NULL,
|
||||||
data->o_arg.fmode);
|
data->o_arg.fmode);
|
||||||
iput(inode);
|
|
||||||
out:
|
out:
|
||||||
nfs_release_seqid(data->o_arg.seqid);
|
nfs_release_seqid(data->o_arg.seqid);
|
||||||
return state;
|
return state;
|
||||||
err_put_inode:
|
|
||||||
iput(inode);
|
|
||||||
err:
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs4_state *
|
static struct nfs4_state *
|
||||||
|
|
Loading…
Add table
Reference in a new issue