diff options
author | Jan Kara <jack@suse.cz> | 2005-06-13 18:52:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-13 23:58:58 -0400 |
commit | 6df3cecbb95345981718b38d357c50bc3425420a (patch) | |
tree | 50550e3863513ac051164abc082e2899d61d4dab /kernel | |
parent | f797f9cc5485b50c35c106b462e1bc432ec37f90 (diff) |
[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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 66b2ed784822..f12a0c8a7d98 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3755,19 +3755,22 @@ EXPORT_SYMBOL(cond_resched); | |||
3755 | */ | 3755 | */ |
3756 | int cond_resched_lock(spinlock_t * lock) | 3756 | int cond_resched_lock(spinlock_t * lock) |
3757 | { | 3757 | { |
3758 | int ret = 0; | ||
3759 | |||
3758 | if (need_lockbreak(lock)) { | 3760 | if (need_lockbreak(lock)) { |
3759 | spin_unlock(lock); | 3761 | spin_unlock(lock); |
3760 | cpu_relax(); | 3762 | cpu_relax(); |
3763 | ret = 1; | ||
3761 | spin_lock(lock); | 3764 | spin_lock(lock); |
3762 | } | 3765 | } |
3763 | if (need_resched()) { | 3766 | if (need_resched()) { |
3764 | _raw_spin_unlock(lock); | 3767 | _raw_spin_unlock(lock); |
3765 | preempt_enable_no_resched(); | 3768 | preempt_enable_no_resched(); |
3766 | __cond_resched(); | 3769 | __cond_resched(); |
3770 | ret = 1; | ||
3767 | spin_lock(lock); | 3771 | spin_lock(lock); |
3768 | return 1; | ||
3769 | } | 3772 | } |
3770 | return 0; | 3773 | return ret; |
3771 | } | 3774 | } |
3772 | 3775 | ||
3773 | EXPORT_SYMBOL(cond_resched_lock); | 3776 | EXPORT_SYMBOL(cond_resched_lock); |