kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
528 stars 239 forks source link

btrfs rescue chunk-recover sig abort #130

Open tomato42 opened 6 years ago

tomato42 commented 6 years ago

When running

btrfs rescue chunk-recover /dev/stacja/backup-fixing

on a damaged filesystem, the application aborts with SIGABRT

Scanning: 8368926720 in dev0chunk-recover.c:129: process_extent_buffer: BUG_ON `exist->nmirrors >= BTRFS_MAX_MIRRORS` triggered, value 1

this is with version v4.16.1

gdb backtrace

``` # LD_LIBRARY_PATH=. gdb ./btrfs # rescue chunk-recover /dev/stacja/backup-fixing GNU gdb (GDB) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./btrfs...done. (gdb) run rescue chunk-recover /dev/stacja/backup-fixing Starting program: /home/tomato/workspace/btrfs-progs/btrfs rescue chunk-recover /dev/stacja/backup-fixing [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0x7ffff6ce9700 (LWP 21520)] Scanning: 8168226816 in dev0chunk-recover.c:129: process_extent_buffer: BUG_ON `exist->nmirrors >= BTRFS_MAX_MIRRORS` triggered, value 1 /home/tomato/workspace/btrfs-progs/btrfs(+0xa113c)[0x5555555f513c] /home/tomato/workspace/btrfs-progs/btrfs(+0xa11eb)[0x5555555f51eb] /home/tomato/workspace/btrfs-progs/btrfs(+0xa2361)[0x5555555f6361] /home/tomato/workspace/btrfs-progs/btrfs(+0xa42e6)[0x5555555f82e6] /usr/lib/libpthread.so.0(+0x70bc)[0x7ffff70ac0bc] /usr/lib/libc.so.6(clone+0x3f)[0x7ffff6de12ff] Thread 2 "btrfs" received signal SIGABRT, Aborted. [Switching to Thread 0x7ffff6ce9700 (LWP 21520)] 0x00007ffff6d1eefb in raise () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007ffff6d1eefb in raise () from /usr/lib/libc.so.6 #1 0x00007ffff6d202c1 in abort () from /usr/lib/libc.so.6 #2 0x00005555555f51f0 in bugon_trace (assertion=0x555555651dd0 "exist->nmirrors >= BTRFS_MAX_MIRRORS", filename=0x555555651dbc "chunk-recover.c", func=0x555555652670 <__func__.10752> "process_extent_buffer", line=129, val=1) at kerncompat.h:115 #3 0x00005555555f6361 in process_extent_buffer (eb_cache=0x7fffffffe8b8, eb=0x7ffff0000b20, device=0x5555558862d0, offset=8506568704) at chunk-recover.c:129 #4 0x00005555555f82e6 in scan_one_device (dev_scan_struct=0x555555887a10) at chunk-recover.c:775 #5 0x00007ffff70ac0bc in start_thread () from /usr/lib/libpthread.so.0 #6 0x00007ffff6de12ff in clone () from /usr/lib/libc.so.6 (gdb) up #1 0x00007ffff6d202c1 in abort () from /usr/lib/libc.so.6 (gdb) up #2 0x00005555555f51f0 in bugon_trace (assertion=0x555555651dd0 "exist->nmirrors >= BTRFS_MAX_MIRRORS", filename=0x555555651dbc "chunk-recover.c", func=0x555555652670 <__func__.10752> "process_extent_buffer", line=129, val=1) at kerncompat.h:115 115 abort(); (gdb) up #3 0x00005555555f6361 in process_extent_buffer (eb_cache=0x7fffffffe8b8, eb=0x7ffff0000b20, device=0x5555558862d0, offset=8506568704) at chunk-recover.c:129 129 BUG_ON(exist->nmirrors >= BTRFS_MAX_MIRRORS); (gdb) p *exist $1 = {cache = {rb_node = {__rb_parent_color = 140737229123393, rb_right = 0x0, rb_left = 0x0}, objectid = 0, start = 263036928, size = 4096}, generation = 50003, csum = "\247\227\002\355", '\000' , devices = { 0x5555558862d0, 0x5555558862d0, 0x5555558862d0}, offsets = {271425536, 1345167360, 2216828928}, nmirrors = 3} (gdb) p *device $2 = {dev_list = {next = 0x555555886290, prev = 0x555555886290}, dev_root = 0x0, fs_devices = 0x555555886260, total_ios = 0, fd = -1, writeable = 0, name = 0x555555886370 "/dev/stacja/backup-fixing", label = 0x5555558863a0 "", total_devs = 1, super_bytes_used = 189761949696, generation = 92292, devid = 1, total_bytes = 214748364800, bytes_used = 214748364800, io_align = 0, io_width = 0, sector_size = 0, type = 0, uuid = "\264\306\377\034\tdBb\270\201\237\244\241", } ```

plexorama commented 6 years ago

Any ideas how to fix this bug? I ran into the same issue. It looks like I'm stuck with a 8TB btrfs volume in an umountable state. All super blocks are good but no rescue function helps. Running btrfs restore using a good block as tree root doesn't help either. Please help!

adam900710 commented 6 years ago

@plexorama Please don't hijack this bug report. If you need to fix your problem, please open another issue unless you're 100% sure that your backtrace is completely the same.

plexorama commented 6 years ago

@adam900710 "hijack" wtf? are you for real? I googled the for the string:

dev0chunk-recover.c:129: process_extent_buffer: BUG_ON exist->nmirrors >= BTRFS_MAX_MIRRORS triggered, value 1

and got a result with this issue.

Anyway, I couldn't fix the error. Tried different kernels, even the latest kernel & progs were of no help. The only way to recover my data was to write a tool from scratch.

btw, thanks for nothing.

ParzivalWolfram commented 1 year ago

Same issue.

# btrfs rescue chunk-recover /dev/sdc3
Scanning: 3264624197632 in dev0cmds/rescue-chunk-recover.c:127: process_extent_buffer: BUG_ON `exist->nmirrors >= BTRFS_MAX_MIRRORS` triggered, value 1
btrfs(+0x7470f)[0x55683f57270f]
btrfs(+0x74bf0)[0x55683f572bf0]
btrfs(+0x75a26)[0x55683f573a26]
/lib/x86_64-linux-gnu/libc.so.6(+0x88fd4)[0x7fe6f04d7fd4]
/lib/x86_64-linux-gnu/libc.so.6(+0x10966c)[0x7fe6f055866c]
Aborted

Any solution is appreciated, missing ~2.7TB of data due to a power outage while growing the partition.

4s1 commented 8 months ago

The only way to recover my data was to write a tool from scratch.

So you have a tool to recover a broken btrfs filesystem @plexorama? Mind sharing?

All3xJ commented 1 month ago

I have the same problem