diff options
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r-- | include/linux/freezer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 5e75e26d4787..db5423eae24d 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -37,14 +37,24 @@ static inline void do_not_freeze(struct task_struct *p) | |||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Wake up a frozen process | 39 | * Wake up a frozen process |
40 | * | ||
41 | * task_lock() is taken to prevent the race with refrigerator() which may | ||
42 | * occur if the freezing of tasks fails. Namely, without the lock, if the | ||
43 | * freezing of tasks failed, thaw_tasks() might have run before a task in | ||
44 | * refrigerator() could call frozen_process(), in which case the task would be | ||
45 | * frozen and no one would thaw it. | ||
40 | */ | 46 | */ |
41 | static inline int thaw_process(struct task_struct *p) | 47 | static inline int thaw_process(struct task_struct *p) |
42 | { | 48 | { |
49 | task_lock(p); | ||
43 | if (frozen(p)) { | 50 | if (frozen(p)) { |
44 | p->flags &= ~PF_FROZEN; | 51 | p->flags &= ~PF_FROZEN; |
52 | task_unlock(p); | ||
45 | wake_up_process(p); | 53 | wake_up_process(p); |
46 | return 1; | 54 | return 1; |
47 | } | 55 | } |
56 | clear_tsk_thread_flag(p, TIF_FREEZE); | ||
57 | task_unlock(p); | ||
48 | return 0; | 58 | return 0; |
49 | } | 59 | } |
50 | 60 | ||