Skip to content

Commit

Permalink
SUNRPC: Ensure we always run the tk_callback before tk_action
Browse files Browse the repository at this point in the history
This fixes a race in which the task->tk_callback() puts the rpc_task
to sleep, setting a new callback. Under certain circumstances, the current
code may end up executing the task->tk_action before it gets round to the
callback.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 17, 2011
1 parent 986d4ab commit e020c68
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions net/sunrpc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,12 @@ static void __rpc_execute(struct rpc_task *task)
save_callback = task->tk_callback;
task->tk_callback = NULL;
save_callback(task);
}

/*
* Perform the next FSM step.
* tk_action may be NULL when the task has been killed
* by someone else.
*/
if (!RPC_IS_QUEUED(task)) {
} else {
/*
* Perform the next FSM step.
* tk_action may be NULL when the task has been killed
* by someone else.
*/
if (task->tk_action == NULL)
break;
task->tk_action(task);
Expand Down

0 comments on commit e020c68

Please sign in to comment.