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

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

NFSv4: Fix a nfs4_state_manager() race



[ Upstream commit ed1cc05aa1f7fe8197d300e914afc28ab9818f89 ]

If the NFS4CLNT_RUN_MANAGER flag got set just before we cleared
NFS4CLNT_MANAGER_RUNNING, then we might have won the race against
nfs4_schedule_state_manager(), and are responsible for handling the
recovery situation.

Fixes: aeabb3c9 ("NFSv4: Fix a NFSv4 state manager deadlock")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f90821f6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2623,6 +2623,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
		nfs4_end_drain_session(clp);
		nfs4_clear_state_manager_bit(clp);

		if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
		    !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING,
				      &clp->cl_state)) {
			memflags = memalloc_nofs_save();
			continue;
		}

		if (!test_and_set_bit(NFS4CLNT_DELEGRETURN_RUNNING, &clp->cl_state)) {
			if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
				nfs_client_return_marked_delegations(clp);