]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.37.5/sunrpc-ensure-we-always-run-the-tk_callback-before-tk_action.patch
Linux 4.9.167
[thirdparty/kernel/stable-queue.git] / releases / 2.6.37.5 / sunrpc-ensure-we-always-run-the-tk_callback-before-tk_action.patch
1 From e020c6800c9621a77223bf2c1ff68180e41e8ebf Mon Sep 17 00:00:00 2001
2 From: Trond Myklebust <Trond.Myklebust@netapp.com>
3 Date: Tue, 15 Mar 2011 19:56:30 -0400
4 Subject: SUNRPC: Ensure we always run the tk_callback before tk_action
5
6 From: Trond Myklebust <Trond.Myklebust@netapp.com>
7
8 commit e020c6800c9621a77223bf2c1ff68180e41e8ebf upstream.
9
10 This fixes a race in which the task->tk_callback() puts the rpc_task
11 to sleep, setting a new callback. Under certain circumstances, the current
12 code may end up executing the task->tk_action before it gets round to the
13 callback.
14
15 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17
18 ---
19 net/sunrpc/sched.c | 14 ++++++--------
20 1 file changed, 6 insertions(+), 8 deletions(-)
21
22 --- a/net/sunrpc/sched.c
23 +++ b/net/sunrpc/sched.c
24 @@ -623,14 +623,12 @@ static void __rpc_execute(struct rpc_tas
25 save_callback = task->tk_callback;
26 task->tk_callback = NULL;
27 save_callback(task);
28 - }
29 -
30 - /*
31 - * Perform the next FSM step.
32 - * tk_action may be NULL when the task has been killed
33 - * by someone else.
34 - */
35 - if (!RPC_IS_QUEUED(task)) {
36 + } else {
37 + /*
38 + * Perform the next FSM step.
39 + * tk_action may be NULL when the task has been killed
40 + * by someone else.
41 + */
42 if (task->tk_action == NULL)
43 break;
44 task->tk_action(task);