aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/mutex.c')
-rw-r--r--kernel/mutex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 357c6d221efe..524ffc33dc05 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -131,6 +131,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
131 struct mutex_waiter waiter; 131 struct mutex_waiter waiter;
132 unsigned long flags; 132 unsigned long flags;
133 133
134 preempt_disable();
134 spin_lock_mutex(&lock->wait_lock, flags); 135 spin_lock_mutex(&lock->wait_lock, flags);
135 136
136 debug_mutex_lock_common(lock, &waiter); 137 debug_mutex_lock_common(lock, &waiter);
@@ -170,13 +171,14 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
170 spin_unlock_mutex(&lock->wait_lock, flags); 171 spin_unlock_mutex(&lock->wait_lock, flags);
171 172
172 debug_mutex_free_waiter(&waiter); 173 debug_mutex_free_waiter(&waiter);
174 preempt_enable();
173 return -EINTR; 175 return -EINTR;
174 } 176 }
175 __set_task_state(task, state); 177 __set_task_state(task, state);
176 178
177 /* didnt get the lock, go to sleep: */ 179 /* didnt get the lock, go to sleep: */
178 spin_unlock_mutex(&lock->wait_lock, flags); 180 spin_unlock_mutex(&lock->wait_lock, flags);
179 schedule(); 181 __schedule();
180 spin_lock_mutex(&lock->wait_lock, flags); 182 spin_lock_mutex(&lock->wait_lock, flags);
181 } 183 }
182 184
@@ -193,6 +195,7 @@ done:
193 spin_unlock_mutex(&lock->wait_lock, flags); 195 spin_unlock_mutex(&lock->wait_lock, flags);
194 196
195 debug_mutex_free_waiter(&waiter); 197 debug_mutex_free_waiter(&waiter);
198 preempt_enable();
196 199
197 return 0; 200 return 0;
198} 201}