Skip to content

Commit ed1cc05

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFSv4: Fix a nfs4_state_manager() race
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: aeabb3c ("NFSv4: Fix a NFSv4 state manager deadlock") Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 5623ecf commit ed1cc05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/nfs/nfs4state.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
27032703
nfs4_end_drain_session(clp);
27042704
nfs4_clear_state_manager_bit(clp);
27052705

2706+
if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2707+
!test_and_set_bit(NFS4CLNT_MANAGER_RUNNING,
2708+
&clp->cl_state)) {
2709+
memflags = memalloc_nofs_save();
2710+
continue;
2711+
}
2712+
27062713
if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
27072714
if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
27082715
nfs_client_return_marked_delegations(clp);

0 commit comments

Comments
 (0)