Bug 1142486 - Error 'corrupted double-linked list' when using rescue super-recover on corrupt superblock
Summary: Error 'corrupted double-linked list' when using rescue super-recover on corru...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: btrfs-progs
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Josef Bacik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-16 21:14 UTC by Chris Murphy
Modified: 2015-12-02 16:17 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-12-02 03:51:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
coredump.tar.bz2 (51.13 KB, application/x-tar)
2014-09-16 21:39 UTC, Chris Murphy
no flags Details
gdb backtrace on coredump (5.77 KB, text/plain)
2014-09-16 21:45 UTC, Chris Murphy
no flags Details

Description Chris Murphy 2014-09-16 21:14:37 UTC
Description of problem: After zeroing superblock 0 csum, running btrfs rescue super-recover crashes.


Version-Release number of selected component (if applicable):
kernel-3.16.1-301.fc21.x86_64
btrfs-progs-3.16-1.fc21.x86_64

How reproducible:
Always


Steps to Reproduce:
1. # dd if=/dev/zero of=/dev/sdb bs=4 seek=16384 count=1
2. # btrfs rescue super-recover /dev/sdb -v
3. "Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y"


Actual results:

Reports "Recovered bad superblocks successful" then traceback.

*** Error in `btrfs': corrupted double-linked list: 0x0000000000b23e40 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7a77e)[0x7f05d52e277e]
/lib64/libc.so.6(+0x80b03)[0x7f05d52e8b03]
/lib64/libc.so.6(+0x81c88)[0x7f05d52e9c88]
/lib64/libc.so.6(cfree+0x4c)[0x7f05d52ee6ec]
btrfs[0x425ec6]
btrfs[0x406902]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7f05d52880e0]
btrfs[0x406a04]
======= Memory map: ========
00400000-0046b000 r-xp 00000000 08:03 136399110                          /usr/sbin/btrfs
0066a000-0066d000 r--p 0006a000 08:03 136399110                          /usr/sbin/btrfs
0066d000-0066e000 rw-p 0006d000 08:03 136399110                          /usr/sbin/btrfs
0066e000-00671000 rw-p 00000000 00:00 0 
00b23000-00b45000 rw-p 00000000 00:00 0                                  [heap]
7f05d5051000-7f05d5067000 r-xp 00000000 08:03 270295759                  /usr/lib64/libgcc_s-4.9.1-20140813.so.1
7f05d5067000-7f05d5266000 ---p 00016000 08:03 270295759                  /usr/lib64/libgcc_s-4.9.1-20140813.so.1
7f05d5266000-7f05d5267000 r--p 00015000 08:03 270295759                  /usr/lib64/libgcc_s-4.9.1-20140813.so.1
7f05d5267000-7f05d5268000 rw-p 00016000 08:03 270295759                  /usr/lib64/libgcc_s-4.9.1-20140813.so.1
7f05d5268000-7f05d5425000 r-xp 00000000 08:03 270069170                  /usr/lib64/libc-2.19.90.so
7f05d5425000-7f05d5625000 ---p 001bd000 08:03 270069170                  /usr/lib64/libc-2.19.90.so
7f05d5625000-7f05d5629000 r--p 001bd000 08:03 270069170                  /usr/lib64/libc-2.19.90.so
7f05d5629000-7f05d562b000 rw-p 001c1000 08:03 270069170                  /usr/lib64/libc-2.19.90.so
7f05d562b000-7f05d562f000 rw-p 00000000 00:00 0 
7f05d562f000-7f05d5647000 r-xp 00000000 08:03 271246379                  /usr/lib64/libpthread-2.19.90.so
7f05d5647000-7f05d5846000 ---p 00018000 08:03 271246379                  /usr/lib64/libpthread-2.19.90.so
7f05d5846000-7f05d5847000 r--p 00017000 08:03 271246379                  /usr/lib64/libpthread-2.19.90.so
7f05d5847000-7f05d5848000 rw-p 00018000 08:03 271246379                  /usr/lib64/libpthread-2.19.90.so
7f05d5848000-7f05d584c000 rw-p 00000000 00:00 0 
7f05d584c000-7f05d586d000 r-xp 00000000 08:03 270902273                  /usr/lib64/liblzo2.so.2.0.0
7f05d586d000-7f05d5a6c000 ---p 00021000 08:03 270902273                  /usr/lib64/liblzo2.so.2.0.0
7f05d5a6c000-7f05d5a6d000 r--p 00020000 08:03 270902273                  /usr/lib64/liblzo2.so.2.0.0
7f05d5a6d000-7f05d5a6e000 rw-p 00021000 08:03 270902273                  /usr/lib64/liblzo2.so.2.0.0
7f05d5a6e000-7f05d5a83000 r-xp 00000000 08:03 271667474                  /usr/lib64/libz.so.1.2.8
7f05d5a83000-7f05d5c82000 ---p 00015000 08:03 271667474                  /usr/lib64/libz.so.1.2.8
7f05d5c82000-7f05d5c83000 r--p 00014000 08:03 271667474                  /usr/lib64/libz.so.1.2.8
7f05d5c83000-7f05d5c84000 rw-p 00015000 08:03 271667474                  /usr/lib64/libz.so.1.2.8
7f05d5c84000-7f05d5d8b000 r-xp 00000000 08:03 270902274                  /usr/lib64/libm-2.19.90.so
7f05d5d8b000-7f05d5f8a000 ---p 00107000 08:03 270902274                  /usr/lib64/libm-2.19.90.so
7f05d5f8a000-7f05d5f8b000 r--p 00106000 08:03 270902274                  /usr/lib64/libm-2.19.90.so
7f05d5f8b000-7f05d5f8c000 rw-p 00107000 08:03 270902274                  /usr/lib64/libm-2.19.90.so
7f05d5f8c000-7f05d5fc7000 r-xp 00000000 08:03 270069155                  /usr/lib64/libblkid.so.1.1.0
7f05d5fc7000-7f05d61c7000 ---p 0003b000 08:03 270069155                  /usr/lib64/libblkid.so.1.1.0
7f05d61c7000-7f05d61ca000 r--p 0003b000 08:03 270069155                  /usr/lib64/libblkid.so.1.1.0
7f05d61ca000-7f05d61cb000 rw-p 0003e000 08:03 270069155                  /usr/lib64/libblkid.so.1.1.0
7f05d61cb000-7f05d61cc000 rw-p 00000000 00:00 0 
7f05d61cc000-7f05d61d0000 r-xp 00000000 08:03 271246592                  /usr/lib64/libuuid.so.1.3.0
7f05d61d0000-7f05d63cf000 ---p 00004000 08:03 271246592                  /usr/lib64/libuuid.so.1.3.0
7f05d63cf000-7f05d63d0000 r--p 00003000 08:03 271246592                  /usr/lib64/libuuid.so.1.3.0
7f05d63d0000-7f05d63d1000 rw-p 00004000 08:03 271246592                  /usr/lib64/libuuid.so.1.3.0
7f05d63d1000-7f05d63f5000 r-xp 00000000 08:03 269926478                  /usr/lib64/ld-2.19.90.so
7f05d65d8000-7f05d65dd000 rw-p 00000000 00:00 0 
7f05d65f0000-7f05d65f4000 rw-p 00000000 00:00 0 
7f05d65f4000-7f05d65f5000 r--p 00023000 08:03 269926478                  /usr/lib64/ld-2.19.90.so
7f05d65f5000-7f05d65f6000 rw-p 00024000 08:03 269926478                  /usr/lib64/ld-2.19.90.so
7f05d65f6000-7f05d65f7000 rw-p 00000000 00:00 0 
7fffa0176000-7fffa0197000 rw-p 00000000 00:00 0                          [stack]
7fffa01a3000-7fffa01a5000 r-xp 00000000 00:00 0                          [vdso]
7fffa01a5000-7fffa01a7000 r--p 00000000 00:00 0                          [vvar]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)




Expected results:

No crash.

Additional info:

Comment 1 Eric Sandeen 2014-09-16 21:24:32 UTC
Steps to Reproduce:
1. # dd if=/dev/zero of=/dev/sdb bs=4 seek=16384 count=1
2. # btrfs rescue super-recover /dev/sdb -v
3. "Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y"

Presumably /dev/sdb was a btrfs filesystem?  how big?

If this was using the fedora btrfs-progs rpm, attaching the core file would let us gather more info.

Comment 2 Chris Murphy 2014-09-16 21:39:19 UTC
Small, 8GB and empty.

Comment 3 Chris Murphy 2014-09-16 21:39:48 UTC
Created attachment 938244 [details]
coredump.tar.bz2

Comment 4 Chris Murphy 2014-09-16 21:45:45 UTC
Created attachment 938245 [details]
gdb backtrace on coredump

gdb --core=coredump
<gdb> backtrace

Comment 5 Eric Sandeen 2014-09-17 16:38:46 UTC
valgrind tells us what went wrong:

Make sure this is a btrfs disk otherwise the tool will destroy other fs, Are you sure? [y/N]: y
Recovered bad superblocks successful
==42039== Invalid read of size 8
==42039==    at 0x426BD9: btrfs_recover_superblocks (list.h:204)
==42039==    by 0x421C79: cmd_super_recover (cmds-rescue.c:148)
==42039==    by 0x40420A: handle_command_group (btrfs.c:145)
==42039==    by 0x421B54: cmd_rescue (cmds-rescue.c:162)
==42039==    by 0x404199: main (btrfs.c:247)
==42039==  Address 0x4c250b0 is 48 bytes inside a block of size 96 free'd
==42039==    at 0x4A063F0: free (vg_replace_malloc.c:446)
==42039==    by 0x43C77E: btrfs_close_devices (volumes.c:196)
==42039==    by 0x42F5D1: close_ctree (disk-io.c:1404)
==42039==    by 0x426A85: btrfs_recover_superblocks (super-recover.c:340)
==42039==    by 0x421C79: cmd_super_recover (cmds-rescue.c:148)
==42039==    by 0x40420A: handle_command_group (btrfs.c:145)
==42039==    by 0x421B54: cmd_rescue (cmds-rescue.c:162)
==42039==    by 0x404199: main (btrfs.c:247)
==42039== 
==42039== Invalid free() / delete / delete[] / realloc()
==42039==    at 0x4A063F0: free (vg_replace_malloc.c:446)
==42039==    by 0x426C22: btrfs_recover_superblocks (super-recover.c:101)
==42039==    by 0x421C79: cmd_super_recover (cmds-rescue.c:148)
==42039==    by 0x40420A: handle_command_group (btrfs.c:145)
==42039==    by 0x421B54: cmd_rescue (cmds-rescue.c:162)
==42039==    by 0x404199: main (btrfs.c:247)
==42039==  Address 0x4c25080 is 0 bytes inside a block of size 96 free'd
==42039==    at 0x4A063F0: free (vg_replace_malloc.c:446)
==42039==    by 0x43C77E: btrfs_close_devices (volumes.c:196)
==42039==    by 0x42F5D1: close_ctree (disk-io.c:1404)
==42039==    by 0x426A85: btrfs_recover_superblocks (super-recover.c:340)
==42039==    by 0x421C79: cmd_super_recover (cmds-rescue.c:148)
==42039==    by 0x40420A: handle_command_group (btrfs.c:145)
==42039==    by 0x421B54: cmd_rescue (cmds-rescue.c:162)
==42039==    by 0x404199: main (btrfs.c:247)
==42039== 
==42039== 
==42039== HEAP SUMMARY:
==42039==     in use at exit: 0 bytes in 0 blocks
==42039==   total heap usage: 72 allocs, 73 frees, 140,384 bytes allocated
==42039== 
==42039== All heap blocks were freed -- no leaks are possible
==42039== 
==42039== For counts of detected and suppressed errors, rerun with: -v
==42039== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 6 from 6)


it's freeing fs_devices twice:

        close_ctree(root); // <-- here
no_recover:
        recover_err_str(ret);
        free_recover_superblock(&recover); // <-- and here

Comment 6 Fedora End Of Life 2015-11-04 15:09:24 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-12-02 03:51:23 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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