Re: [Patch] jbd commit code deadloop when installing Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28 Jun 2006 12:48:43 +0800
Zou Nan hai <[email protected]> wrote:

> We see system hang in ext3 jbd code
> when Linux install program anaconda copying 
> packages. 
> 
> That is because anaconda is invoked from linuxrc 
> in initrd when system_state is still SYSTEM_BOOTING.
> 
> Thus the cond_resched checks in  journal_commit_transaction 
> will always return 1 without actually schedule, 
> then the system fall into deadloop.

That's a bug in cond_resched().

Something like this..


--- a/kernel/sched.c~cond_resched-fix
+++ a/kernel/sched.c
@@ -4454,7 +4454,7 @@ asmlinkage long sys_sched_yield(void)
 	return 0;
 }
 
-static inline void __cond_resched(void)
+static inline int __cond_resched(void)
 {
 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
 	__might_sleep(__FILE__, __LINE__);
@@ -4465,22 +4465,21 @@ static inline void __cond_resched(void)
 	 * cond_resched() call.
 	 */
 	if (unlikely(preempt_count()))
-		return;
+		return 0;
 	if (unlikely(system_state != SYSTEM_RUNNING))
-		return;
+		return 0;
 	do {
 		add_preempt_count(PREEMPT_ACTIVE);
 		schedule();
 		sub_preempt_count(PREEMPT_ACTIVE);
 	} while (need_resched());
+	return 1;
 }
 
 int __sched cond_resched(void)
 {
-	if (need_resched()) {
-		__cond_resched();
-		return 1;
-	}
+	if (need_resched())
+		return __cond_resched();
 	return 0;
 }
 EXPORT_SYMBOL(cond_resched);
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux