summaryrefslogtreecommitdiffstats
path: root/rtmutex-Preserve-TASK_STOPPED-state-when-blocking-on.patch
blob: 967c0cfdba612c91d037e434b1613a4829f514cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 67d6fa0ceba8cb0caa3cb0b55648b7a213901e8b Mon Sep 17 00:00:00 2001
From: Kevin Hao <kexin.hao@windriver.com>
Date: Tue, 2 Mar 2010 16:51:58 -0500
Subject: [PATCH] rtmutex: Preserve TASK_STOPPED state when blocking on a "spin_lock"

commit 923499cb1cf693b1f4e35711a34568864898876a in tip.

When a process handles a SIGSTOP signal, it will set the state to
TASK_STOPPED, acquire tasklist_lock and notifiy the parent of the
status change. But in the rt kernel the process state will change
to TASK_UNINTERRUPTIBLE if it blocks on the tasklist_lock. So if
we send a SIGCONT signal to this process at this time, the SIGCONT
signal just does nothing because this process is not in TASK_STOPPED
state. Of course this is not what we wanted. Preserving the
TASK_STOPPED state when blocking on a "spin_lock" can fix this bug.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
LKML-Reference: <18e240905fcfd72457930322ee187e7ff9313aec.1267566249.git.paul.gortmaker@windriver.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/rtmutex.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 16bfa1c..23dd443 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -757,8 +757,9 @@ rt_set_current_blocked_state(unsigned long saved_state)
 	 * saved_state. Now we can ignore further wakeups as we will
 	 * return in state running from our "spin" sleep.
 	 */
-	if (saved_state == TASK_INTERRUPTIBLE)
-		block_state = TASK_INTERRUPTIBLE;
+	if (saved_state == TASK_INTERRUPTIBLE ||
+		saved_state == TASK_STOPPED)
+		block_state = saved_state;
 	else
 		block_state = TASK_UNINTERRUPTIBLE;
 
-- 
1.7.0.4