diff mbox

ext3: kernel BUG at fs/jbd/journal.c:412!

Message ID 20081106171322.GD18939@mit.edu
State Superseded, archived
Headers show

Commit Message

Theodore Ts'o Nov. 6, 2008, 5:13 p.m. UTC
On Thu, Nov 06, 2008 at 08:12:27AM -0800, Arthur Jones wrote:
> Hi Aneesh, ...
> 
> On Thu, Nov 06, 2008 at 07:50:25AM -0800, Aneesh Kumar K.V wrote:
> > I get this with ext4-patchqueue. I guess we have some ext3 patches queued there.
> 
> This could be related to a patch I just posted.
> 
> See the thread on linux-ext4 called "ext3: slow symlink corruption
> on umount" for details on how this patch came about...

No this is the other ext3 patch we have in the patch tree.  I see the
problem, we're calling __log_space_left in a diagnostic printk after
we've released the j_state_lock.  Here's the incremental fix:



This is in a "should never happen path", though.  What were you doing
to trigger it?

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Aneesh Kumar K.V Nov. 6, 2008, 5:16 p.m. UTC | #1
On Thu, Nov 06, 2008 at 12:13:22PM -0500, Theodore Tso wrote:
> On Thu, Nov 06, 2008 at 08:12:27AM -0800, Arthur Jones wrote:
> > Hi Aneesh, ...
> > 
> > On Thu, Nov 06, 2008 at 07:50:25AM -0800, Aneesh Kumar K.V wrote:
> > > I get this with ext4-patchqueue. I guess we have some ext3 patches queued there.
> > 
> > This could be related to a patch I just posted.
> > 
> > See the thread on linux-ext4 called "ext3: slow symlink corruption
> > on umount" for details on how this patch came about...
> 
> No this is the other ext3 patch we have in the patch tree.  I see the
> problem, we're calling __log_space_left in a diagnostic printk after
> we've released the j_state_lock.  Here's the incremental fix:
> 
> diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
> index 5e856de..18e5137 100644
> --- a/fs/jbd/checkpoint.c
> +++ b/fs/jbd/checkpoint.c
> @@ -115,7 +115,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
>   */
>  void __log_wait_for_space(journal_t *journal)
>  {
> -	int nblocks;
> +	int nblocks, space_left;
>  	assert_spin_locked(&journal->j_state_lock);
> 
>  	nblocks = jbd_space_needed(journal);
> @@ -139,7 +139,8 @@ void __log_wait_for_space(journal_t *journal)
>  		spin_lock(&journal->j_state_lock);
>  		spin_lock(&journal->j_list_lock);
>  		nblocks = jbd_space_needed(journal);
> -		if (__log_space_left(journal) < nblocks) {
> +		space_left = __log_space_left(journal);
> +		if (space_left < nblocks) {
>  			int chkpt = journal->j_checkpoint_transactions != NULL;
>  			int tid = 0;
> 
> @@ -157,8 +158,7 @@ void __log_wait_for_space(journal_t *journal)
>  			} else {
>  				printk(KERN_ERR "%s: needed %d blocks and "
>  				       "only had %d space available\n",
> -				       __func__, nblocks,
> -				       __log_space_left(journal));
> +				       __func__, nblocks, space_left);
>  				printk(KERN_ERR "%s: no way to get more "
>  				       "journal space\n", __func__);
>  				WARN_ON(1);
> 
> 

you would need the same patch for jbd2

-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arthur Jones Nov. 6, 2008, 5:23 p.m. UTC | #2
On Thu, Nov 06, 2008 at 09:13:22AM -0800, Theodore Tso wrote:
> [...]
> No this is the other ext3 patch we have in the patch tree. 

Pheew...  :-)

Arthur
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Nov. 6, 2008, 5:32 p.m. UTC | #3
On Thu, Nov 06, 2008 at 10:46:39PM +0530, Aneesh Kumar K.V wrote:
> 
> you would need the same patch for jbd2

I know, already done, and checked into the ext4 patch queue.

  		      	  	       - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Aneesh Kumar K.V Nov. 6, 2008, 5:38 p.m. UTC | #4
On Thu, Nov 06, 2008 at 12:32:36PM -0500, Theodore Tso wrote:
> On Thu, Nov 06, 2008 at 10:46:39PM +0530, Aneesh Kumar K.V wrote:
> > 
> > you would need the same patch for jbd2
> 
> I know, already done, and checked into the ext4 patch queue.

Now i am hitting this on ext4

__jbd2_log_wait_for_space: needed 1024 blocks and only had 1023 space
available
__jbd2_log_wait_for_space: no way to get more journal space in hdc:8
------------[ cut here ]------------
kernel BUG at fs/jbd2/checkpoint.c:164!
invalid opcode: 0000 [#1] SMP

I also have the change to make sure we use the right chunk value in
ext4_index_trans_blocks

-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
index 5e856de..18e5137 100644
--- a/fs/jbd/checkpoint.c
+++ b/fs/jbd/checkpoint.c
@@ -115,7 +115,7 @@  static int __try_to_free_cp_buf(struct journal_head *jh)
  */
 void __log_wait_for_space(journal_t *journal)
 {
-	int nblocks;
+	int nblocks, space_left;
 	assert_spin_locked(&journal->j_state_lock);
 
 	nblocks = jbd_space_needed(journal);
@@ -139,7 +139,8 @@  void __log_wait_for_space(journal_t *journal)
 		spin_lock(&journal->j_state_lock);
 		spin_lock(&journal->j_list_lock);
 		nblocks = jbd_space_needed(journal);
-		if (__log_space_left(journal) < nblocks) {
+		space_left = __log_space_left(journal);
+		if (space_left < nblocks) {
 			int chkpt = journal->j_checkpoint_transactions != NULL;
 			int tid = 0;
 
@@ -157,8 +158,7 @@  void __log_wait_for_space(journal_t *journal)
 			} else {
 				printk(KERN_ERR "%s: needed %d blocks and "
 				       "only had %d space available\n",
-				       __func__, nblocks,
-				       __log_space_left(journal));
+				       __func__, nblocks, space_left);
 				printk(KERN_ERR "%s: no way to get more "
 				       "journal space\n", __func__);
 				WARN_ON(1);