提交 6df3cecb 编写于 作者: J Jan Kara 提交者: Linus Torvalds

[PATCH] cond_resched_lock() fix

On one path, cond_resched_lock() fails to return true if it dropped the lock.
We think this might be causing the crashes in JBD's log_do_checkpoint().

Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 f797f9cc
...@@ -3755,19 +3755,22 @@ EXPORT_SYMBOL(cond_resched); ...@@ -3755,19 +3755,22 @@ EXPORT_SYMBOL(cond_resched);
*/ */
int cond_resched_lock(spinlock_t * lock) int cond_resched_lock(spinlock_t * lock)
{ {
int ret = 0;
if (need_lockbreak(lock)) { if (need_lockbreak(lock)) {
spin_unlock(lock); spin_unlock(lock);
cpu_relax(); cpu_relax();
ret = 1;
spin_lock(lock); spin_lock(lock);
} }
if (need_resched()) { if (need_resched()) {
_raw_spin_unlock(lock); _raw_spin_unlock(lock);
preempt_enable_no_resched(); preempt_enable_no_resched();
__cond_resched(); __cond_resched();
ret = 1;
spin_lock(lock); spin_lock(lock);
return 1;
} }
return 0; return ret;
} }
EXPORT_SYMBOL(cond_resched_lock); EXPORT_SYMBOL(cond_resched_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册