Bug 26222 - btrfs kernel BUG
Summary: btrfs kernel BUG
Status: RESOLVED OBSOLETE
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: fs_btrfs@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-06 12:10 UTC by drserge
Modified: 2013-04-30 16:35 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.37
Tree: Mainline
Regression: No


Attachments

Description drserge 2011-01-06 12:10:36 UTC
Errors appear while writing to filesystem.

uname -a:
Linux server 2.6.37-gentoo #1 SMP Wed Jan 5 19:59:37 MSK 2011 x86_64 Intel(R) Pentium(R) D CPU 2.80GHz GenuineIntel GNU/Linux

dmesg output:
------------[ cut here ]------------
kernel BUG at fs/btrfs/inode.c:2897!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map
CPU 0
Modules linked in: it87 hwmon_vid hwmon i2c_i801

Pid: 2097, comm: postgres Not tainted 2.6.37-gentoo #1 945GM-S2/
RIP: 0010:[<ffffffff81237436>]  [<ffffffff81237436>] btrfs_unlink+0xe6/0xf3
RSP: 0018:ffff8800b6e39e38  EFLAGS: 00010282
RAX: 00000000fffffffe RBX: ffff8800b34f54e0 RCX: ffffffff816d0a00
RDX: 000000000000000a RSI: ffff8800b3504f40 RDI: ffff8800bc20a680
RBP: ffff8800b6e39e68 R08: 0000000000007758 R09: 0000000000000000
R10: 0000000000000000 R11: 6572656665722065 R12: 00000000fffffffe
R13: ffff8800b7da0600 R14: ffff8800bbab2000 R15: ffff8800b7da09a8
FS:  00007f0ed905b700(0000) GS:ffff8800bf400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0ed7bf2070 CR3: 00000000b6dfa000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process postgres (pid: 2097, threadinfo ffff8800b6e38000, task ffff8800b6e1f850)
Stack:
 ffff8800b6e39e68 00000000fffffff0 ffff8800b3508140 ffff8800b7da0600
 0000000000000000 0000000000000000 ffff8800b6e39e98 ffffffff810abf93
 ffff8800b6e39ea8 ffff8800b6e39ea8 ffff8800b3508140 ffff8800b7da09a8
Call Trace:
 [<ffffffff810abf93>] vfs_unlink+0x80/0xe5
 [<ffffffff810ae45a>] do_unlinkat+0x183/0x1b6
 [<ffffffff810ae49e>] sys_unlink+0x11/0x13
 [<ffffffff8100217b>] system_call_fastpath+0x16/0x1b
Code: 5d c3 8b b8 4c 22 00 00 85 ff 74 28 c7 80 4c 22 00 00 00 00 00 00 eb c2 4c 89 fe 48 89 df e8 18 f7 ff ff 85 c0 74 9b 0f 0b eb fe <0f> 0b eb fe 41 89 c4 eb bc 0f 0b eb fe 55 48 89 e5 41 56 41 55
RIP  [<ffffffff81237436>] btrfs_unlink+0xe6/0xf3
 RSP <ffff8800b6e39e38>
---[ end trace cfe661a14c9be192 ]---
Comment 1 drserge 2011-01-06 12:15:20 UTC
Another system with Atom N270 / i386 / hyperthreading (Linux border 2.6.37-gentoo #1 SMP Wed Jan 5 21:02:18 MSK 2011 i686 Intel(R) Atom(TM) CPU N270 @ 1.60GHz GenuineIntel GNU/Linux) does not have this problem with btrfs under 2.6.37.
Comment 2 David Sterba 2011-03-03 13:38:00 UTC
the bugon triggered is

static void __unlink_end_trans(struct btrfs_trans_handle *trans,
                               struct btrfs_root *root)
{
        if (trans->block_rsv == &root->fs_info->global_block_rsv) {

                BUG_ON(!root->fs_info->enospc_unlink);

                root->fs_info->enospc_unlink = 0;
        }
        btrfs_end_transaction_throttle(trans, root);
}

ie. expecting 1 == enospc_unlink. The changeset adding this is

commit a22285a6a32390195235171b89d157ed1a1fe932
Author: Yan, Zheng <zheng.yan@oracle.com>
Date:   Sun May 16 10:48:46 2010 -0400

    Btrfs: Integrate metadata reservation with start_transaction

    Besides simplify the code, this change makes sure all metadata
    reservation for normal metadata operations are released after
    committing transaction.

    Changes since V1:

    Add code that check if unlink and rmdir will free space.

    Add ENOSPC handling for clone ioctl.

    Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
    Signed-off-by: Chris Mason <chris.mason@oracle.com>

and is quite long. All I can say right now is that you've hit some corner case when there is no space left on device and probably your filesystem is under high load concerning unlink operation.
Comment 3 Josef Bacik 2013-04-30 16:35:44 UTC
Closing, if this is still affecting you on a newer kernel please reopen.

Note You need to log in before you can comment on or make changes to this bug.