Stress test failure for reiserfs, but ext3 ok on Linux 2.4.20
I am using the attached stess.sh script (probably from this mailinglist) for creating load on a reiserfs filesystem, which forks 100 (read,write,delete) processes:
# mkreiserfs /dev/sda4 # mount /dev/sda4 /backup # stress.sh -c /usr -n 100 /backup
Then wait until /backup fills up.
# mount |grep sda /dev/sda3 on / type ext3 (rw,errors=remount-ro) /dev/sda2 on /boot type ext3 (rw,errors=remount-ro) /dev/sda4 on /backup type reiserfs (rw)
# df -k / /boot /backup Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda3 4134932 3355468 569416 86% / /dev/sda2 132221 72896 52498 59% /boot /dev/sda4 12530312 12530312 0 100% /backup
# gcc -v Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease)
# uname -a Linux dematl06 2.4.20-p4-debug #1 SMP Wed Jan 15 00:48:49 CET 2003 i686 unknown
The Machine is Debian woody box with 2 x 2.40 GHz Intel Xeon (4 virtual CPUs).
# uptime 03:04:18 up 1:02, 1 user, load average: 100.99, 100.83, 89.56
This happens on reiserfs:
# iostat 1
avg-cpu: %user %nice %sys %idle
0.00 0.00 0.00 100.00Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
dev8-0 0.00 0.00 0.00 0 0 dev8-1 0.00 0.00 0.00 0 0
# vmstat 1 procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 0 100 1 4932 8404 117916 1559292 0 1 206 950 81 211 0 6 94 0 100 1 4932 8404 117916 1559292 0 0 0 0 107 6 0 0 100 0 100 1 4932 8404 117916 1559292 0 0 0 0 106 10 0 0 100 0 100 1 4932 8404 117916 1559292 0 0 0 0 105 6 0 0 10 ...
Any I/O freezes and even after killing the script, the remaining cp and mv commands don't terminate. They are in status "D". A simle "ls /backup" never comes back. Only a hard powerdown fixes this situation, because "init 6" etc. doesn't work. I have even activated the reiserfs debug, but I don't see any additional info.
# ls -l /backup & [2] 1432
# ps ax|grep ls 1432 pts/0 D 0:00 ls -l /backup 1445 pts/0 S 0:00 grep ls
# kill -9 1432
# ps ax|grep ls 1432 pts/0 D 0:00 ls -l /backup 1450 pts/0 S 0:00 grep ls
If I use the jfs Filesystem, the same thing happens.
If I use ext3, everything is fine, and the cp/mv/rm processes proceed even with full filesystem /backup and load = 100. iostat and vmstat still show I/O on filesystem /backup.
The Kernel is a Standard 2.4.20 Kernel only with one additional patch for the SK9Dxx Gigabit Ethernet Adapter from Syskonnect. During the Tests this module (sk9dlin) is not loaded.
I used several kernels.... 2.4.19, 2.4.20, 2.4.20-ac2, 2.4.21-pre3. All with same results.
Is something wrong? What is wrong?
# lsmod Module Size Used by Not tainted reiserfs 250656 1 (autoclean) nfs 67676 1 (autoclean) lockd 47680 1 (autoclean) [nfs] sunrpc 64692 1 (autoclean) [nfs lockd] eepro100 18380 1 (autoclean) mii 2400 0 (autoclean) [eepro100] md 57344 0 (autoclean) lvm-mod 59360 0 rtc 6492 0 (autoclean) unix 15716 62 (autoclean)
# dmesg | tail -9 reiserfs:warning: CONFIG_REISERFS_CHECK is set ON reiserfs:warning: - it is slow mode for debugging. reiserfs: checking transaction log (device 08:04) ... journal-1153: found in header: first_unflushed_offset 6, last_flushed_trans_id 11 journal-1206: Starting replay from offset 6, trans_id 12 journal-1299: Setting newest_mount_id to 11 Using r5 hash to sort names ReiserFS version 3.6.25 vs-8301: reiserfs_kmalloc: allocated memory 200904
# lspci 00:00.0 Host bridge: Intel Corp. e7500 [Plumas] DRAM Controller (rev 03) 00:00.1 Class ff00: Intel Corp. e7500 [Plumas] DRAM Controller Error Reporting (rev 03) 00:02.0 PCI bridge: Intel Corp. e7500 [Plumas] HI_B Virtual PCI Bridge (F0) (rev 03) 00:1d.0 USB Controller: Intel Corp. 82801CA/CAM USB (Hub (rev 02) 00:1d.1 USB Controller: Intel Corp. 82801CA/CAM USB (Hub (rev 02) 00:1d.2 USB Controller: Intel Corp. 82801CA/CAM USB (Hub (rev 02) 00:1e.0 PCI bridge: Intel Corp. 82801BA/CA/DB PCI Bridge (rev 42) 00:1f.0 ISA bridge: Intel Corp. 82801CA ISA Bridge (LPC) (rev 02) 00:1f.1 IDE interface: Intel Corp. 82801CA IDE U100 (rev 02) 00:1f.3 SMBus: Intel Corp. 82801CA/CAM SMBus (rev 02) 01:1c.0 PIC: Intel Corp. 82870P2 P64H2 I/OxAPIC (rev 03) 01:1d.0 PCI bridge: Intel Corp. 82870P2 P64H2 Hub PCI Bridge (rev 03) 01:1e.0 PIC: Intel Corp. 82870P2 P64H2 I/OxAPIC (rev 03) 01:1f.0 PCI bridge: Intel Corp. 82870P2 P64H2 Hub PCI Bridge (rev 03) 03:01.0 Ethernet controller: Syskonnect (Schneider & Koch) Gigabit Ethernet (rev 10) 03:02.0 SCSI storage controller: Adaptec AIC-7899P U160/m (rev 01) 03:02.1 SCSI storage controller: Adaptec AIC-7899P U160/m (rev 01) 03:04.0 Ethernet controller: Intel Corp. 82544GC Gigabit Ethernet Controller (LOM) (rev 02) 04:01.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27) 04:02.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 0d)
# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 7 cpu MHz : 2395.954 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov bogomips : 4784.12
same for processor 1, 2, 3...
Bernhard
Hello!
Quoted 7 lines · Bernhard Sadlowski
I am using the attached
stess.shscript (probably from this mailinglist) for creating load on a reiserfs filesystem, which forks 100 (read,write,delete) processes:# mkreiserfs /dev/sda4 # mount /dev/sda4 /backup # stress.sh -c /usr -n 100 /backup Then wait until /backup fills up.
Hm. This resembles me something.
Can you reproduce the same problem if you apply patches from ftp://ftp.namesys.com/pub/reiserfs-for-2.4/testing/quota-2.4.20/ These patches add quota support to reiserfs, but also change some new inode-related operation to prevent deadlocks like you are seeing.
Quoted 5 lines
Any I/O freezes and even after killing the script, the remaining cp and mv commands don't terminate. They are in status "D". A simle "ls /backup" never comes back. Only a hard powerdown fixes this situation, because "init 6" etc. doesn't work. I have even activated the reiserfs debug, but I don't see any additional info.
Try executing sysrq-t after the lockup happens, then send us decoded output plese.
Thank you.
Bye,
Oleg
Quoted 5 lines · Oleg Drokin
Hm. This resembles me something.
Can you reproduce the same problem if you apply patches from ftp://ftp.namesys.com/pub/reiserfs-for-2.4/testing/quota-2.4.20/ These patches add quota support to reiserfs, but also change some new inode-related operation to prevent deadlocks like you are seeing.
The unpatched kernel shows the hangs much earlier, so I assume that the above patches solve the problem. With the patches the load goes up very slowly but steady to "100" and I/O does not freeze anymore. vmstat and iostat still show activity. I assume you don't need any sysrq-t output now.
Will the patches be included in 2.4.21?
Bernhard
Hello!
Quoted 10 lines · Bernhard Sadlowski
Quoted 5 lines
Hm. This resembles me something.
Can you reproduce the same problem if you apply patches from ftp://ftp.namesys.com/pub/reiserfs-for-2.4/testing/quota-2.4.20/ These patches add quota support to reiserfs, but also change some new inode-related operation to prevent deadlocks like you are seeing.The unpatched kernel shows the hangs much earlier, so I assume that the above patches solve the problem. With the patches the load goes up very slowly but steady to "100" and I/O does not freeze anymore. vmstat and iostat still show activity. I assume you don't need any sysrq-t output now.
Ok. That's a good sign.
Quoted 1 line
Will the patches be included in 2.4.21?
No, they require quota support tha won't be included into 2.4 because of new quota formats and stuff.
I will extract relevant bits from the patch though.
I will send you short version without quota once it will be ready.
Thank you.
Bye,
Oleg
Hello!
Quoted 2 lines · Oleg Drokin
I will extract relevant bits from the patch though.
I will send you short version without quota once it will be ready.
Ok, here is the patch, can you give it a try and see if it also helps? I tested it locally and it works for me.
If you confirm everything is ok, I will try to get it into 2.4.21 in time.
Bye,
Oleg
fs/reiserfs/namei.c +92 -55
@@ -488,27 +488,58 @@return 0 ; } +/* quota utility function, call if you've had to abort after calling +** new_inode_init, and have not called reiserfs_new_inode yet. +** This should only be called on inodes that do not hav stat data +** inserted into the tree yet. +*/ +static int drop_new_inode (struct inode *inode) { +make_bad_inode (inode) ; +iput (inode) ; +return 0 ; +} + +/* utility function that does setup for reiserfs_new_inode. +** DQUOT_ALLOC_INODE cannot be called inside a transaction, so we had +** to pull some bits of reiserfs_new_inode out into this func. +*/ +static int new_inode_init (struct inode *inode,struct inode *dir,int mode) { + +/* the quota init calls have to know who to charge the quota to, so +** we have to set uid and gid here +*/ + inode->i_uid = current->fsuid; + inode->i_mode = mode; + +if (dir->i_mode &S_ISGID ) { + inode->i_gid = dir->i_gid; +if (S_ISDIR (mode)) + inode->i_mode |=S_ISGID ; + }else + inode->i_gid = current->fsgid; +return 0 ; +} +static int reiserfs_create (struct inode * dir,struct dentry *dentry,int mode) {int retval;struct inode * inode; -int windex ;int jbegin_count =JOURNAL_PER_BALANCE_CNT *2 ;struct reiserfs_transaction_handle th ; -if (!(inode =new_inode (dir->i_sb))) {return -ENOMEM ; } + retval =new_inode_init (inode, dir, mode) ; +if (retval) +return retval ; +journal_begin (&th, dir->i_sb, jbegin_count) ; th.t_caller ="create" ; - windex =push_journal_writer ("reiserfs_create" ) ; - inode =reiserfs_new_inode (&th, dir, mode,0 ,0 /*i_size*/ , dentry, inode, &retval); -if (!inode) { -pop_journal_writer (windex) ; -journal_end (&th, dir->i_sb, jbegin_count) ; -return retval; + retval =reiserfs_new_inode (&th, dir, mode,0 ,0 /*i_size*/ , dentry, inode); +if (retval) { + goto out_failed ; } inode->i_op = &reiserfs_file_inode_operations;
@@ -520,20 +551,19 @@if (retval) { inode->i_nlink--;reiserfs_update_sd (&th, inode); -pop_journal_writer (windex) ; -// FIXME: should we put iput here and have stat data deleted -// in the same transactioin journal_end (&th, dir->i_sb, jbegin_count) ; -iput (inode); -return retval; +iput (inode) ; + goto out_failed ; }reiserfs_update_inode_transaction (inode) ;reiserfs_update_inode_transaction (dir) ;d_instantiate (dentry, inode); -pop_journal_writer (windex) ;journal_end (&th, dir->i_sb, jbegin_count) ;return 0 ; + +out_failed: +return retval ; }
@@ -541,21 +571,21 @@ {int retval;struct inode * inode; -int windex ;struct reiserfs_transaction_handle th ;int jbegin_count =JOURNAL_PER_BALANCE_CNT *3 ;if (!(inode =new_inode (dir->i_sb))) {return -ENOMEM ; } + retval =new_inode_init (inode, dir, mode) ; +if (retval) +return retval ; +journal_begin (&th, dir->i_sb, jbegin_count) ; - windex =push_journal_writer ("reiserfs_mknod" ) ; - inode =reiserfs_new_inode (&th, dir, mode,0 ,0 /*i_size*/ , dentry, inode, &retval); -if (!inode) { -pop_journal_writer (windex) ; -journal_end (&th, dir->i_sb, jbegin_count) ; -return retval; + retval =reiserfs_new_inode (&th, dir, mode,0 ,0 /*i_size*/ , dentry, inode); +if (retval) { + goto out_failed; }init_special_inode (inode, mode, rdev) ;
@@ -571,16 +601,17 @@if (retval) { inode->i_nlink--;reiserfs_update_sd (&th, inode); -pop_journal_writer (windex) ;journal_end (&th, dir->i_sb, jbegin_count) ; -iput (inode); -return retval; +iput (inode) ; + goto out_failed; }d_instantiate (dentry, inode); -pop_journal_writer (windex) ;journal_end (&th, dir->i_sb, jbegin_count) ;return 0 ; + +out_failed: +return retval ; }
@@ -588,15 +619,18 @@ {int retval;struct inode * inode; -int windex ;struct reiserfs_transaction_handle th ;int jbegin_count =JOURNAL_PER_BALANCE_CNT *3 ; + mode =S_IFDIR | mode;if (!(inode =new_inode (dir->i_sb))) {return -ENOMEM ; } + retval =new_inode_init (inode, dir, mode) ; +if (retval) +return retval ; +journal_begin (&th, dir->i_sb, jbegin_count) ; - windex =push_journal_writer ("reiserfs_mkdir" ) ;/* inc the link count now, so another writer doesn't overflow it while ** we sleep later on.
@@ -607,15 +641,13 @@/* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ dir->u.reiserfs_i.new_packing_locality =1 ;#endif - mode =S_IFDIR | mode; - inode =reiserfs_new_inode (&th, dir, mode,0 /*symlink*/ , -old_format_only (dir->i_sb) ?EMPTY_DIR_SIZE_V1 :EMPTY_DIR_SIZE , - dentry, inode, &retval); -if (!inode) { -pop_journal_writer (windex) ; + retval =reiserfs_new_inode (&th, dir, mode,0 /*symlink*/ , +old_format_only (dir->i_sb) ? +EMPTY_DIR_SIZE_V1 :EMPTY_DIR_SIZE , + dentry, inode) ; +if (retval) { dir->i_nlink-- ; -journal_end (&th, dir->i_sb, jbegin_count) ; -return retval; + goto out_failed ; }reiserfs_update_inode_transaction (inode) ;reiserfs_update_inode_transaction (dir) ;
@@ -630,19 +662,20 @@ inode->i_nlink =0 ;DEC_DIR_INODE_NLINK (dir);reiserfs_update_sd (&th, inode); -pop_journal_writer (windex) ;journal_end (&th, dir->i_sb, jbegin_count) ; -iput (inode); -return retval; +iput (inode) ; + goto out_failed ; }// the above add_entry did not update dir's stat data reiserfs_update_sd (&th, dir);d_instantiate (dentry, inode); -pop_journal_writer (windex) ;journal_end (&th, dir->i_sb, jbegin_count) ;return 0 ; + +out_failed: +return retval ; }static inline int reiserfs_empty_dir (struct inode *inode) {
@@ -820,7 +853,7 @@struct inode * inode;char * name;int item_len; -int windex ; +int mode =S_IFLNK |S_IRWXUGO ;struct reiserfs_transaction_handle th ;int jbegin_count =JOURNAL_PER_BALANCE_CNT *3 ;
@@ -828,31 +861,34 @@if (!(inode =new_inode (parent_dir->i_sb))) {return -ENOMEM ; } + retval =new_inode_init (inode, parent_dir, mode) ; +if (retval) { +return retval ; + } item_len =ROUND_UP (strlen (symname));if (item_len >MAX_DIRECT_ITEM_LEN (parent_dir->i_sb->s_blocksize)) { -iput (inode) ; -return -ENAMETOOLONG ; + retval = -ENAMETOOLONG ; +drop_new_inode (inode) ; + goto out_failed ; } name =reiserfs_kmalloc (item_len,GFP_NOFS , parent_dir->i_sb);if (!name) { -iput (inode) ; -return -ENOMEM ; + retval = -ENOMEM ; +drop_new_inode (inode) ; + goto out_failed ; }memcpy (name, symname,strlen (symname));padd_item (name, item_len,strlen (symname));journal_begin (&th, parent_dir->i_sb, jbegin_count) ; - windex =push_journal_writer ("reiserfs_symlink" ) ; - inode =reiserfs_new_inode (&th, parent_dir,S_IFLNK |S_IRWXUGO , name,strlen (symname), dentry, - inode, &retval); + retval =reiserfs_new_inode (&th, parent_dir, mode, name, +strlen (symname), dentry, inode) ;reiserfs_kfree (name, item_len, parent_dir->i_sb); -if (inode ==0 ) {/* reiserfs_new_inode iputs for us */ -pop_journal_writer (windex) ; -journal_end (&th, parent_dir->i_sb, jbegin_count) ; -return retval; +if (retval) { + goto out_failed ; }reiserfs_update_inode_transaction (inode) ;
@@ -870,16 +906,17 @@if (retval) { inode->i_nlink--;reiserfs_update_sd (&th, inode); -pop_journal_writer (windex) ;journal_end (&th, parent_dir->i_sb, jbegin_count) ; -iput (inode); -return retval; +iput (inode) ; + goto out_failed ; }d_instantiate (dentry, inode); -pop_journal_writer (windex) ;journal_end (&th, parent_dir->i_sb, jbegin_count) ;return 0 ; + +out_failed: +return retval ; }
fs/reiserfs/inode.c +64 -56
189 lines not on this page · raw message
include/linux/reiserfs_fs.h +6 -5
@@ -1748,11 +1748,12 @@struct inode *reiserfs_iget (struct super_block * s,const struct cpu_key * key); - -struct inode *reiserfs_new_inode (struct reiserfs_transaction_handle *th, -struct inode * dir,int mode, -const char * symname,int item_len, -struct dentry *dentry,struct inode *inode,int * err); +int reiserfs_new_inode (struct reiserfs_transaction_handle *th, +struct inode * dir,int mode, +const char * symname, +int i_size, +struct dentry *dentry, +struct inode *inode);int reiserfs_sync_inode (struct reiserfs_transaction_handle *th,struct inode * inode);void reiserfs_update_sd (struct reiserfs_transaction_handle *th,struct inode * inode);
Quoted 3 lines · Oleg Drokin
Ok, here is the patch, can you give it a try and see if it also helps? I tested it locally and it works for me.
If you confirm everything is ok, I will try to get it into 2.4.21 in time.
At first glance it seems to work. I will run now that script overnight and will tell you, if any problems arise.
Thanks,
Bernhard
Hello!
Quoted 5 lines · Bernhard Sadlowski
Quoted 3 lines
Ok, here is the patch, can you give it a try and see if it also helps? I tested it locally and it works for me.
If you confirm everything is ok, I will try to get it into 2.4.21 in time.At first glance it seems to work. I will run now that script overnight and will tell you, if any problems arise.
Ok, Thank you very much.
Bye,
Oleg