Skip to content

Commit

Permalink
[PATCH] cond_resched_lock() fix
Browse files Browse the repository at this point in the history
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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jan Kara authored and Linus Torvalds committed Jun 14, 2005
1 parent f797f9c commit 6df3cec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3755,19 +3755,22 @@ EXPORT_SYMBOL(cond_resched);
*/
int cond_resched_lock(spinlock_t * lock)
{
int ret = 0;

if (need_lockbreak(lock)) {
spin_unlock(lock);
cpu_relax();
ret = 1;
spin_lock(lock);
}
if (need_resched()) {
_raw_spin_unlock(lock);
preempt_enable_no_resched();
__cond_resched();
ret = 1;
spin_lock(lock);
return 1;
}
return 0;
return ret;
}

EXPORT_SYMBOL(cond_resched_lock);
Expand Down

0 comments on commit 6df3cec

Please sign in to comment.