Bug 13957 - BUG at fs/btrfs/volumes.c (degraded volume)
BUG at fs/btrfs/volumes.c (degraded volume)
Status: CLOSED OBSOLETE
Product: File System
Classification: Unclassified
Component: btrfs
All Linux
: P1 normal
Assigned To: fs_btrfs@kernel-bugs.osdl.org
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-10 13:27 UTC by Jan "Yenya" Kasprzak
Modified: 2012-06-13 14:47 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.31-rc5
Tree: Mainline
Regression: No


Attachments

Description Jan "Yenya" Kasprzak 2009-08-10 13:27:01 UTC
I have a btrfs volume /home over 8 partitions /dev/sd[a-h]2 (mirrored both data and metadata). Recently one of the drives died, and I wanted to replace it as described in the wiki (Using_Btrfs_with_Multiple_Devices). I can mount the filesystem with -o degraded, but when trying to do "btrfs-vol -r missing" or ls /home, the kernel oopses with the attached BUG().

I have reproduced it both with vanilla 2.6.31-rc1 and -rc5, and with Fedora 11 kernel-2.6.29.6-217.2.3.fc11.x86_64.

I have tried btrfsck /dev/sda2, but it failed with
btrfsck: volumes.c:1367: btrfs_read_sys_array: Assertion `!(ret)' failed.
Aborted

The system is Fedora 11, btrfs-progs-0.19-6.fc12.x86_64.

device label home devid 1 transid 373 /dev/sda2
btrfs: allowing degraded mounts
btrfs allocation failed flags 66, wanted 4096
space_info has 8359936 free, is not full
space_info total=8388608, pinned=0, delalloc=0, may_use=0, used=28672
block group 20971520 has 8388608 bytes, 28672 used 0 pinned 0 reserved
entry offset 20971520, bytes 4096, bitmap no
entry offset 20987904, bytes 12288, bitmap no
entry offset 21016576, bytes 8343552, bitmap no
block group has cluster?: no
3 blocks of free space at or bigger than bytes is
------------[ cut here ]------------
kernel BUG at fs/btrfs/volumes.c:2348!
invalid opcode: 0000 [#1] SMP 
last sysfs file: /sys/devices/pci0000:00/0000:00:14.4/0000:03:0f.0/irq
CPU 0 
Modules linked in: loop btrfs zlib_deflate [last unloaded: scsi_wait_scan]
Pid: 3376, comm: ls Not tainted 2.6.31-rc5 #1 GA-MA69VM-S2
RIP: 0010:[<ffffffffa0049b65>]  [<ffffffffa0049b65>] __finish_chunk_alloc+0xb3/0x20c [btrfs]
RSP: 0018:ffff8801177f1a08  EFLAGS: 00010286
RAX: 00000000ffffffe4 RBX: ffff88011e53cd80 RCX: ffff88011c784360
RDX: 0000000000000000 RSI: ffffea0003e3a4e0 RDI: ffff88011c784090
RBP: ffff88011e65e000 R08: 000000007ffe0000 R09: 000000002aaa0000
R10: ffffffff815f8480 R11: 00000000000003fc R12: ffff8801177c8600
R13: ffff88011e65b000 R14: 0000003c81c00000 R15: 00000000000000f0
FS:  00007fde454c9790(0000) GS:ffff88002801f000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000038cd2a0150 CR3: 000000011773a000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ls (pid: 3376, threadinfo ffff8801177f0000, task ffff88011ea6a1c0)
Stack:
 000000002aaa0000 000000007ffe0000 0000000400000000 ffff88011c7a6000
<0> ffff88011f254610 ffff8801177c6e10 0000000f20300000 0000000000000000
<0> ffff88011e0c42ff ffff88011e65e000 ffff88011c7a6000 0000000000000044
Call Trace:
 [<ffffffffa004b4f3>] ? btrfs_alloc_chunk+0x75/0x86 [btrfs]
 [<ffffffffa001e418>] ? do_chunk_alloc+0x179/0x1b3 [btrfs]
 [<ffffffffa001efeb>] ? __btrfs_reserve_extent+0xad/0x28f [btrfs]
 [<ffffffff810bdaf5>] ? proc_alloc_inode+0x58/0x89
 [<ffffffff81092a47>] ? inode_init_always+0xf4/0x1ce
 [<ffffffffa0024506>] ? btrfs_alloc_free_block+0x56/0x15c [btrfs]
 [<ffffffffa001813d>] ? __btrfs_cow_block+0x159/0x645 [btrfs]
 [<ffffffffa0018d08>] ? btrfs_cow_block+0x1b9/0x1d7 [btrfs]
 [<ffffffffa001b705>] ? btrfs_search_slot+0x758/0x7a8 [btrfs]
 [<ffffffff8107d8f0>] ? __slab_alloc+0x29c/0x4f6
 [<ffffffff8108d785>] ? filldir+0x0/0xbb
 [<ffffffffa002783d>] ? btrfs_lookup_inode+0x25/0x84 [btrfs]
 [<ffffffffa002fd56>] ? btrfs_update_inode+0x4c/0xc3 [btrfs]
 [<ffffffff8108d785>] ? filldir+0x0/0xbb
 [<ffffffffa0032358>] ? btrfs_dirty_inode+0x35/0x44 [btrfs]
 [<ffffffff8109a492>] ? __mark_inode_dirty+0x26/0xf8
 [<ffffffff81091a7f>] ? touch_atime+0x107/0x110
 [<ffffffff8108d785>] ? filldir+0x0/0xbb
 [<ffffffff8108d950>] ? vfs_readdir+0x84/0xaa
 [<ffffffff8108daae>] ? sys_getdents+0x79/0xc4
 [<ffffffff81360eaf>] ? page_fault+0x1f/0x30
 [<ffffffff8100ad6b>] ? system_call_fastpath+0x16/0x1b
Code: 00 00 00 89 54 24 10 48 8b 7c 24 18 4c 89 44 24 08 4c 89 0c 24 e8 19 fe ff ff 85 c0 8b 54 24 10 4c 8b 44 24 08 4c 8b 0c 24 74 04 <0f> 0b eb fe ff c2 3b 53 18 7c b7 49 8d 44 24 30 31 d2 eb 3e 48 
RIP  [<ffffffffa0049b65>] __finish_chunk_alloc+0xb3/0x20c [btrfs]
 RSP <ffff8801177f1a08>
---[ end trace e0ca850518698202 ]---

I am sorry but I have to move this machine to the production use, so I am migrating it to ext4+md. I will not be able to provide further btrfs-related debugging info. If the above dmesg report is not sufficient, feel free to close the bug as WORKSFORSOME or whatever, and sorry for the noise.
Comment 1 Jan "Yenya" Kasprzak 2009-08-10 13:31:06 UTC
The above trace was from "ls /home". I am adding one more from "btrfs-vol -r missing":

btrfs: allowing degraded mounts
btrfs allocation failed flags 66, wanted 4096
space_info has 8359936 free, is not full
space_info total=8388608, pinned=0, delalloc=0, may_use=0, used=28672
block group 20971520 has 8388608 bytes, 28672 used 0 pinned 0 reserved
entry offset 20971520, bytes 4096, bitmap no
entry offset 20987904, bytes 12288, bitmap no
entry offset 21016576, bytes 8343552, bitmap no
block group has cluster?: no
3 blocks of free space at or bigger than bytes is
------------[ cut here ]------------
kernel BUG at fs/btrfs/volumes.c:2348!
invalid opcode: 0000 [#1] SMP 
last sysfs file: /sys/devices/pci0000:00/0000:00:04.0/0000:02:00.0/host7/target7:0:0/7:0:0:0/block/sdh/sdh2/start
CPU 0 
Modules linked in: loop btrfs zlib_deflate [last unloaded: scsi_wait_scan]
Pid: 3762, comm: btrfs-vol Not tainted 2.6.31-rc5 #1 GA-MA69VM-S2
RIP: 0010:[<ffffffffa0049b65>]  [<ffffffffa0049b65>] __finish_chunk_alloc+0xb3/0x20c [btrfs]
RSP: 0018:ffff88011eaa7688  EFLAGS: 00010286
RAX: 00000000ffffffe4 RBX: ffff8801154dba00 RCX: ffff88011fb18730
RDX: 0000000000000000 RSI: ffffea0003e484a8 RDI: ffff88011fb18720
RBP: ffff88011d1eb000 R08: 000000007ffe0000 R09: 000000002aaa0000
R10: ffffffff815f8480 R11: 00000000000003fc R12: ffff88011e072900
R13: ffff88011d1ed800 R14: 0000003c81c00000 R15: 00000000000000f0
FS:  00007f9def1ee740(0000) GS:ffff88002801f000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000026d2800 CR3: 000000011e220000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process btrfs-vol (pid: 3762, threadinfo ffff88011eaa6000, task ffff88011e673840)
Stack:
 000000002aaa0000 000000007ffe0000 0000000400000000 ffff880115224000
<0> ffff88011e5fb610 ffff88011f391010 0000000f20300000 0000000000000000
<0> 00000000000000ff ffff88011d1eb000 ffff880115224000 0000000000000044
Call Trace:
 [<ffffffffa004b4f3>] ? btrfs_alloc_chunk+0x75/0x86 [btrfs]
 [<ffffffffa001e418>] ? do_chunk_alloc+0x179/0x1b3 [btrfs]
 [<ffffffffa001efeb>] ? __btrfs_reserve_extent+0xad/0x28f [btrfs]
 [<ffffffff8101fc79>] ? flush_gart+0xd/0x35
 [<ffffffff8101feac>] ? gart_map_sg+0x20b/0x382
 [<ffffffffa0024506>] ? btrfs_alloc_free_block+0x56/0x15c [btrfs]
 [<ffffffffa001813d>] ? __btrfs_cow_block+0x159/0x645 [btrfs]
 [<ffffffff81167650>] ? blk_peek_request+0x156/0x167
 [<ffffffffa0018d08>] ? btrfs_cow_block+0x1b9/0x1d7 [btrfs]
 [<ffffffffa001b705>] ? btrfs_search_slot+0x758/0x7a8 [btrfs]
 [<ffffffff8105ba39>] ? sync_page+0x0/0x45
 [<ffffffffa001bcc8>] ? btrfs_insert_empty_items+0x62/0xb5 [btrfs]
 [<ffffffffa0027e40>] ? btrfs_find_free_objectid+0x1c0/0x1f6 [btrfs]
 [<ffffffffa00278d5>] ? btrfs_insert_empty_inode+0x39/0x54 [btrfs]
 [<ffffffffa005ccfa>] ? create_reloc_inode+0xa4/0x243 [btrfs]
 [<ffffffffa005cf55>] ? btrfs_relocate_block_group+0xbc/0x2b6 [btrfs]
 [<ffffffffa0049cff>] ? btrfs_relocate_chunk+0x41/0x450 [btrfs]
 [<ffffffffa0039d10>] ? btrfs_dev_extent_chunk_offset+0xba/0xc8 [btrfs]
 [<ffffffffa004a308>] ? btrfs_shrink_device+0x1fa/0x2a9 [btrfs]
 [<ffffffff8108ac17>] ? __link_path_walk+0xba8/0xcbf
 [<ffffffffa004a8a8>] ? btrfs_rm_device+0x21a/0x4c5 [btrfs]
 [<ffffffff8105b8ab>] ? find_get_page+0x1a/0x72
 [<ffffffffa004e5f5>] ? btrfs_ioctl+0x945/0xa70 [btrfs]
 [<ffffffff8106bac1>] ? __do_fault+0x39e/0x3d6
 [<ffffffff8108ce28>] ? vfs_ioctl+0x19/0x83
 [<ffffffff8108d327>] ? do_vfs_ioctl+0x423/0x467
 [<ffffffff810237e2>] ? do_page_fault+0x1f8/0x20d
 [<ffffffff8108d3b6>] ? sys_ioctl+0x4b/0x6f
 [<ffffffff8100ad6b>] ? system_call_fastpath+0x16/0x1b
Code: 00 00 00 89 54 24 10 48 8b 7c 24 18 4c 89 44 24 08 4c 89 0c 24 e8 19 fe ff ff 85 c0 8b 54 24 10 4c 8b 44 24 08 4c 8b 0c 24 74 04 <0f> 0b eb fe ff c2 3b 53 18 7c b7 49 8d 44 24 30 31 d2 eb 3e 48 
RIP  [<ffffffffa0049b65>] __finish_chunk_alloc+0xb3/0x20c [btrfs]
 RSP <ffff88011eaa7688>
---[ end trace 8ae103fe673160df ]---
Comment 2 Alan 2012-06-13 14:47:42 UTC
If this is still seen on modern kernels please re-open giving the new kernel version in question

Thanks

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