* Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) @ 2010-01-13 19:09 Tomas Carnecky 2010-01-13 20:13 ` Josef Bacik 0 siblings, 1 reply; 7+ messages in thread From: Tomas Carnecky @ 2010-01-13 19:09 UTC (permalink / raw) To: linux-btrfs I was running v2.6.33-rc2-187-g08d869a and everything was ok. Today I decided to update the kernel (to v2.6.33-rc4) and a minute or two after logging into the gnome desktop this kernel bug appeared in dmesg. I then went back to the old kernel but the bug didn't disappear, not even after running btrfsck on the filesystem. tom ------------[ cut here ]------------ kernel BUG at fs/btrfs/inode.c:5595! invalid opcode: 0000 [#1] PREEMPT SMP last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq CPU 1 Pid: 2462, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6 #12 776295G/776295G RIP: 0010:[<ffffffff8132e518>] [<ffffffff8132e518>] btrfs_rename+0x4c8/0x590 RSP: 0018:ffff88007a17dc78 EFLAGS: 00010282 RAX: 00000000ffffffef RBX: 0000000025fa67f8 RCX: ffff8800258b91b0 RDX: ffff880001d11c80 RSI: ffff8800258b9090 RDI: ffff8800258b9090 RBP: ffff88007a17dd38 R08: ffff880000000000 R09: 0000160000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 000000004b4e1863 R13: ffff880071086060 R14: 0000000000000000 R15: ffff88007105b300 FS: 00007f468759e700(0000) GS:ffff880001d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000006d9c90 CR3: 000000007b15e000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process gconfd-2 (pid: 2462, threadinfo ffff88007a17c000, task ffff88007c3e5840) Stack: 00000000000000fb ffff88007c3e5840 00000a897c3e5840 00000a8a00000a00 <0> 010000af7a17dcb8 ffff88000ba0e000 ffff880071086438 ffff88007219d000 <0> ffff88007219d000 ffff8800701d41a0 ffff8800288e2d80 ffff880071086060 Call Trace: [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff8139529b>] ? _atomic_dec_and_lock+0x6b/0x90 [<ffffffff8113ac14>] ? mntput_no_expire+0x24/0xf0 [<ffffffff8111f448>] ? sys_fchmodat+0x78/0x100 [<ffffffff8112a19c>] ? path_put+0x2c/0x40 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Code: 00 00 48 81 c7 b8 1a 00 00 e8 85 da d6 ff e9 56 fd ff ff 49 8b 77 10 48 8b bd 68 ff ff ff e8 80 fa ff ff 85 c0 0f 84 03 ff ff ff <0f> 0b eb fe 48 8b 75 80 48 8b bd 68 ff ff ff e8 24 15 01 00 e9 RIP [<ffffffff8132e518>] btrfs_rename+0x4c8/0x590 RSP <ffff88007a17dc78> ---[ end trace 613e6e60575556d3 ]--- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-13 19:09 Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) Tomas Carnecky @ 2010-01-13 20:13 ` Josef Bacik 2010-01-13 20:11 ` Tomas Carnecky 0 siblings, 1 reply; 7+ messages in thread From: Josef Bacik @ 2010-01-13 20:13 UTC (permalink / raw) To: Tomas Carnecky; +Cc: linux-btrfs On Wed, Jan 13, 2010 at 08:09:17PM +0100, Tomas Carnecky wrote: > I was running v2.6.33-rc2-187-g08d869a and everything was ok. Today I > decided to update the kernel (to v2.6.33-rc4) and a minute or two after > logging into the gnome desktop this kernel bug appeared in dmesg. I then > went back to the old kernel but the bug didn't disappear, not even after > running btrfsck on the filesystem. > Ok will you please run with this patch? It shouldn't panic your box, since it seems ret is -EEXIST. Just watch your logs for OH NO, ORPHAN ENTRY ALREADY EXISTS FOR <number> and then look up and find all occurances of Btrfs: orphan add <number> with the stack trace and send it back to me so I can verify that nothing heinous is happening. I assume we're just racing with unlink/rename so all that needs to be done is to take that BUG_ON out, but it would be nice to know for sure. Thanks, Josef diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5440bab..68fc2e0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2096,6 +2096,13 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) */ ret = btrfs_insert_orphan_item(trans, root, inode->i_ino); + printk(KERN_ERR "Btrfs: orphan add %llu\n", (unsigned long long)inode->i_ino); + dump_stack(); + if (ret) { + printk(KERN_ERR "OH NO, ORPHAN ENTRY ALREADY EXISTS FOR %llu\n", + (unsigned long long)inode->i_ino); + } + return ret; } @@ -5592,7 +5599,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, BUG_ON(ret); if (new_inode->i_nlink == 0) { ret = btrfs_orphan_add(trans, new_dentry->d_inode); - BUG_ON(ret); + BUG_ON(ret && ret != -EEXIST); } } ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-13 20:13 ` Josef Bacik @ 2010-01-13 20:11 ` Tomas Carnecky 2010-01-14 17:03 ` Josef Bacik 0 siblings, 1 reply; 7+ messages in thread From: Tomas Carnecky @ 2010-01-13 20:11 UTC (permalink / raw) To: Josef Bacik; +Cc: linux-btrfs On 1/13/10 9:13 PM, Josef Bacik wrote: > On Wed, Jan 13, 2010 at 08:09:17PM +0100, Tomas Carnecky wrote: >> I was running v2.6.33-rc2-187-g08d869a and everything was ok. Today I >> decided to update the kernel (to v2.6.33-rc4) and a minute or two after >> logging into the gnome desktop this kernel bug appeared in dmesg. I then >> went back to the old kernel but the bug didn't disappear, not even after >> running btrfsck on the filesystem. >> > Ok will you please run with this patch? It shouldn't panic your box, since it > seems ret is -EEXIST. Just watch your logs for > > OH NO, ORPHAN ENTRY ALREADY EXISTS FOR<number> > > and then look up and find all occurances of > > Btrfs: orphan add<number> > > with the stack trace and send it back to me so I can verify that nothing heinous > is happening. I assume we're just racing with unlink/rename so all that needs > to be done is to take that BUG_ON out, but it would be nice to know for sure. Btrfs: orphan add 3021394 Pid: 2029, comm: gdm Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8139aa65>] ? __up_write+0xe5/0x150 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021395 Pid: 2029, comm: gdm Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8139aa65>] ? __up_write+0xe5/0x150 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021384 Pid: 2029, comm: gdm Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8109de67>] ? __put_cred+0x37/0x50 [<ffffffff8109e0a2>] ? commit_creds+0xb2/0x120 [<ffffffff81090670>] ? sys_setresuid+0x150/0x160 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021385 Pid: 2345, comm: gdm Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff810fd6f8>] ? handle_mm_fault+0x188/0x840 [<ffffffff8109bf89>] ? up_read+0x9/0x10 [<ffffffff8105b071>] ? do_page_fault+0x141/0x2e0 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 1891 Pid: 2357, comm: dbus-launch Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132ef33>] btrfs_setattr+0xf3/0x270 [<ffffffff81137b64>] notify_change+0x104/0x2e0 [<ffffffff8111f8ff>] do_truncate+0x5f/0x90 [<ffffffff8112a03c>] ? get_write_access+0x3c/0x60 [<ffffffff8112e4da>] do_filp_open+0x99a/0xf00 [<ffffffff8112a67d>] ? __lookup_hash+0xed/0x150 [<ffffffff81138a92>] ? alloc_fd+0xf2/0x140 [<ffffffff8111e8e4>] do_sys_open+0x64/0x140 [<ffffffff81036e3c>] ? math_state_restore+0x2c/0x50 [<ffffffff8111e9eb>] sys_open+0x1b/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021399 Pid: 2345, comm: gnome-session Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8139aa65>] ? __up_write+0xe5/0x150 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021400 Pid: 2368, comm: gconf-sanity-ch Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff81121d0d>] ? fput+0x1d/0x30 [<ffffffff8111e73d>] ? filp_close+0x4d/0x80 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b CE: hpet increasing min_delta_ns to 15000 nsec Btrfs: orphan add 3021401 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8109bf89>] ? up_read+0x9/0x10 [<ffffffff8105b071>] ? do_page_fault+0x141/0x2e0 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021402 Pid: 2429, comm: gpg Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8109bf89>] ? up_read+0x9/0x10 [<ffffffff8105b071>] ? do_page_fault+0x141/0x2e0 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021403 Pid: 2436, comm: gpg Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8109bf89>] ? up_read+0x9/0x10 [<ffffffff8105b071>] ? do_page_fault+0x141/0x2e0 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021404 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff81121d0d>] ? fput+0x1d/0x30 [<ffffffff8111e73d>] ? filp_close+0x4d/0x80 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021392 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff810c0600>] ? call_rcu+0x10/0x20 [<ffffffff8109de67>] ? __put_cred+0x37/0x50 [<ffffffff8111f84a>] ? sys_faccessat+0x19a/0x1d0 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021396 Pid: 2522, comm: xauth Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8139aa65>] ? __up_write+0xe5/0x150 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021406 Pid: 2522, comm: xauth Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8139aa65>] ? __up_write+0xe5/0x150 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 11796 Pid: 2445, comm: nautilus Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132ef33>] btrfs_setattr+0xf3/0x270 [<ffffffff81137b64>] notify_change+0x104/0x2e0 [<ffffffff81134d9a>] ? __d_lookup+0xfa/0x140 [<ffffffff8111f8ff>] do_truncate+0x5f/0x90 [<ffffffff8112a03c>] ? get_write_access+0x3c/0x60 [<ffffffff8112e4da>] do_filp_open+0x99a/0xf00 [<ffffffff811324e0>] ? pollwake+0x0/0x60 [<ffffffff81097580>] ? autoremove_wake_function+0x0/0x40 [<ffffffff81138a92>] ? alloc_fd+0xf2/0x140 [<ffffffff8111e8e4>] do_sys_open+0x64/0x140 [<ffffffff8111e9eb>] sys_open+0x1b/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b Btrfs: orphan add 3021266 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff813952cb>] ? _atomic_dec_and_lock+0x6b/0x90 [<ffffffff8113ac14>] ? mntput_no_expire+0x24/0xf0 [<ffffffff8111f448>] ? sys_fchmodat+0x78/0x100 [<ffffffff8112a19c>] ? path_put+0x2c/0x40 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021266 Btrfs: orphan add 3021267 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff813952cb>] ? _atomic_dec_and_lock+0x6b/0x90 [<ffffffff8113ac14>] ? mntput_no_expire+0x24/0xf0 [<ffffffff8111f448>] ? sys_fchmodat+0x78/0x100 [<ffffffff8112a19c>] ? path_put+0x2c/0x40 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021267 Btrfs: orphan add 3021268 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff813952cb>] ? _atomic_dec_and_lock+0x6b/0x90 [<ffffffff8113ac14>] ? mntput_no_expire+0x24/0xf0 [<ffffffff8111f448>] ? sys_fchmodat+0x78/0x100 [<ffffffff8112a19c>] ? path_put+0x2c/0x40 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021268 Btrfs: orphan add 3021269 Pid: 2374, comm: gconfd-2 Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff813952cb>] ? _atomic_dec_and_lock+0x6b/0x90 [<ffffffff8113ac14>] ? mntput_no_expire+0x24/0xf0 [<ffffffff8111f448>] ? sys_fchmodat+0x78/0x100 [<ffffffff8112a19c>] ? path_put+0x2c/0x40 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021269 Btrfs: orphan add 3021271 Pid: 2502, comm: gvfsd-metadata Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e540>] btrfs_rename+0x4c0/0x590 [<ffffffff8112b56a>] vfs_rename+0x3da/0x420 [<ffffffff8112d07e>] sys_renameat+0x23e/0x270 [<ffffffff810fd6f8>] ? handle_mm_fault+0x188/0x840 [<ffffffff8111e983>] ? do_sys_open+0x103/0x140 [<ffffffff8112d0c6>] sys_rename+0x16/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021271 Btrfs: orphan add 3021272 Pid: 2502, comm: gvfsd-metadata Not tainted 2.6.33-rc2-00202-g63ebcc6-dirty #15 Call Trace: [<ffffffff8132e05b>] btrfs_orphan_add+0xcb/0xf0 [<ffffffff8132e8ab>] btrfs_unlink+0xfb/0x120 [<ffffffff81129e10>] ? inode_permission+0x70/0x90 [<ffffffff8112b093>] vfs_unlink+0x83/0xf0 [<ffffffff8112a710>] ? lookup_hash+0x30/0x40 [<ffffffff8112d253>] do_unlinkat+0x183/0x1c0 [<ffffffff8109bf89>] ? up_read+0x9/0x10 [<ffffffff8105b071>] ? do_page_fault+0x141/0x2e0 [<ffffffff8112d2a1>] sys_unlink+0x11/0x20 [<ffffffff81035e6b>] system_call_fastpath+0x16/0x1b OH NO, ORPHAN ENTRY ALREADY EXISTS FOR 3021272 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-13 20:11 ` Tomas Carnecky @ 2010-01-14 17:03 ` Josef Bacik 2010-01-14 19:00 ` Josef Bacik 0 siblings, 1 reply; 7+ messages in thread From: Josef Bacik @ 2010-01-14 17:03 UTC (permalink / raw) To: Tomas Carnecky; +Cc: Josef Bacik, linux-btrfs On Wed, Jan 13, 2010 at 09:11:59PM +0100, Tomas Carnecky wrote: > On 1/13/10 9:13 PM, Josef Bacik wrote: >> On Wed, Jan 13, 2010 at 08:09:17PM +0100, Tomas Carnecky wrote: >>> I was running v2.6.33-rc2-187-g08d869a and everything was ok. Today I >>> decided to update the kernel (to v2.6.33-rc4) and a minute or two after >>> logging into the gnome desktop this kernel bug appeared in dmesg. I then >>> went back to the old kernel but the bug didn't disappear, not even after >>> running btrfsck on the filesystem. >>> >> Ok will you please run with this patch? It shouldn't panic your box, since it >> seems ret is -EEXIST. Just watch your logs for >> >> OH NO, ORPHAN ENTRY ALREADY EXISTS FOR<number> >> >> and then look up and find all occurances of >> >> Btrfs: orphan add<number> >> >> with the stack trace and send it back to me so I can verify that nothing heinous >> is happening. I assume we're just racing with unlink/rename so all that needs >> to be done is to take that BUG_ON out, but it would be nice to know for sure. > Ok will you try this patch? I've not built it, so sorry if it doesn't compile :). Look for the "OH NO" messages again. If they show up then the problem is still there, if they go away the problem is fixed. I tried to reproduce this locally but I can't seem to do it, so you are my only hope :). By the way, this replaces the last patch I sent you, so unapply the previous patch and apply this one instead. Thanks, Josef diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5440bab..c255dcb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2096,6 +2096,13 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) */ ret = btrfs_insert_orphan_item(trans, root, inode->i_ino); + printk(KERN_ERR "Btrfs: orphan add %llu\n", (unsigned long long)inode->i_ino); + dump_stack(); + if (ret) { + printk(KERN_ERR "OH NO, ORPHAN ENTRY ALREADY EXISTS FOR %llu\n", + (unsigned long long)inode->i_ino); + } + return ret; } @@ -3293,10 +3300,10 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) unsigned long nr; int ret; - if (attr->ia_size == inode->i_size) + if (attr->ia_size == i_size_read(inode)) return 0; - if (attr->ia_size > inode->i_size) { + if (attr->ia_size > i_size_read(inode)) { unsigned long limit; limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; if (attr->ia_size > inode->i_sb->s_maxbytes) @@ -3305,24 +3312,7 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) send_sig(SIGXFSZ, current, 0); return -EFBIG; } - } - - ret = btrfs_reserve_metadata_space(root, 1); - if (ret) - return ret; - - trans = btrfs_start_transaction(root, 1); - btrfs_set_trans_block_group(trans, inode); - - ret = btrfs_orphan_add(trans, inode); - BUG_ON(ret); - - nr = trans->blocks_used; - btrfs_end_transaction(trans, root); - btrfs_unreserve_metadata_space(root, 1); - btrfs_btree_balance_dirty(root, nr); - if (attr->ia_size > inode->i_size) { ret = btrfs_cont_expand(inode, attr->ia_size); if (ret) { btrfs_truncate(inode); @@ -3345,6 +3335,21 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) btrfs_end_transaction(trans, root); btrfs_btree_balance_dirty(root, nr); return 0; + } else if (attr->ia_size < i_size_read(inode)) { + ret = btrfs_reserve_metadata_space(root, 1); + if (ret) + return ret; + + trans = btrfs_start_transaction(root, 1); + btrfs_set_trans_block_group(trans, inode); + + ret = btrfs_orphan_add(trans, inode); + BUG_ON(ret); + + nr = trans->blocks_used; + btrfs_end_transaction(trans, root); + btrfs_unreserve_metadata_space(root, 1); + btrfs_btree_balance_dirty(root, nr); } /* @@ -3355,10 +3360,6 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) if (attr->ia_size == 0) BTRFS_I(inode)->ordered_data_close = 1; - /* we don't support swapfiles, so vmtruncate shouldn't fail */ - ret = vmtruncate(inode, attr->ia_size); - BUG_ON(ret); - return 0; } @@ -3376,7 +3377,6 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) if (err) return err; } - attr->ia_valid &= ~ATTR_SIZE; if (attr->ia_valid) err = inode_setattr(inode, attr); @@ -5592,7 +5592,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, BUG_ON(ret); if (new_inode->i_nlink == 0) { ret = btrfs_orphan_add(trans, new_dentry->d_inode); - BUG_ON(ret); + BUG_ON(ret && ret != -EEXIST); } } ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-14 17:03 ` Josef Bacik @ 2010-01-14 19:00 ` Josef Bacik 2010-01-14 20:20 ` Yan, Zheng 0 siblings, 1 reply; 7+ messages in thread From: Josef Bacik @ 2010-01-14 19:00 UTC (permalink / raw) To: Josef Bacik; +Cc: Tomas Carnecky, linux-btrfs On Thu, Jan 14, 2010 at 12:03:23PM -0500, Josef Bacik wrote: > On Wed, Jan 13, 2010 at 09:11:59PM +0100, Tomas Carnecky wrote: > > On 1/13/10 9:13 PM, Josef Bacik wrote: > >> On Wed, Jan 13, 2010 at 08:09:17PM +0100, Tomas Carnecky wrote: > >>> I was running v2.6.33-rc2-187-g08d869a and everything was ok. Today I > >>> decided to update the kernel (to v2.6.33-rc4) and a minute or two after > >>> logging into the gnome desktop this kernel bug appeared in dmesg. I then > >>> went back to the old kernel but the bug didn't disappear, not even after > >>> running btrfsck on the filesystem. > >>> > >> Ok will you please run with this patch? It shouldn't panic your box, since it > >> seems ret is -EEXIST. Just watch your logs for > >> > >> OH NO, ORPHAN ENTRY ALREADY EXISTS FOR<number> > >> > >> and then look up and find all occurances of > >> > >> Btrfs: orphan add<number> > >> > >> with the stack trace and send it back to me so I can verify that nothing heinous > >> is happening. I assume we're just racing with unlink/rename so all that needs > >> to be done is to take that BUG_ON out, but it would be nice to know for sure. > > > > Ok will you try this patch? I've not built it, so sorry if it doesn't compile > :). Look for the "OH NO" messages again. If they show up then the problem is > still there, if they go away the problem is fixed. I tried to reproduce this > locally but I can't seem to do it, so you are my only hope :). > > By the way, this replaces the last patch I sent you, so unapply the previous > patch and apply this one instead. Thanks, > Ok here's the final version of the patch I'm going to post. This replaces the other patches that I sent you, so un-apply the last one you applied and apply this one instead. Run this for a day and let me know if you have any problems. If no problems I'll go ahead and post it. Thanks, Josef diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5440bab..24cbf6b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3305,24 +3305,7 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) send_sig(SIGXFSZ, current, 0); return -EFBIG; } - } - - ret = btrfs_reserve_metadata_space(root, 1); - if (ret) - return ret; - - trans = btrfs_start_transaction(root, 1); - btrfs_set_trans_block_group(trans, inode); - - ret = btrfs_orphan_add(trans, inode); - BUG_ON(ret); - - nr = trans->blocks_used; - btrfs_end_transaction(trans, root); - btrfs_unreserve_metadata_space(root, 1); - btrfs_btree_balance_dirty(root, nr); - if (attr->ia_size > inode->i_size) { ret = btrfs_cont_expand(inode, attr->ia_size); if (ret) { btrfs_truncate(inode); @@ -3337,14 +3320,26 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) ret = btrfs_update_inode(trans, root, inode); BUG_ON(ret); - if (inode->i_nlink > 0) { - ret = btrfs_orphan_del(trans, inode); - BUG_ON(ret); - } + nr = trans->blocks_used; btrfs_end_transaction(trans, root); btrfs_btree_balance_dirty(root, nr); return 0; + } else if (attr->ia_size < i_size_read(inode)) { + ret = btrfs_reserve_metadata_space(root, 1); + if (ret) + return ret; + + trans = btrfs_start_transaction(root, 1); + btrfs_set_trans_block_group(trans, inode); + + ret = btrfs_orphan_add(trans, inode); + BUG_ON(ret); + + nr = trans->blocks_used; + btrfs_end_transaction(trans, root); + btrfs_unreserve_metadata_space(root, 1); + btrfs_btree_balance_dirty(root, nr); } /* @@ -3355,10 +3350,6 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) if (attr->ia_size == 0) BTRFS_I(inode)->ordered_data_close = 1; - /* we don't support swapfiles, so vmtruncate shouldn't fail */ - ret = vmtruncate(inode, attr->ia_size); - BUG_ON(ret); - return 0; } @@ -3376,7 +3367,6 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) if (err) return err; } - attr->ia_valid &= ~ATTR_SIZE; if (attr->ia_valid) err = inode_setattr(inode, attr); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-14 19:00 ` Josef Bacik @ 2010-01-14 20:20 ` Yan, Zheng 2010-01-14 23:59 ` Tomas Carnecky 0 siblings, 1 reply; 7+ messages in thread From: Yan, Zheng @ 2010-01-14 20:20 UTC (permalink / raw) To: Josef Bacik; +Cc: Tomas Carnecky, linux-btrfs On Fri, Jan 15, 2010 at 3:00 AM, Josef Bacik <josef@redhat.com> wrote: > On Thu, Jan 14, 2010 at 12:03:23PM -0500, Josef Bacik wrote: >> On Wed, Jan 13, 2010 at 09:11:59PM +0100, Tomas Carnecky wrote: >> > =A0On 1/13/10 9:13 PM, Josef Bacik wrote: >> >> On Wed, Jan 13, 2010 at 08:09:17PM +0100, Tomas Carnecky wrote: >> >>> =A0 I was running v2.6.33-rc2-187-g08d869a and everything was ok= =2E Today I >> >>> decided to update the kernel (to v2.6.33-rc4) and a minute or tw= o after >> >>> logging into the gnome desktop this kernel bug appeared in dmesg= =2E I then >> >>> went back to the old kernel but the bug didn't disappear, not ev= en after >> >>> running btrfsck on the filesystem. >> >>> >> >> Ok will you please run with this patch? =A0It shouldn't panic you= r box, since it >> >> seems ret is -EEXIST. =A0Just watch your logs for >> >> >> >> OH NO, ORPHAN ENTRY ALREADY EXISTS FOR<number> >> >> >> >> and then look up and find all occurances of >> >> >> >> Btrfs: orphan add<number> >> >> >> >> with the stack trace and send it back to me so I can verify that = nothing heinous >> >> is happening. =A0I assume we're just racing with unlink/rename so= all that needs >> >> to be done is to take that BUG_ON out, but it would be nice to kn= ow for sure. >> > >> >> Ok will you try this patch? =A0I've not built it, so sorry if it doe= sn't compile >> :). =A0Look for the "OH NO" messages again. =A0If they show up then = the problem is >> still there, if they go away the problem is fixed. =A0I tried to rep= roduce this >> locally but I can't seem to do it, so you are my only hope :). >> >> By the way, this replaces the last patch I sent you, so unapply the = previous >> patch and apply this one instead. =A0Thanks, >> > > Ok here's the final version of the patch I'm going to post. =A0This r= eplaces the > other patches that I sent you, so un-apply the last one you applied a= nd apply > this one instead. =A0Run this for a day and let me know if you have a= ny problems. > If no problems I'll go ahead and post it. =A0Thanks, > > Josef > > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 5440bab..24cbf6b 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -3305,24 +3305,7 @@ static int btrfs_setattr_size(struct inode *in= ode, struct iattr *attr) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0send_sig(SIGXFSZ, curr= ent, 0); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -EFBIG; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 } > - > - =A0 =A0 =A0 ret =3D btrfs_reserve_metadata_space(root, 1); > - =A0 =A0 =A0 if (ret) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret; > - > - =A0 =A0 =A0 trans =3D btrfs_start_transaction(root, 1); > - =A0 =A0 =A0 btrfs_set_trans_block_group(trans, inode); > - > - =A0 =A0 =A0 ret =3D btrfs_orphan_add(trans, inode); > - =A0 =A0 =A0 BUG_ON(ret); > - > - =A0 =A0 =A0 nr =3D trans->blocks_used; > - =A0 =A0 =A0 btrfs_end_transaction(trans, root); > - =A0 =A0 =A0 btrfs_unreserve_metadata_space(root, 1); > - =A0 =A0 =A0 btrfs_btree_balance_dirty(root, nr); > > - =A0 =A0 =A0 if (attr->ia_size > inode->i_size) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D btrfs_cont_expand(inode, attr-= >ia_size); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ret) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0btrfs_truncate(inode); > @@ -3337,14 +3320,26 @@ static int btrfs_setattr_size(struct inode *i= node, struct iattr *attr) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D btrfs_update_inode(trans, root= , inode); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BUG_ON(ret); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (inode->i_nlink > 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D btrfs_orphan_de= l(trans, inode); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(ret); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0nr =3D trans->blocks_used; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0btrfs_end_transaction(trans, root); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0btrfs_btree_balance_dirty(root, nr); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 0; > + =A0 =A0 =A0 } else if (attr->ia_size < i_size_read(inode)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D btrfs_reserve_metadata_space(ro= ot, 1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ret) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 trans =3D btrfs_start_transaction(root,= 1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_set_trans_block_group(trans, inod= e); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D btrfs_orphan_add(trans, inode); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(ret); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 nr =3D trans->blocks_used; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_end_transaction(trans, root); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_unreserve_metadata_space(root, 1)= ; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_btree_balance_dirty(root, nr); > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0/* > @@ -3355,10 +3350,6 @@ static int btrfs_setattr_size(struct inode *in= ode, struct iattr *attr) > =A0 =A0 =A0 =A0if (attr->ia_size =3D=3D 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BTRFS_I(inode)->ordered_data_close =3D= 1; > > - =A0 =A0 =A0 /* we don't support swapfiles, so vmtruncate shouldn't = fail */ > - =A0 =A0 =A0 ret =3D vmtruncate(inode, attr->ia_size); > - =A0 =A0 =A0 BUG_ON(ret); > - > =A0 =A0 =A0 =A0return 0; > =A0} > > @@ -3376,7 +3367,6 @@ static int btrfs_setattr(struct dentry *dentry,= struct iattr *attr) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (err) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return err; > =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 attr->ia_valid &=3D ~ATTR_SIZE; > > =A0 =A0 =A0 =A0if (attr->ia_valid) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0err =3D inode_setattr(inode, attr); > -- It looks like a ENOSPC related problem, btrfs_truncate doesn't remove t= he orphan item if it fails to finish its operation. so I don't think this patch fixes the problem Regards Yan, Zheng -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) 2010-01-14 20:20 ` Yan, Zheng @ 2010-01-14 23:59 ` Tomas Carnecky 0 siblings, 0 replies; 7+ messages in thread From: Tomas Carnecky @ 2010-01-14 23:59 UTC (permalink / raw) To: Yan, Zheng ; +Cc: Josef Bacik, linux-btrfs On 01/14/2010 09:20 PM, Yan, Zheng wrote: > It looks like a ENOSPC related problem, btrfs_truncate doesn't remove the orphan > item if it fails to finish its operation. so I don't think this patch > fixes the problem Around the time when it happened, the filesystem was used only to ~55% (31G of 56G). tom ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-01-14 23:59 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-01-13 19:09 Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!) Tomas Carnecky 2010-01-13 20:13 ` Josef Bacik 2010-01-13 20:11 ` Tomas Carnecky 2010-01-14 17:03 ` Josef Bacik 2010-01-14 19:00 ` Josef Bacik 2010-01-14 20:20 ` Yan, Zheng 2010-01-14 23:59 ` Tomas Carnecky
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox