[Patch] jbd commit code deadloop when installing Linux

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

 



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.

The patch will fix the issue.

Zou Nan hai

Signed-off-by: Zou Nan hai <[email protected]>


--- linux-2.6.17/fs/jbd/commit.c	2006-06-18 09:49:35.000000000 +0800
+++ b/fs/jbd/commit.c	2006-06-28 14:15:41.000000000 +0800
@@ -625,8 +625,17 @@ wait_for_iobuf:
 			wait_on_buffer(bh);
 			goto wait_for_iobuf;
 		}
-		if (cond_resched())
-			goto wait_for_iobuf;
+		if (cond_resched())  {
+			if (commit_transaction->t_iobuf_list != NULL) {
+				jh = commit_transaction->t_iobuf_list->b_tprev;
+				bh = jh2bh(jh);
+				if (buffer_locked(bh)) {
+					wait_on_buffer(bh);
+					goto wait_for_iobuf;
+				}
+			} else
+				break;
+		}
 
 		if (unlikely(!buffer_uptodate(bh)))
 			err = -EIO;
@@ -681,8 +690,17 @@ wait_for_iobuf:
 			wait_on_buffer(bh);
 			goto wait_for_ctlbuf;
 		}
-		if (cond_resched())
-			goto wait_for_ctlbuf;
+		if (cond_resched()) {
+			if(commit_transaction->t_log_list != NULL) {
+				jh = commit_transaction->t_log_list->b_tprev;
+				bh = jh2bh(jh);
+				if (buffer_locked(bh)) {
+					wait_on_buffer(bh);
+					goto wait_for_ctlbuf;
+				}
+			}else
+				break;
+		}
 
 		if (unlikely(!buffer_uptodate(bh)))
 			err = -EIO;

-
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