Skip to contentSkip to conversation

Oops with in nfsd - 2.4.19-pre6

DISCUSSION Philippe Gramoullé 3 participants 5 messages Oct 29, 2002 – Oct 31, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

Is this still the infamous NFSD/inode race ?

Thanks,

Philippe.

root@smembf08:~# cat reiser-oops | ksymoops -m /boot/System.map-2.4.19-pre6 
ksymoops 2.4.5 on i686 2.4.19-pre6.  Options used
     -V (default)
     -k /proc/ksyms (default)
     -l /proc/modules (default)
     -o /lib/modules/2.4.19-pre6/ (default)
     -m /boot/System.map-2.4.19-pre6 (specified)

kernel BUG at prints.c:334!

invalid operand: 0000
CPU:    0
EIP:    0010:[<c0194899>]    Not tainted

Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010286
eax: 0000003d ebx: c0268640 ecx: ffffffff edx: 00000002
esi: f781c400 edi: 00000019 ebp: 00000000 esp: f6125af4
ds: 0018 es: 0018 ss: 0018
Process nfsd (pid: 288, stackpage=f6125000)

Stack: c02650da c031f5e0 c0268640 f6125b18 f6125ec8 f6fbad20 c01a1bcc f781c400 
       c0268640 00000400 f781c400 000007b1 f6125ec8 03d8eefe ffffffff 00000000 
       c0184144 f6125ec8 f781c400 f6fbad20 f6125ec8 03d8eefe 00000001 e1ae7de0 
Call Trace: [<c01a1bcc>] [<c0184144>] [<c0184283>] [<c019b23b>] [<c019c08f>] 
   [<c019c879>] [<c019bcbf>] [<c018a09a>] [<c0189fd0>] [<c014bd67>] [<c0149fb6>] 
   [<c014279d>] [<c0175d6b>] [<c0179dee>] [<c0170d63>] [<c0238405>] [<c0170b5f>] 
   [<c0106ff4>] 
Code: 0f 0b 4e 01 e0 50 26 c0 68 e0 f5 31 c0 85 f6 74 16 0f b7 46 
Quoted 6 lines
Quoted 6 lines

EIP; c0194899 <reiserfs_panic+29/60> <=====

ebx; c0268640 <MAX_KEY+2220/4aa8>
ecx; ffffffff <END_OF_CODE+76caea0/????>
esi; f781c400 <_end+374d4c24/385e7824>
esp; f6125af4 <_end+35dde318/385e7824>

Trace; c01a1bcc <journal_mark_dirty+160/320> Trace; c0184144 <_reiserfs_free_block+b4/1cc> Trace; c0184283 <reiserfs_free_block+27/30> Trace; c019b23b <prepare_for_delete_or_cut+663/70c> Trace; c019c08f <reiserfs_cut_from_item+97/520> Trace; c019c879 <reiserfs_do_truncate+2fd/42c> Trace; c019bcbf <reiserfs_delete_object+23/50> Trace; c018a09a <reiserfs_delete_inode+ca/13c> Trace; c0189fd0 <reiserfs_delete_inode+0/13c> Trace; c014bd67 <iput+163/268>
Trace; c0149fb6 <d_delete+62/a0>
Trace; c014279d <vfs_unlink+1e9/220>
Trace; c0175d6b <nfsd_unlink+193/1e0> Trace; c0179dee <nfsd3_proc_remove+c6/d4> Trace; c0170d63 <nfsd_dispatch+d3/19a> Trace; c0238405 <svc_process+28d/4d4> Trace; c0170b5f <nfsd+1f7/328>
Trace; c0106ff4 <kernel_thread+28/38>

Code; c0194899 <reiserfs_panic+29/60>
00000000 <_EIP>:
Code; c0194899 <reiserfs_panic+29/60> <=====
0: 0f 0b ud2a <=====
Code; c019489b <reiserfs_panic+2b/60>
2: 4e dec %esi
Code; c019489c <reiserfs_panic+2c/60>
3: 01 e0 add %esp,%eax
Code; c019489e <reiserfs_panic+2e/60>
5: 50 push %eax
Code; c019489f <reiserfs_panic+2f/60>
6: 26 c0 68 e0 f5 shrb $0xf5,%es:0xffffffe0(%eax)
Code; c01948a4 <reiserfs_panic+34/60>
b: 31 c0 xor %eax,%eax
Code; c01948a6 <reiserfs_panic+36/60>
d: 85 f6 test %esi,%esi
Code; c01948a8 <reiserfs_panic+38/60>
f: 74 16 je 27 <_EIP+0x27> c01948c0 <reiserfs_panic+50/60>
Code; c01948aa <reiserfs_panic+3a/60>
11: 0f b7 46 00 movzwl 0x0(%esi),%eax

#1 lore raw

Hello!

Quoted 1 line · Philippe Gramoull?

Is this still the infamous NFSD/inode race ?

No.
This is a bug in journalling code.
Something related to improper transaction blocks accounting. Chris said he will try take care of it and rejected my simple, but invalid patch.

Chris, any news on that?

Quoted 2 lines
Quoted 1 line
Quoted 1 line

EIP; c0194899 <reiserfs_panic+29/60> <=====

Trace; c01a1bcc <journal_mark_dirty+160/320>

Bye,
Oleg

#2 lore raw

FYI,

This in the log , before the oops :

journal-1413: journal_mark_dirty: j_len (1024) is too big

and filer is low on space :o)

/dev/sdb1 572418604 572341220 77384 100% /storage

Should it be because filer hit 0 on space ?

Thanks,

philippe

On Tue, 29 Oct 2002 18:14:38 +0300
Oleg Drokin <[email protected]> wrote:

  |  Hello!
  |  
  |  On Tue, Oct 29, 2002 at 03:59:07PM +0100, Philippe Gramoull? wrote:
  |  
  |  > Is this still the infamous NFSD/inode race ?
  |  
  |  No.
  |  This is a bug in journalling code.
  |  Something related to improper transaction blocks accounting.
  |  Chris said he will try take care of it and rejected my 
  |  simple, but invalid patch.
  |  
  |  Chris, any news on that?
  |  
  |  > >>EIP; c0194899 <reiserfs_panic+29/60>   <=====
  |  > Trace; c01a1bcc <journal_mark_dirty+160/320>
  |  
  |  Bye,
  |      Oleg
  |  
#3 lore raw

Hello!

Quoted 2 lines · Philippe Gramoull?

This in the log , before the oops :
journal-1413: journal_mark_dirty: j_len (1024) is too big

Yes, this is the assertion that failed (jlen to be less than TRANS_MAX something).

Quoted 3 lines

and filer is low on space :o)
/dev/sdb1 572418604 572341220 77384 100% /storage
Should it be because filer hit 0 on space ?

No, the free space on disk is irrelevant I believe. Journal is on its own separate area anyway.

Bye,
Oleg

#4 lore raw
In reply to Philippe Gramoullé
Quoted 8 lines · Philippe Gramoullé

FYI,

This in the log , before the oops :

journal-1413: journal_mark_dirty: j_len (1024) is too big

Ok, this patch goes on top of the quota patches because that is what Philippe is currently running. Merging with the pure kernel is trivial, so I'll do that later.

Since Philippe is putting this onto production machines, I think he should wait for someone from namesys to review before using the patch.

The idea is that during boundless operations (creating a hole, and truncates), the journal code wasn't properly reserving log blocks. There are two parts to the fix:

1) always reserve extra log blocks when
reiserfs_transaction_should_end() returns 0

2) always send the correct number of log blocks to reiserfs_transaction_should_end()

#2 also makes hole creation significantly faster. Before, it used the number of blocks logged in the last transaction as the number if will log in the next one, which means it might try to reserve 300 or so log blocks. This would usually force the current transcation to close, leading to a small transaction and lower performance.

Anyway, here's the patch:

-chris

#

# against 2.4.19 + quota + nesting
#
# when testing for a transaction restart, make sure to bump the number
# of blocks allocated, otherwise by the time you get around to 
# journal_mark_dirty, the blocks might have been used by a different
# writer
#
# when restarting the transaction in reiserfs_get_block and truncates,
# don't use th->t_blocks_allocated as the count for the new transaction.
# It gets incremented as the transation grows during the boundless op,
# and might get very very large.
#
diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c	Thu Oct 31 15:21:49 2002
+++ b/fs/reiserfs/inode.c	Thu Oct 31 15:21:49 2002
@@ -232,9 +232,9 @@
 }

/*static*/ void restart_transaction(struct reiserfs_transaction_handle *th,
- struct inode *inode, struct path *path) {
+ struct inode *inode, struct path *path,
+ int jbegin_count) {
struct super_block *s = th->t_super ;
- int len = th->t_blocks_allocated ;

/* we cannot restart while nested */
if (th->t_refcount > 1) {
@@ -242,8 +242,8 @@
}
pathrelse(path) ;
reiserfs_update_sd(th, inode) ;

-  journal_end(th, s, len) ;
-  journal_begin(th, s, len) ;
+  journal_end(th, s, th->t_blocks_allocated) ;
+  journal_begin(th, s, jbegin_count) ;

reiserfs_update_inode_transaction(inode) ;
}

@@ -655,7 +655,7 @@
** some blocks. releases the path, so we have to go back to ** research if we succeed on the second try
*/
- restart_transaction(&th, inode, &path) ;
+ restart_transaction(&th, inode, &path, jbegin_count) ;
repeat = _allocate_block(&th, inode,&allocated_block_nr,tag,create);

if (repeat != NO_DISK_SPACE && repeat != QUOTA_EXCEEDED) {
@@ -856,8 +856,8 @@
** release the path so that anybody waiting on the path before ** ending their transaction will be able to continue. */
- if (journal_transaction_should_end(&th, th.t_blocks_allocated)) {
- restart_transaction(&th, inode, &path) ;
+ if (journal_transaction_should_end(&th, jbegin_count)) {
+ restart_transaction(&th, inode, &path, jbegin_count) ;
}
/* inserting indirect pointers for a hole can take a ** long time. reschedule if needed

fs/reiserfs/journal.c +6 -0
diff -Nru a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
@@ -2011,6 +2011,12 @@
        SB_JOURNAL(th->t_super)->j_cnode_free < (JOURNAL_TRANS_MAX * 3)) { 
     return 1 ;
   }
+  
+  /* we are allowing them to continue in the current transaction, so we
+   * have to bump the blocks allocated now.
+   */
+  th->t_blocks_allocated += new_alloc;
+  SB_JOURNAL(th->t_super)->j_len_alloc += new_alloc ;
   return 0 ;
 }
 
fs/reiserfs/stree.c +4 -4
diff -Nru a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
@@ -1730,6 +1730,7 @@
 	n_new_file_size;/* New file size. */
     int                   n_deleted;      /* Number of deleted or truncated bytes. */
     int retval;
+    int jbegin_count = th->t_blocks_allocated;
 
     if ( ! (S_ISREG(p_s_inode->i_mode) || S_ISDIR(p_s_inode->i_mode) || S_ISLNK(p_s_inode->i_mode)) )
 	return;
@@ -1809,16 +1810,15 @@
 	** 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)) {
-	  int orig_len_alloc = th->t_blocks_allocated ;
+        if (journal_transaction_should_end(th, jbegin_count)) {
 	  decrement_counters_in_path(&s_search_path) ;
 
 	  if (update_timestamps) {
 	      p_s_inode->i_mtime = p_s_inode->i_ctime = CURRENT_TIME;
 	  } 
 	  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, orig_len_alloc) ;
+	  journal_end(th, p_s_inode->i_sb, th->t_blocks_allocated) ;
+	  journal_begin(th, p_s_inode->i_sb, jbegin_count) ;
 	  reiserfs_update_inode_transaction(p_s_inode) ;
 	}
     } while ( n_file_size > ROUND_UP (n_new_file_size) &&