All of lore.kernel.org
 help / color / mirror / Atom feed
* journal too big
@ 2005-08-02 16:48 sudo Yang
  2005-08-02 18:44 ` Alexander Zarochentsev
  0 siblings, 1 reply; 3+ messages in thread
From: sudo Yang @ 2005-08-02 16:48 UTC (permalink / raw)
  To: reiserfs-list

Some of our systems are getting a kernel panic.  This error is logged
to /var/log/messages:

Jul 23 09:52:13 csd01a-bld kernel: REISERFS: panic (device sdb1):
journal-1413: journal_mark_dirty: j_len (1024) is too big
Jul 23 09:52:13 csd01a-bld kernel:
Jul 23 09:52:13 csd01a-bld kernel: ------------[ cut here ]------------
Jul 23 09:52:13 csd01a-bld kernel: kernel BUG at fs/reiserfs/prints.c:362!
Jul 23 09:52:13 csd01a-bld kernel: invalid operand: 0000 [#1]
Jul 23 09:52:13 csd01a-bld kernel: SMP
Jul 23 09:52:13 csd01a-bld kernel: Modules linked in: e1000 reiserfs
ext3 jbd 3w_xxxx sd_mod scsi_mod
Jul 23 09:52:13 csd01a-bld kernel: CPU:    3
Jul 23 09:52:13 csd01a-bld kernel: EIP:    0060:[<f88f8ab2>]    Not tainted
Jul 23 09:52:13 csd01a-bld kernel: EFLAGS: 00010282   (2.6.8-1.521smp)
Jul 23 09:52:13 csd01a-bld kernel: EIP is at reiserfs_panic+0x36/0x56 [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel: eax: 0000005d   ebx: f890e771  
ecx: f7f92d5c   edx: f7f92d5c
Jul 23 09:52:13 csd01a-bld kernel: esi: f7f92c00   edi: f7f92d5c  
ebp: f7f92c00   esp: f3422a64
Jul 23 09:52:13 csd01a-bld kernel: ds: 007b   es: 007b   ss: 0068
Jul 23 09:52:13 csd01a-bld kernel: Process ncftpd (pid: 27978,
threadinfo=f3422000 task=f3432db0)
Jul 23 09:52:13 csd01a-bld kernel: Stack: f890e781 f7f92d5c f891aba0
f3422e04 ffffffff f59a95f8 f890553b f7f92c00
Jul 23 09:52:13 csd01a-bld kernel:        f8910995 00000400 00007fff
00000000 00007fff f7f92c00 00001059 f886f000
Jul 23 09:52:13 csd01a-bld kernel:        f88e45a2 f5799ba8 f7d74000
082cffff 5418fb54 f3422e04 082cffff bd88316c
Jul 23 09:52:13 csd01a-bld kernel: Call Trace:
Jul 23 09:52:13 csd01a-bld kernel:  [<f890553b>]
journal_mark_dirty+0xff/0x245 [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f88e45a2>]
_reiserfs_free_block+0xe2/0x160 [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f88fe717>]
prepare_for_delete_or_cut+0x5e2/0x654 [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f88ff320>]
reiserfs_cut_from_item+0x93/0x42e [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f88ffa14>]
reiserfs_do_truncate+0x2fb/0x44d [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f8905418>]
journal_begin+0x7d/0xa1 [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<f88ee42a>]
reiserfs_truncate_file+0x107/0x1ff [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<0214b894>] vmtruncate+0xc6/0xf0
Jul 23 09:52:13 csd01a-bld kernel:  [<02175dbd>] inode_setattr+0x5e/0x11e
Jul 23 09:52:13 csd01a-bld kernel:  [<f88ef9fc>]
reiserfs_setattr+0x1ad/0x22c [reiserfs]
Jul 23 09:52:13 csd01a-bld kernel:  [<02175fdf>] notify_change+0x10c/0x1dd
Jul 23 09:52:13 csd01a-bld kernel:  [<021596c4>] do_truncate+0x87/0xbc
Jul 23 09:52:13 csd01a-bld kernel:  [<02167dcf>] permission+0x41/0x46
Jul 23 09:52:13 csd01a-bld kernel:  [<021699f7>] may_open+0x1b5/0x200
Jul 23 09:52:13 csd01a-bld kernel:  [<02169cf9>] open_namei+0x2b7/0x5e2
Jul 23 09:52:13 csd01a-bld kernel:  [<0215a4d6>] filp_open+0x23/0x3c
Jul 23 09:52:13 csd01a-bld kernel:  [<0215a6e7>] get_unused_fd+0x53/0xf3
Jul 23 09:52:13 csd01a-bld kernel:  [<0215a8c0>] sys_open+0x31/0x7d
Jul 23 09:52:13 csd01a-bld kernel: Code: 0f 0b 6a 01 a5 e7 90 f8 83 c4
0c 85 f6 68 a0 ab 91 f8 0f 45

We'r eusing ReiserfsFS 3.x.  What does this error mean?  What can we
do about it?

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: journal too big
  2005-08-02 16:48 journal too big sudo Yang
@ 2005-08-02 18:44 ` Alexander Zarochentsev
       [not found]   ` <4f52331f05080212161577b5f3@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Zarochentsev @ 2005-08-02 18:44 UTC (permalink / raw)
  To: sudo Yang; +Cc: reiserfs-list

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

Hello.

On Tuesday 02 August 2005 20:48, sudo Yang wrote:
> Some of our systems are getting a kernel panic.  This error is logged
> to /var/log/messages:

> Jul 23 09:52:13 csd01a-bld kernel: REISERFS: panic (device sdb1):
> journal-1413: journal_mark_dirty: j_len (1024) is too big

[ ... ]

>
> We'r eusing ReiserfsFS 3.x.  What does this error mean?  What can we
> do about it?

Would you please try the attached patch?  it is for 2.6.9 but applies cleanly 
to 2.6.8.

>
> Thanks

[-- Attachment #2: reiserfs-do_truncate-fix-3.diff --]
[-- Type: text/x-diff, Size: 9086 bytes --]

--- linux-2.6.9/fs/reiserfs/stree.c.orig	2004-11-08 11:44:05.000000000 +0300
+++ linux-2.6.9/fs/reiserfs/stree.c	2004-11-17 10:11:21.618449392 +0300
@@ -1016,6 +1016,7 @@ static inline int prepare_for_direntry_i
     return M_CUT; 
 }
 
+#define JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD (2 * JOURNAL_PER_BALANCE_CNT + 1)
 
 /*  If the path points to a directory or direct item, calculate mode and the size cut, for balance.
     If the path points to an indirect item, remove some number of its unformatted nodes.
@@ -1055,137 +1056,80 @@ static char  prepare_for_delete_or_cut(
     if ( is_direct_le_ih (p_le_ih) )
 	return prepare_for_direct_item (p_s_path, p_le_ih, inode, n_new_file_length, p_n_cut_size);
 
-
     /* Case of an indirect item. */
     {
-	int                   n_unfm_number,    /* Number of the item unformatted nodes. */
-	    n_counter,
-	    n_blk_size;
-	__u32               * p_n_unfm_pointer; /* Pointer to the unformatted node number. */
-	__u32 tmp;
-	struct item_head      s_ih;           /* Item header. */
-	char                  c_mode;           /* Returned mode of the balance. */
-	int need_research;
-
-
-	n_blk_size = p_s_sb->s_blocksize;
-
-	/* Search for the needed object indirect item until there are no unformatted nodes to be removed. */
-	do  {
-	    need_research = 0;
-            p_s_bh = PATH_PLAST_BUFFER(p_s_path);
-	    /* Copy indirect item header to a temp variable. */
+	int blk_size = p_s_sb->s_blocksize;
+	struct item_head s_ih;
+	int need_re_search;
+	int delete = 0;
+	int result = M_CUT;
+	int pos = 0;
+
+	if ( n_new_file_length == max_reiserfs_offset (inode) ) {
+	    /* prepare_for_delete_or_cut() is called by
+	     * reiserfs_delete_item() */
+	    n_new_file_length = 0;
+	    delete = 1;
+	}
+
+	do {
+	    need_re_search = 0;
+	    *p_n_cut_size = 0;
+	    p_s_bh = PATH_PLAST_BUFFER(p_s_path);
 	    copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
-	    /* Calculate number of unformatted nodes in this item. */
-	    n_unfm_number = I_UNFM_NUM(&s_ih);
+	    pos = I_UNFM_NUM(&s_ih);
 
-	    RFALSE( ! is_indirect_le_ih(&s_ih) || ! n_unfm_number ||
-		    pos_in_item (p_s_path) + 1 !=  n_unfm_number,
-		    "PAP-5240: invalid item %h "
-		    "n_unfm_number = %d *p_n_pos_in_item = %d", 
-		    &s_ih, n_unfm_number, pos_in_item (p_s_path));
-
-	    /* Calculate balance mode and position in the item to remove unformatted nodes. */
-	    if ( n_new_file_length == max_reiserfs_offset (inode) ) {/* Case of delete. */
-		pos_in_item (p_s_path) = 0;
-		*p_n_cut_size = -(IH_SIZE + ih_item_len(&s_ih));
-		c_mode = M_DELETE;
-	    }
-	    else  { /* Case of truncate. */
-		if ( n_new_file_length < le_ih_k_offset (&s_ih) )  {
-		    pos_in_item (p_s_path) = 0;
-		    *p_n_cut_size = -(IH_SIZE + ih_item_len(&s_ih));
-		    c_mode = M_DELETE; /* Delete this item. */
-		}
-		else  {
-		    /* indirect item must be truncated starting from *p_n_pos_in_item-th position */
-		    pos_in_item (p_s_path) = (n_new_file_length + n_blk_size - le_ih_k_offset (&s_ih) ) >> p_s_sb->s_blocksize_bits;
-
-		    RFALSE( pos_in_item (p_s_path) > n_unfm_number,
-			    "PAP-5250: invalid position in the item");
-
-		    /* Either convert last unformatted node of indirect item to direct item or increase
-		       its free space.  */
-		    if ( pos_in_item (p_s_path) == n_unfm_number )  {
-			*p_n_cut_size = 0; /* Nothing to cut. */
-			return M_CONVERT; /* Maybe convert last unformatted node to the direct item. */
-		    }
-		    /* Calculate size to cut. */
-		    *p_n_cut_size = -(ih_item_len(&s_ih) - pos_in_item(p_s_path) * UNFM_P_SIZE);
+	    while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) {
+		__u32 *unfm, block;
 
-		    c_mode = M_CUT;     /* Cut from this indirect item. */
+		/* Each unformatted block deletion may involve one additional
+		 * bitmap block into the transaction, thereby the initial
+		 * journal space reservation might not be enough. */
+		if (!delete && (*p_n_cut_size) != 0 &&
+		    reiserfs_transaction_free_space(th) < JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) {
+		    break;
 		}
-	    }
-
-	    RFALSE( n_unfm_number <= pos_in_item (p_s_path),
-		    "PAP-5260: invalid position in the indirect item");
 
-	    /* pointers to be cut */
-	    n_unfm_number -= pos_in_item (p_s_path);
-	    /* Set pointer to the last unformatted node pointer that is to be cut. */
-	    p_n_unfm_pointer = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1 - *p_n_removed;
-
-
-	    /* We go through the unformatted nodes pointers of the indirect
-	       item and look for the unformatted nodes in the cache. If we
-	       found some of them we free it, zero corresponding indirect item
-	       entry and log buffer containing that indirect item. For this we
-	       need to prepare last path element for logging. If some
-	       unformatted node has b_count > 1 we must not free this
-	       unformatted node since it is in use. */
-	    reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1);
-	    // note: path could be changed, first line in for loop takes care
-	    // of it
+		unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
+		block = get_block_num(unfm, 0);
 
-	    for (n_counter = *p_n_removed;
-		 n_counter < n_unfm_number; n_counter++, p_n_unfm_pointer-- ) {
+		if (block != 0) {
+		    reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1);
+		    put_block_num(unfm, 0, 0);
+		    journal_mark_dirty (th, p_s_sb, p_s_bh);
+		    reiserfs_free_block(th, inode, block, 1);
+		}
 
 		cond_resched();
-		if (item_moved (&s_ih, p_s_path)) {
-		    need_research = 1 ;
-		    break;
-		}
-		RFALSE( p_n_unfm_pointer < (__u32 *)B_I_PITEM(p_s_bh, &s_ih) ||
-			p_n_unfm_pointer > (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1,
-			"vs-5265: pointer out of range");
-
-		/* Hole, nothing to remove. */
-		if ( ! get_block_num(p_n_unfm_pointer,0) )  {
-			(*p_n_removed)++;
-			continue;
+		if (item_moved (&s_ih, p_s_path))  {
+		    need_re_search = 1;
+		    break ;
 		}
 
-		(*p_n_removed)++;
-
-		tmp = get_block_num(p_n_unfm_pointer,0);
-		put_block_num(p_n_unfm_pointer, 0, 0);
-		journal_mark_dirty (th, p_s_sb, p_s_bh);
-		reiserfs_free_block(th, inode, tmp, 1);
-		if ( item_moved (&s_ih, p_s_path) )  {
-			need_research = 1;
-			break ;
+		pos --;
+		(*p_n_removed) ++;
+		(*p_n_cut_size) -= UNFM_P_SIZE;
+
+		if (pos == 0) {
+		    (*p_n_cut_size) -= IH_SIZE;
+		    result = M_DELETE;
+		    break;
 		}
 	    }
-
-	    /* a trick.  If the buffer has been logged, this
-	    ** will do nothing.  If we've broken the loop without
-	    ** logging it, it will restore the buffer
-	    **
-	    */
+	    /* a trick.  If the buffer has been logged, this will do nothing.  If
+	    ** we've broken the loop without logging it, it will restore the
+	    ** buffer */
 	    reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh);
-
-	    /* This loop can be optimized. */
-	} while ( (*p_n_removed < n_unfm_number || need_research) &&
-		  search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND );
-
-	RFALSE( *p_n_removed < n_unfm_number, 
-		"PAP-5310: indirect item is not found");
-	RFALSE( item_moved (&s_ih, p_s_path), 
-		"after while, comp failed, retry") ;
-
-	if (c_mode == M_CUT)
-	    pos_in_item (p_s_path) *= UNFM_P_SIZE;
-	return c_mode;
+	} while (need_re_search && 
+		 search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND);
+	pos_in_item(p_s_path) = pos * UNFM_P_SIZE;
+
+	if (*p_n_cut_size == 0) {
+	    /* Nothing were cut. maybe convert last unformatted node to the
+	     * direct item? */
+	    result = M_CONVERT;
+	}
+	return result;
     }
 }
 
@@ -1893,7 +1837,8 @@ void reiserfs_do_truncate (struct reiser
 	** sure the file is consistent before ending the current trans
 	** and starting a new one
 	*/
-        if (journal_transaction_should_end(th, th->t_blocks_allocated)) {
+        if (journal_transaction_should_end(th, 0) || 
+		reiserfs_transaction_free_space(th) <= JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) {
 	  int orig_len_alloc = th->t_blocks_allocated ;
 	  decrement_counters_in_path(&s_search_path) ;
 
@@ -1903,7 +1848,8 @@ void reiserfs_do_truncate (struct reiser
 	  reiserfs_update_sd(th, p_s_inode) ;
 
 	  journal_end(th, p_s_inode->i_sb, orig_len_alloc) ;
-	  journal_begin(th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 6) ;
+	  journal_begin(th, p_s_inode->i_sb, 
+			JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ;
 	  reiserfs_update_inode_transaction(p_s_inode) ;
 	}
     } while ( n_file_size > ROUND_UP (n_new_file_size) &&
--- linux-2.6.9/include/linux/reiserfs_fs.h.orig	2004-11-08 18:00:24.000000000 +0300
+++ linux-2.6.9/include/linux/reiserfs_fs.h	2004-11-08 18:40:05.000000000 +0300
@@ -1769,6 +1769,11 @@ static inline int reiserfs_transaction_r
     return 0 ;
 }
 
+static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th)
+{
+	return th->t_blocks_allocated - th->t_blocks_logged;
+}
+
 int reiserfs_async_progress_wait(struct super_block *s);
 
 struct reiserfs_transaction_handle *

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: journal too big
       [not found]   ` <4f52331f05080212161577b5f3@mail.gmail.com>
@ 2005-08-03  4:23     ` Alexander Zarochentsev
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Zarochentsev @ 2005-08-03  4:23 UTC (permalink / raw)
  To: sudo Yang; +Cc: reiserfs-list

On Tuesday 02 August 2005 23:16, sudo Yang wrote:
> This is on the 2.4.20 kernel.

Really? I see your reiserfs crash message contains "2.6.8-1.521smp" string.

Jul 23 09:52:13 csd01a-bld kernel: EIP:    0060:[<f88f8ab2>]    Not tainted
Jul 23 09:52:13 csd01a-bld kernel: EFLAGS: 00010282   (2.6.8-1.521smp)
Jul 23 09:52:13 csd01a-bld kernel: EIP is at reiserfs_panic+0x36/0x56 

The bug exists in both 2.4.x and 2.6.x branches, but the fix isn't backported 
to 2.4.x.

> On 8/2/05, Alexander Zarochentsev <zam@namesys.com> wrote:
> > Hello.
> >
> > On Tuesday 02 August 2005 20:48, sudo Yang wrote:
> > > Some of our systems are getting a kernel panic.  This error is logged
> > > to /var/log/messages:
> > >
> > > Jul 23 09:52:13 csd01a-bld kernel: REISERFS: panic (device sdb1):
> > > journal-1413: journal_mark_dirty: j_len (1024) is too big
> >
> > [ ... ]
> >
> > > We'r eusing ReiserfsFS 3.x.  What does this error mean?  What can we
> > > do about it?
> >
> > Would you please try the attached patch?  it is for 2.6.9 but applies
> > cleanly to 2.6.8.
> >
> > > Thanks


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-03  4:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-02 16:48 journal too big sudo Yang
2005-08-02 18:44 ` Alexander Zarochentsev
     [not found]   ` <4f52331f05080212161577b5f3@mail.gmail.com>
2005-08-03  4:23     ` Alexander Zarochentsev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.