Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95823043 authored by Trond Myklebust's avatar Trond Myklebust Committed by Greg Kroah-Hartman
Browse files

NFSv4: Check the return value of update_open_stateid()



[ Upstream commit e3c8dc761ead061da2220ee8f8132f729ac3ddfe ]

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: e23008ec ("NFSv4 reduce attribute requests for open reclaim")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v3.7+
Stable-dep-of: 6165a16a5ad9 ("NFSv4: Fix hangs when recovering open state after a server reboot")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ca2e3cdc
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -1862,8 +1862,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
	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:
update:
	update_open_stateid(state, &data->o_res.stateid, NULL,
	if (!update_open_stateid(state, &data->o_res.stateid,
			    data->o_arg.fmode);
				NULL, data->o_arg.fmode))
		return ERR_PTR(-EAGAIN);
	refcount_inc(&state->count);
	refcount_inc(&state->count);


	return state;
	return state;
@@ -1928,8 +1929,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)


	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,
	if (!update_open_stateid(state, &data->o_res.stateid,
			data->o_arg.fmode);
				NULL, data->o_arg.fmode)) {
		nfs4_put_open_state(state);
		state = ERR_PTR(-EAGAIN);
	}
out:
out:
	nfs_release_seqid(data->o_arg.seqid);
	nfs_release_seqid(data->o_arg.seqid);
	return state;
	return state;