Skip to content

Commit

Permalink
NFSv4: Check the return value of update_open_stateid()
Browse files Browse the repository at this point in the history
Ensure that we always check the return value of update_open_stateid()
so that we can retry if the update of local state failed. This fixes
infinite looping on state recovery.

Fixes: e23008e ("NFSv4 reduce attribute requests for open reclaim")
Signed-off-by: Trond Myklebust <[email protected]>
Cc: [email protected] # v3.7+
  • Loading branch information
Trond Myklebust committed Aug 5, 2019
1 parent ad11408 commit e3c8dc7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,8 +1915,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
if (data->o_res.delegation_type != 0)
nfs4_opendata_check_deleg(data, state);
update:
update_open_stateid(state, &data->o_res.stateid, NULL,
data->o_arg.fmode);
if (!update_open_stateid(state, &data->o_res.stateid,
NULL, data->o_arg.fmode))
return ERR_PTR(-EAGAIN);
refcount_inc(&state->count);

return state;
Expand Down Expand Up @@ -1981,8 +1982,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)

if (data->o_res.delegation_type != 0)
nfs4_opendata_check_deleg(data, state);
update_open_stateid(state, &data->o_res.stateid, NULL,
data->o_arg.fmode);
if (!update_open_stateid(state, &data->o_res.stateid,
NULL, data->o_arg.fmode)) {
nfs4_put_open_state(state);
state = ERR_PTR(-EAGAIN);
}
out:
nfs_release_seqid(data->o_arg.seqid);
return state;
Expand Down

0 comments on commit e3c8dc7

Please sign in to comment.