Bug 121111 - Btrfs check command fails with "assertion failed" error
Summary: Btrfs check command fails with "assertion failed" error
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-28 18:28 UTC by Francesco Turco
Modified: 2016-06-28 18:28 UTC (History)
0 users

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


Attachments

Description Francesco Turco 2016-06-28 18:28:50 UTC
When trying to repair a btrfs root filesystem I get the following error
message:

# losetup -f /home/fturco/Buffer/root-20160616.img
# btrfs check --repair /dev/loop0
enabling repair mode
warning, device 4 is missing
Checking filesystem on /dev/loop0
UUID: 34fb5b58-f50f-47c3-a5b8-91d81a30eade
checking extents
Unable to find block group for 0
extent-tree.c:289: find_search_start: Assertion `1` failed.
btrfs[0x44882e]
btrfs(btrfs_reserve_extent+0xaa9)[0x44d639]
btrfs(btrfs_alloc_free_block+0x5f)[0x44d6ff]
btrfs(__btrfs_cow_block+0xc4)[0x43e9d4]
btrfs(btrfs_cow_block+0x35)[0x43efd5]
btrfs[0x4442e6]
btrfs(btrfs_commit_transaction+0x95)[0x446115]
btrfs[0x42b58e]
btrfs(cmd_check+0x76c)[0x42c60c]
btrfs(main+0x7b)[0x40ac3b]
/usr/lib/libc.so.6(__libc_start_main+0xf1)[0x7f272f658741]
btrfs(_start+0x29)[0x40ad39]

This is an unmountable filesystem:

# mount /dev/loop0 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

# dmesg | tail
[ 9185.503571] scsi 8:0:0:1: Direct-Access     Samsung  File-CD Gadget
0000 PQ: 0 ANSI: 2
[ 9185.513943] sd 8:0:0:0: [sdb] Attached SCSI removable disk
[ 9185.514565] sd 8:0:0:1: [sdc] Attached SCSI removable disk
[13773.533435] usb 1-4: USB disconnect, device number 8
[31454.672925] loop: module loaded
[31455.600069] BTRFS: device fsid 34fb5b58-f50f-47c3-a5b8-91d81a30eade
devid 1 transid 81460 /dev/loop0
[32584.640398] BTRFS info (device loop0): disk space caching is enabled
[32584.640403] BTRFS: has skinny extents
[32584.654196] BTRFS: failed to read the system array on loop0
[32584.666774] BTRFS: open_ctree failed

# btrfs filesystem show /dev/loop0
warning, device 4 is missing
Label: none  uuid: 34fb5b58-f50f-47c3-a5b8-91d81a30eade
	Total devices 2 FS bytes used 5.17GiB
	devid    1 size 30.00GiB used 30.00GiB path /dev/loop0
	*** Some devices missing

If I remember correctly I extended that root filesystem with some
additional space from a file in the home directory, in the hope of
fixing a problem with btrfs balance and not enough space. I don't have
the additional file anymore, so I probably won't be able to mount this
image file anymore. Anyway btrfs-check shouldn't crash.

I'm running Parabola GNU/Linux-libre with the following package versions:
- linux-libre: 4.6.2
- btrfs-progs: 4.5.3

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