Git Product home page Git Product logo

btrfs-progs's People

Contributors

adam900710 avatar adambuchbinder avatar asj avatar boryas avatar chrismason-xx avatar darkling avatar fdmanana avatar fougner avatar goldwynr avatar guaneryu avatar idryomov avatar jeffmahoney avatar josefbacik avatar jsoref avatar karelzak avatar kdave avatar kilobyte avatar knorrie avatar kreijack avatar lakshmipathi avatar lorddoskias avatar marcosps avatar morbidrsa avatar naota avatar osandov avatar rakeshpandit avatar realwakka avatar t-msn avatar ukernel avatar zhaoleidd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btrfs-progs's Issues

restore --symlinks --metadata works on symlinks targets

recovering a filesystem with symlinks pointing outside just erred out trying to chown a non-existent file rather than lchowning it.

it might be sufficient to set O_PATH in the if (restore_metadata) open call.

(sorry i can't test this right now while my big recovery is running, and lost the error msg when i restarted it)

<dev> ?== <devid> ?== <device>

In reading the file btrfs-device.asciidoc I noticed the parameter notation for the subcommands varies from command to command. For example:

add accepts one or more <dev>
remove accepts one or more <dev> or <devid>
ready accepts a single <device>

What is the difference between <dev>, <devid>, and <device>?

restore: "We seem to be looping" can get lost

when btrfs restore is run with output redirection (which i'd assume not to be uncommon due to the amount of output), the "We seem to be looping" message can get lost in the buffers. (the operator would be confused by the lack of progress, but not see any indication of a question being asked in the logs of stdout or stderr; i only found the issue because i straced the presumably hanging process).

a fflush(stdout) after the again: jump mark in cmds-restore.c should do the trick. it might be worth considering to write the messages (the question and the loop question) to stderr instead, which afaik should be unbuffered anyway.

xfstests generic/015 run failed

root@ubuntu ~/xfstests# ./check generic/015
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 ubuntu 4.12.0-rc6
MKFS_OPTIONS  -- /dev/sda2
MOUNT_OPTIONS -- /dev/sda2 /fs/scratch

generic/015     - output mismatch (see ~/xfstests/results//generic/015.out.bad)
    --- tests/generic/015.out    2017-05-31 18:15:23.000000000 +0800
    +++ ~/xfstests/results//generic/015.out.bad    2017-06-28 10:12:11.001630002 +0800
    @@ -4,4 +4,5 @@
     check free space:
     delete fill:
     check free space:
    -   !!! free space is in range
    +   !!! free space has value of 17348
    +free space is NOT in range 45591.48 .. 46512.52
    ...
    (Run 'diff -u tests/generic/015.out ~/xfstests/results//generic/015.out.bad'  to see the entire diff)
Ran: generic/015
Failures: generic/015
Failed 1 of 1 tests

I print _free to log and find after rm, the space do not free:

root@ubuntu ~/xfstests# cat log
/dev/sda2      btrfs       51200 16416     46052      27% /fs/scratch
46052
/dev/sda2      btrfs       51200 46144     17348      73% /fs/scratch
17348
/dev/sda2      btrfs       51200 46144     17348      73% /fs/scratch
17348

It makes me confused, and i am sure the file has removed and can not create size over 17348 file.
Is it a bug or something wrong with my host?

possible regression in opts parser

-p seems positional now.

btrfs send /foo -p /bar

throws "ERROR: unable to resolve -p"

version tested: 4.11
4.9.1 didn't have this problem

4.15 fails on musl

Error

mkfs/main.c: In function 'is_ssd':
mkfs/main.c:433:17: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'INT8_MAX'?
  char wholedisk[PATH_MAX];
                 ^~~~~~~~
                 INT8_MAX
mkfs/main.c:433:17: note: each undeclared identifier is reported only once for each function it appears in
    [CC]     mkfs/rootdir.o
make: *** [Makefile:282: mkfs/main.o] Error 1
make: *** Waiting for unfinished jobs....

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index ea65c6d..5a717f7 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 /* #include <sys/dir.h> included via androidcompat.h */
 #include <fcntl.h>
+#include <limits.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <uuid/uuid.h>
-- 
2.16.1

Feature request: "btrfs qgroup show" should show path

The btrfs qgroup show command should show path assigned to each qgroup. This little piece of information would significantly helped when managing snapshots.

Example:

# btrfs qgroup show /
qgroupid         rfer         excl   path
--------         ----         ----   -----
0/5          16.00KiB     16.00KiB   /
0/257         1.57TiB      1.57TiB   /home

Following script produces the desired output (not sure if correct, though):

#!/bin/sh
(btrfs subvolume list "$1" && btrfs qgroup show "$1") \
| awk '$1 == "ID" { p["0/"$2] = $9} $1 != "ID" { print $0 "  " p[$1] }'

I also found few scripts doing this and a lot of question how to achieve this, but I think this feature should be integrated in btrfs-progs.

[fuzz-tests] 001-simple-check-unmounted: memleak, heap buffer overflow, stack overflow, global buffer overflow

compiled with clang 4.0
CFLAGS: -g3 -O0 -Wall -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-optimize-sibling-calls -fsanitize=address,undefined
based on master branch / btrfs progs 4.10.1 / 15d37fe
run command (as root): UBSAN_OPTIONS=print_stacktrace=1 make test -k

fuzz-tests-results.txt

All kind of bad stuff happening here

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/001-simple-check-unmounted
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-1.raw.restored
ERROR: superblock checksum mismatch
ERROR: superblock checksum mismatch
No valid Btrfs found on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-1.raw.restored
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-1.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-2.raw.restored
ERROR: superblock checksum mismatch
ERROR: superblock checksum mismatch
No valid Btrfs found on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-2.raw.restored
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-2.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-3.raw.restored
ERROR: unsupported checksum algorithm 1
ERROR: unsupported checksum algorithm 1
No valid Btrfs found on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-3.raw.restored
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bad-superblock-3.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104131-fsck-oob-read.raw.restored
No valid Btrfs found on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104131-fsck-oob-read.raw.restored
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104131-fsck-oob-read.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104141-fsck-exception.raw.restored
No valid Btrfs found on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104141-fsck-exception.raw.restored
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-104141-fsck-exception.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-153641-unaligned-tree-block-bytenr.raw.restored
parent transid verify failed on 4198400 wanted 5 found 4127129605
parent transid verify failed on 4198400 wanted 5 found 4127129605
Ignoring transid failure
ERROR: tree block bytenr 134628 is not aligned to sectorsize 4096
Couldn't setup extent tree
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-153641-unaligned-tree-block-bytenr.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-154021-invalid-drop-level.raw.restored
ERROR: tree block bytenr 0 is not aligned to sectorsize 4096
Couldn't setup device tree
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-154021-invalid-drop-level.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-154961-heap-overflow-chunk-items.raw.restored
checking extents
Invalid key type(CHUNK_ITEM) found in root(ROOT_TREE)
ignoring invalid key
ref mismatch on [4235264 4096] extent item 1, found 0
Backref 4235264 root 18446744073709551607 not referenced back 0x603000000250
Incorrect global backref count on 4235264 found 1 wanted 0
backpointer mismatch on [4235264 4096]
owner ref check failed [4235264 4096]
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-154961-heap-overflow-chunk-items.raw.restored
UUID: e0d334b9-d48f-49f3-9c6b-45fc8e0ec0c7
found 28672 bytes used, no error found
total csum bytes: 0
total tree bytes: 24576
total fs tree bytes: 4096
total extent tree bytes: 4096
btree space waste bytes: 19892
file data blocks allocated: 0
 referenced 0
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155151-bad-block-group-offset.raw.restored
checking extents
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Block group[0, 0] (flags = 2) didn't find the relative chunk.
bad extent [131072, 135168), type mismatch with chunk
checking free space cache
checking fs roots
checking csums
checking root refs

=================================================================
==6891==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 144 byte(s) in 1 object(s) allocated from:
    #0 0x4ca703 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x579435 in btrfs_read_block_groups /home/matthias/vcs/github/btrfs-progs/extent-tree.c:3253:11
    #2 0x5412af in btrfs_setup_all_roots /home/matthias/vcs/github/btrfs-progs/disk-io.c:1084:3
    #3 0x547dce in __open_ctree_fd /home/matthias/vcs/github/btrfs-progs/disk-io.c:1347:8
    #4 0x546a96 in open_ctree_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:1393:9
    #5 0x78948c in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12805:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fb4721c5400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 144 byte(s) leaked in 1 allocation(s).
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155151-bad-block-group-offset.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155181-bad-backref.raw.restored
checking extents
ERROR: ignoring invalid extent, bytenr 131200 is not aligned to 4096
ref mismatch on [131072 4096] extent item 0, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155181-bad-backref.raw.restored
UUID: 5cb33553-6f6d-4ce8-83fd-20af5a2f8181
found 28672 bytes used, no error found
total csum bytes: 0
total tree bytes: 28672
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 23665
file data blocks allocated: 0
 referenced 0
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155181-unaligned-extent-item.raw.restored
checking extents
ERROR: ignoring invalid extent, bytenr 131200 is not aligned to 4096
ref mismatch on [131072 4096] extent item 0, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155181-unaligned-extent-item.raw.restored
UUID: 5cb33553-6f6d-4ce8-83fd-20af5a2f8181
found 28672 bytes used, no error found
total csum bytes: 0
total tree bytes: 28672
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 23665
file data blocks allocated: 0
 referenced 0
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155201-wrong-chunk-item-in-root-tree.raw.restored
checking extents
Invalid key type(CHUNK_ITEM) found in root(ROOT_TREE)
ignoring invalid key
ref mismatch on [4235264 4096] extent item 1, found 0
Backref 4235264 root 18446744073709551607 not referenced back 0x603000000250
Incorrect global backref count on 4235264 found 1 wanted 0
backpointer mismatch on [4235264 4096]
owner ref check failed [4235264 4096]
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155201-wrong-chunk-item-in-root-tree.raw.restored
UUID: 5cb33553-6f6d-4ce8-83fd-20af5a2f8181
found 28672 bytes used, no error found
total csum bytes: 0
total tree bytes: 24576
total fs tree bytes: 4096
total extent tree bytes: 4096
btree space waste bytes: 19892
file data blocks allocated: 0
 referenced 0
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155621-bad-block-group-offset.raw.restored
checking extents
corrupt extent record: key 131072 169 4096
corrupt extent record: key 4194304 169 4096
corrupt extent record: key 4198400 169 4096
corrupt extent record: key 4202496 169 4096
corrupt extent record: key 4227072 169 4096
corrupt extent record: key 4231168 169 4096
corrupt extent record: key 4235264 169 4096
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Chunk[256, 228, 4194304]: length(1638400), offset(4194304), type(5) mismatch with block group[4194304, 192, 1638400]: offset(1638400), objectid(4194304), flags(21474836480)
Chunk[256, 228, 5832704]: length(1638400), offset(5832704), type(5) mismatch with block group[5832704, 192, 1638400]: offset(1638400), objectid(5832704), flags(21474836480)
Block group[0, 0] (flags = 8589934592) didn't find the relative chunk.
Block group[4194304, 1638400] (flags = 21474836480) didn't find the relative chunk.
Block group[5832704, 1638400] (flags = 21474836480) didn't find the relative chunk.
ref mismatch on [131072 4096] extent item 4294967296, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
ref mismatch on [4194304 4096] extent item 4294967296, found 1
Backref 4194304 parent 5 root 5 not found in extent tree
backpointer mismatch on [4194304 4096]
ref mismatch on [4198400 4096] extent item 4294967296, found 1
Backref 4198400 parent 1 root 1 not found in extent tree
backpointer mismatch on [4198400 4096]
ref mismatch on [4202496 4096] extent item 4294967296, found 1
Backref 4202496 parent 2 root 2 not found in extent tree
backpointer mismatch on [4202496 4096]
ref mismatch on [4227072 4096] extent item 4294967296, found 1
Backref 4227072 parent 4 root 4 not found in extent tree
backpointer mismatch on [4227072 4096]
ref mismatch on [4231168 4096] extent item 8589934591, found 1
Backref 4231168 parent 7 root 7 not found in extent tree
backpointer mismatch on [4231168 4096]
ref mismatch on [4235264 4096] extent item 4294967296, found 0
owner ref check failed [4235264 4096]
checking free space cache
checking fs roots
checking csums
checking root refs

=================================================================
==6928==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 144 byte(s) in 1 object(s) allocated from:
    #0 0x4ca703 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x579435 in btrfs_read_block_groups /home/matthias/vcs/github/btrfs-progs/extent-tree.c:3253:11
    #2 0x5412af in btrfs_setup_all_roots /home/matthias/vcs/github/btrfs-progs/disk-io.c:1084:3
    #3 0x547dce in __open_ctree_fd /home/matthias/vcs/github/btrfs-progs/disk-io.c:1347:8
    #4 0x546a96 in open_ctree_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:1393:9
    #5 0x78948c in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12805:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa1fed3c400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 144 byte(s) leaked in 1 allocation(s).
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-155621-bad-block-group-offset.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156471-ubsan-trigger-crc32c-unaligned.raw.restored
fsid mismatch, want=b70e656c-6461-404b-a50d-0fba330c7527, have=30303030-3030-3030-3030-303030303030
Couldn't read tree root
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156471-ubsan-trigger-crc32c-unaligned.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156731.raw.restored
checking extents
=================================================================
==6947==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000008980 at pc 0x0000007c354f bp 0x7ffc8c452cd0 sp 0x7ffc8c452cc8
READ of size 4 at 0x621000008980 thread T0
    #0 0x7c354e in btrfs_extent_data_ref_count /home/matthias/vcs/github/btrfs-progs/ctree.h:1728:1
    #1 0x7d759d in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7778:6
    #2 0x7c995b in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9751:10
    #3 0x7954e8 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9918:8
    #4 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #5 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #6 0x7fe985d8f400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #7 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

0x621000008980 is located 0 bytes to the right of 4224-byte region [0x621000007900,0x621000008980)
allocated by thread T0 here:
    #0 0x4ca703 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x5f06d0 in __alloc_extent_buffer /home/matthias/vcs/github/btrfs-progs/extent_io.c:538:7
    #2 0x5f2225 in alloc_extent_buffer /home/matthias/vcs/github/btrfs-progs/extent_io.c:642:8
    #3 0x52bbfc in btrfs_find_create_tree_block /home/matthias/vcs/github/btrfs-progs/disk-io.c:193:9
    #4 0x52e7f6 in read_tree_block_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:340:7
    #5 0x53a594 in read_tree_block /home/matthias/vcs/github/btrfs-progs/disk-io.h:125:9
    #6 0x53a0d4 in find_and_setup_root /home/matthias/vcs/github/btrfs-progs/disk-io.c:644:15
    #7 0x54230f in setup_root_or_create_block /home/matthias/vcs/github/btrfs-progs/disk-io.c:973:8
    #8 0x53fe38 in btrfs_setup_all_roots /home/matthias/vcs/github/btrfs-progs/disk-io.c:1038:8
    #9 0x547dce in __open_ctree_fd /home/matthias/vcs/github/btrfs-progs/disk-io.c:1347:8
    #10 0x546a96 in open_ctree_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:1393:9
    #11 0x78948c in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12805:9
    #12 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #13 0x7fe985d8f400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/matthias/vcs/github/btrfs-progs/ctree.h:1728:1 in btrfs_extent_data_ref_count
Shadow bytes around the buggy address:
  0x0c427fff90e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff90f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff9130:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==6947==ABORTING
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156731.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156741.raw.restored
parent transid verify failed on 1122304 wanted 3472328296227680304 found 1
parent transid verify failed on 1122304 wanted 3472328296227680304 found 1
Ignoring transid failure
checking extents
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Chunk[256, 228, 4194304]: length(1638400), offset(4194304), type(5) is not found in block group
Chunk[256, 228, 5832704]: length(1638400), offset(5832704), type(5) is not found in block group
ref mismatch on [131072 4096] extent item 0, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
ref mismatch on [1118208 4096] extent item 1, found 0
Backref 1118208 root 1 not referenced back 0x6030000001f0
Incorrect global backref count on 1118208 found 1 wanted 0
backpointer mismatch on [1118208 4096]
owner ref check failed [1118208 4096]
ref mismatch on [1126400 4096] extent item 1, found 0
Backref 1126400 root 3 not referenced back 0x603000000220
Incorrect global backref count on 1126400 found 1 wanted 0
backpointer mismatch on [1126400 4096]
owner ref check failed [1126400 4096]
ref mismatch on [1130496 4096] extent item 1, found 0
Backref 1130496 root 4 not referenced back 0x603000000250
Incorrect global backref count on 1130496 found 1 wanted 0
backpointer mismatch on [1130496 4096]
owner ref check failed [1130496 4096]
ref mismatch on [1134592 4096] extent item 1, found 0
Backref 1134592 root 5 not referenced back 0x603000000280
Incorrect global backref count on 1134592 found 1 wanted 0
backpointer mismatch on [1134592 4096]
owner ref check failed [1134592 4096]
ref mismatch on [1138688 4096] extent item 1, found 0
Backref 1138688 root 7 not referenced back 0x6030000002b0
Incorrect global backref count on 1138688 found 1 wanted 0
backpointer mismatch on [1138688 4096]
owner ref check failed [1138688 4096]
ref mismatch on [4194304 4096] extent item 0, found 1
Backref 4194304 parent 5 root 5 not found in extent tree
backpointer mismatch on [4194304 4096]
ref mismatch on [4198400 4096] extent item 0, found 1
Backref 4198400 parent 1 root 1 not found in extent tree
backpointer mismatch on [4198400 4096]
ref mismatch on [4227072 4096] extent item 0, found 1
Backref 4227072 parent 4 root 4 not found in extent tree
backpointer mismatch on [4227072 4096]
ref mismatch on [4231168 4096] extent item 0, found 1
Backref 4231168 parent 7 root 7 not found in extent tree
backpointer mismatch on [4231168 4096]
ref mismatch on [3472328296227680304 3472328296227680304] extent item 0, found 1
Backref 3472328296227680304 root 1 owner 6 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 3472328296227680304 root 1 owner 6 offset 0 found 1 wanted 0 back 0x607000000330
backpointer mismatch on [3472328296227680304 3472328296227680304]
=================================================================
==6956==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000008980 at pc 0x0000007b4e49 bp 0x7ffc2b5e9160 sp 0x7ffc2b5e9158
READ of size 1 at 0x621000008980 thread T0
    #0 0x7b4e48 in btrfs_extent_inline_ref_type /home/matthias/vcs/github/btrfs-progs/ctree.h:1734:1
    #1 0x813355 in build_roots_info_cache /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12344:10
    #2 0x7966eb in repair_root_items /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12488:8
    #3 0x78b188 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12967:8
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f2d48084400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #6 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

0x621000008980 is located 0 bytes to the right of 4224-byte region [0x621000007900,0x621000008980)
allocated by thread T0 here:
    #0 0x4ca703 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x5f06d0 in __alloc_extent_buffer /home/matthias/vcs/github/btrfs-progs/extent_io.c:538:7
    #2 0x5f2225 in alloc_extent_buffer /home/matthias/vcs/github/btrfs-progs/extent_io.c:642:8
    #3 0x52bbfc in btrfs_find_create_tree_block /home/matthias/vcs/github/btrfs-progs/disk-io.c:193:9
    #4 0x52e7f6 in read_tree_block_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:340:7
    #5 0x53a594 in read_tree_block /home/matthias/vcs/github/btrfs-progs/disk-io.h:125:9
    #6 0x53a0d4 in find_and_setup_root /home/matthias/vcs/github/btrfs-progs/disk-io.c:644:15
    #7 0x54230f in setup_root_or_create_block /home/matthias/vcs/github/btrfs-progs/disk-io.c:973:8
    #8 0x53fe38 in btrfs_setup_all_roots /home/matthias/vcs/github/btrfs-progs/disk-io.c:1038:8
    #9 0x547dce in __open_ctree_fd /home/matthias/vcs/github/btrfs-progs/disk-io.c:1347:8
    #10 0x546a96 in open_ctree_fs_info /home/matthias/vcs/github/btrfs-progs/disk-io.c:1393:9
    #11 0x78948c in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12805:9
    #12 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #13 0x7f2d48084400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/matthias/vcs/github/btrfs-progs/ctree.h:1734:1 in btrfs_extent_inline_ref_type
Shadow bytes around the buggy address:
  0x0c427fff90e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff90f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff9120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff9130:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff9180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==6956==ABORTING
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156741.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156811-bad-parent-ref-qgroup-verify.raw.restored
checking extents
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Chunk[256, 228, 0] stripe[1, 0] is not found in dev extent
Chunk[256, 228, 4194304]: length(1638400), offset(4194304), type(5) is not found in block group
Chunk[256, 228, 4194304] stripe[1, 4194304] is not found in dev extent
Chunk[256, 228, 5832704]: length(1638400), offset(5832704), type(5) is not found in block group
Chunk[256, 228, 5832704] stripe[1, 5832704] is not found in dev extent
ref mismatch on [131072 4096] extent item 0, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
ref mismatch on [4194304 4096] extent item 0, found 1
Backref 4194304 parent 5 root 5 not found in extent tree
backpointer mismatch on [4194304 4096]
ref mismatch on [4198400 4096] extent item 0, found 1
Backref 4198400 parent 1 root 1 not found in extent tree
backpointer mismatch on [4198400 4096]
ref mismatch on [4231168 4096] extent item 0, found 1
Backref 4231168 parent 7 root 7 not found in extent tree
backpointer mismatch on [4231168 4096]
ref mismatch on [3472328296227680304 3472328296227680304] extent item 0, found 1
Backref 3472328296227680304 root 1 owner 2 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 3472328296227680304 root 1 owner 2 offset 0 found 1 wanted 0 back 0x607000000250
backpointer mismatch on [3472328296227680304 3472328296227680304]
Dev extent's total-byte(0) is not equal to byte-used(7471104) in dev[1, 216, 1]
ERROR: errors found in extent allocation tree or chunk allocation
checking free space cache
checking fs roots
checking csums
checking root refs
checking quota groups
ERROR: bytenr ref not found for parent 13310591802206107832
ERROR: Out of memory while accounting refs for qgroups
ERROR: failed to check quota groups

=================================================================
==6965==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x4ca51c in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x686759 in ulist_alloc /home/matthias/vcs/github/btrfs-progs/kernel-shared/ulist.c:94:24
    #2 0x68e70b in account_all_refs /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:520:24
    #3 0x68bbaf in qgroup_verify_all /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:1396:8
    #4 0x78c1f2 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13069:9
    #5 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #6 0x7f8716894400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-156811-bad-parent-ref-qgroup-verify.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-161811.raw.restored
checking extents
bad full backref, on [4198400]
checking free space cache
checking fs roots
cmds-check.c:655:9: runtime error: index 15 out of bounds for type 'unsigned char [15]'
    #0 0x8262e8 in imode_to_type /home/matthias/vcs/github/btrfs-progs/cmds-check.c:655:9
    #1 0x849fae in maybe_free_inode_rec /home/matthias/vcs/github/btrfs-progs/cmds-check.c:964:13
    #2 0x86328a in process_inode_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1055:2
    #3 0x855b7b in process_one_leaf /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1847:10
    #4 0x842d8c in walk_down_tree /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2134:10
    #5 0x83d300 in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3957:10
    #6 0x79b3fb in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4098:10
    #7 0x78b850 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13015:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f24560cb400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #10 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior cmds-check.c:655:9 in 
=================================================================
==6975==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000afbaaf at pc 0x00000082637f bp 0x7ffedf9eeed0 sp 0x7ffedf9eeec8
READ of size 1 at 0x000000afbaaf thread T0
    #0 0x82637e in imode_to_type /home/matthias/vcs/github/btrfs-progs/cmds-check.c:655:9
    #1 0x849fae in maybe_free_inode_rec /home/matthias/vcs/github/btrfs-progs/cmds-check.c:964:13
    #2 0x86328a in process_inode_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1055:2
    #3 0x855b7b in process_one_leaf /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1847:10
    #4 0x842d8c in walk_down_tree /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2134:10
    #5 0x83d300 in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3957:10
    #6 0x79b3fb in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4098:10
    #7 0x78b850 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13015:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f24560cb400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #10 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

0x000000afbaaf is located 0 bytes to the right of global variable 'btrfs_type_by_mode' defined in 'cmds-check.c:645:23' (0xafbaa0) of size 15
SUMMARY: AddressSanitizer: global-buffer-overflow /home/matthias/vcs/github/btrfs-progs/cmds-check.c:655:9 in imode_to_type
Shadow bytes around the buggy address:
  0x000080157700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x000080157750: 00 00 00 00 00[07]f9 f9 f9 f9 f9 f9 00 00 00 00
  0x000080157760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157770: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080157790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0000801577a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==6975==ABORTING
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-161811.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-161821.raw.restored
checking extents
parent transid verify failed on 4198400 wanted 14 found 1114126
parent transid verify failed on 4198400 wanted 14 found 1114126
Ignoring transid failure
/home/matthias/vcs/github/btrfs-progs/extent_io.h:105:6: runtime error: member access within null pointer of type 'struct extent_buffer'
    #0 0x50021a in extent_buffer_get /home/matthias/vcs/github/btrfs-progs/extent_io.h:105:6
    #1 0x5077a8 in btrfs_search_slot /home/matthias/vcs/github/btrfs-progs/ctree.c:1115:2
    #2 0x7eef68 in check_owner_ref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5468:8
    #3 0x7e5cc5 in check_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5845:10
    #4 0x7d630a in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7690:8
    #5 0x7c995b in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9751:10
    #6 0x7954e8 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9918:8
    #7 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f0fa9193400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #10 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/extent_io.h:105:6 in 
ASAN:DEADLYSIGNAL
=================================================================
==6984==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000070 (pc 0x000000500266 bp 0x7ffe1ba2e950 sp 0x7ffe1ba2e920 T0)
==6984==The signal is caused by a READ memory access.
==6984==Hint: address points to the zero page.
    #0 0x500265 in extent_buffer_get /home/matthias/vcs/github/btrfs-progs/extent_io.h:105:10
    #1 0x5077a8 in btrfs_search_slot /home/matthias/vcs/github/btrfs-progs/ctree.c:1115:2
    #2 0x7eef68 in check_owner_ref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5468:8
    #3 0x7e5cc5 in check_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5845:10
    #4 0x7d630a in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7690:8
    #5 0x7c995b in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9751:10
    #6 0x7954e8 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9918:8
    #7 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f0fa9193400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #10 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/matthias/vcs/github/btrfs-progs/extent_io.h:105:10 in extent_buffer_get
==6984==ABORTING
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-161821.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-166361-blocksize-zero.raw.restored
parent transid verify failed on 4198400 wanted 4 found 5
Ignoring transid failure
ERROR: tree block bytenr 0 is not aligned to sectorsize 4096
ERROR: tree block bytenr 0 is not aligned to sectorsize 4096
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-166361-blocksize-zero.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167551.raw.restored
ERROR: tree block bytenr 0 is not aligned to sectorsize 4096
Couldn't setup device tree
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167551.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167781.raw.restored
checking extents
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) is not found in block group
Chunk[256, 228, 0] stripe[1, 0] is not found in dev extent
Chunk[256, 228, 4194304]: length(1638400), offset(4194304), type(5) is not found in block group
Chunk[256, 228, 4194304] stripe[1, 4194304] is not found in dev extent
Chunk[256, 228, 5832704]: length(1638400), offset(5832704), type(5) is not found in block group
Chunk[256, 228, 5832704] stripe[1, 5832704] is not found in dev extent
ref mismatch on [131072 4096] extent item 0, found 1
Backref 131072 parent 3 root 3 not found in extent tree
backpointer mismatch on [131072 4096]
bad extent [131072, 135168), type mismatch with chunk
ref mismatch on [4194304 4096] extent item 0, found 1
Backref 4194304 parent 5 root 5 not found in extent tree
backpointer mismatch on [4194304 4096]
ref mismatch on [4198400 4096] extent item 0, found 1
Backref 4198400 parent 1 root 1 not found in extent tree
backpointer mismatch on [4198400 4096]
ref mismatch on [4231168 4096] extent item 0, found 1
Backref 4231168 parent 7 root 7 not found in extent tree
backpointer mismatch on [4231168 4096]
ref mismatch on [3472328296227680304 3472328296227680304] extent item 0, found 1
Backref 3472328296227680304 root 1 owner 2 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 3472328296227680304 root 1 owner 2 offset 0 found 1 wanted 0 back 0x607000000250
backpointer mismatch on [3472328296227680304 3472328296227680304]
Dev extent's total-byte(0) is not equal to byte-used(7471104) in dev[1, 216, 1]
ERROR: errors found in extent allocation tree or chunk allocation
checking free space cache
checking fs roots
checking csums
checking root refs
checking quota groups
ASAN:DEADLYSIGNAL
=================================================================
==7011==ERROR: AddressSanitizer: stack-overflow on address 0x7ffcf8dbbff8 (pc 0x000000958d5b bp 0x7ffcf8dbc080 sp 0x7ffcf8dbbff0 T0)
    #0 0x958d5a in rb_prev /home/matthias/vcs/github/btrfs-progs/kernel-lib/rbtree.c:490:55
    #1 0x69a2f6 in find_ref_bytenr /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:253:32
    #2 0x699865 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:580:20
    #3 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #4 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #5 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #6 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #7 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #8 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #9 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #10 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #11 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #12 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #13 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #14 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #15 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #16 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #17 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #18 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #19 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #20 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #21 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #22 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #23 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #24 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #25 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #26 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #27 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #28 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #29 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #30 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #31 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #32 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #33 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #34 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #35 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #36 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #37 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #38 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #39 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #40 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #41 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #42 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #43 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #44 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #45 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #46 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #47 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #48 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #49 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #50 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #51 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #52 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #53 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #54 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #55 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #56 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #57 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #58 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #59 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #60 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #61 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #62 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #63 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #64 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #65 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #66 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #67 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #68 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #69 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #70 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #71 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #72 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #73 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #74 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #75 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #76 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #77 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #78 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #79 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #80 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #81 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #82 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #83 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #84 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #85 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #86 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #87 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #88 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #89 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #90 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #91 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #92 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #93 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #94 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #95 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #96 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #97 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #98 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #99 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #100 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #101 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #102 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #103 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #104 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #105 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #106 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #107 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #108 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #109 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #110 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #111 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #112 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #113 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #114 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #115 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #116 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #117 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #118 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #119 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #120 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #121 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #122 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #123 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #124 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #125 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #126 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #127 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #128 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #129 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #130 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #131 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #132 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #133 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #134 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #135 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #136 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #137 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #138 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #139 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #140 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #141 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #142 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #143 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #144 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #145 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #146 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #147 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #148 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #149 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #150 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #151 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #152 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #153 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #154 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #155 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #156 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #157 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #158 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #159 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #160 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #161 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #162 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #163 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #164 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #165 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #166 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #167 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #168 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #169 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #170 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #171 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #172 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #173 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #174 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #175 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #176 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #177 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #178 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #179 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #180 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #181 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #182 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #183 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #184 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #185 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #186 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #187 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #188 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #189 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #190 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #191 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #192 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #193 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #194 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #195 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #196 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #197 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #198 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #199 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #200 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #201 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #202 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #203 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #204 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #205 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #206 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #207 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #208 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #209 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #210 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #211 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #212 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #213 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #214 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #215 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #216 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #217 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #218 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #219 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #220 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #221 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #222 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #223 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #224 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #225 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #226 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #227 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #228 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #229 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #230 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #231 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #232 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #233 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #234 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #235 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #236 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #237 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #238 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #239 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #240 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #241 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #242 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #243 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #244 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #245 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #246 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #247 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #248 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9
    #249 0x699bf3 in resolve_one_root /home/matthias/vcs/github/btrfs-progs/qgroup-verify.c:588:9

SUMMARY: AddressSanitizer: stack-overflow /home/matthias/vcs/github/btrfs-progs/kernel-lib/rbtree.c:490:55 in rb_prev
==7011==ABORTING
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167781.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167921.raw.restored
ERROR: tree block bytenr 0 is not aligned to sectorsize 4096
Couldn't setup device tree
ERROR: cannot open file system
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-167921.raw.restored
############### /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-168301.raw.restored
checking extents
Checking filesystem on /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-168301.raw.restored
UUID: 056b0872-c0a7-4121-8ac9-2263ffbee306
failed (ignored, ret=134): /home/matthias/vcs/github/btrfs-progs/btrfs check /home/matthias/vcs/github/btrfs-progs/tests/fuzz-tests/images/bko-168301.raw.restored
mayfail: returned code 134 (SIGABRT), not ignored
test failed for case 001-simple-check-unmounted

debugfs-like Tool

An enhancement I'd like to see is a tool that behaves similar to debugfs.

I'm unable to run a repair on my 4TB drive due to btrfs-check's memory usage which floods the memory for my system until it isn't usable.
Currently lowmem doesn't do repairs, but even then it isn't a guarantee repair would be able to handle this particular case which I think debugfs might be able to help.

My issue stems from a crash that resulted in a file existing, yet not existing:

ERROR: root 5 DIR_INDEX[3872258 15251] couldn't find relative INODE_ITEM[4193839] namelen 24 filename <fileName0> filetype 1
ERROR: root 5 INODE REF[4193844 3872258] doesn't have related DIR_INDEX[3872258 15256] namelen 24 filename <fileName1> filetype 1
ERROR: errors found in fs roots

"$ ls -l" for the file says it doesn't exist, and "$ ls -l" for the directory containing the file, lists the file but has "???" in the fields except for name.

It is my thought that with a debugfs-like tool, I would be able to manually delete the offending inode.

I thought maybe btrfs inspect-internal might provide such functions (even though "inspect" leads one to believe it is only informative), like inode-resolve or logical-resolve, but these appear to only have an informative use.

Error on converting ext4 image with xattrs

This error occurs on some special images only. I get this image by flash a sparse image onto the device and the dump the raw partition back. The image is here:
https://github.com/panruochen/bad-ext4-sample/archive/master.zip

I add debug logs and find that the converter tries to copy an inode whose number is 8193.
But from dumpe2fs information inode 8193 is free.

Looking into source code, it seems that ext2fs_get_next_inode returns both valid and invalid inode numbers and ext2_copy_inodes does not not check if the inode number is valid or not.

To make the convert work, I add the following patch.
Does it make sense?
1.zip

Initialism "VFS" never defined

In the file btrfs-device.asciidoc in the section about the "remove" subcommand there appears this message:

It is not possible to delete the device that was used to mount the filesystem. This is a limitation given by the VFS.

The initialism, "VFS", is not used anywhere else in the document nor is its meaning defined. This section of the document was written by @kdave.

[fsck-test] 001-bad-file-extent-bytenr: memory leak

compiled with clang 4.0
CFLAGS: -g3 -O0 -Wall -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-optimize-sibling-calls -fsanitize=address,undefined
based on master branch / btrfs progs 4.10.1 / 15d37fe
run command (as root): UBSAN_OPTIONS=print_stacktrace=1 make test -k

fsck-tests-results.txt

Test showed a memory leak

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/001-bad-file-extent-bytenr
restoring image default_case.img
testing image default_case.img.restored
checking extents
ref mismatch on [12845056 1048576] extent item 1, found 0
Incorrect local backref count on 12845056 root 5 owner 257 offset 0 found 0 wanted 1 back 0x607000000480
Backref disk bytenr does not match extent record, bytenr=12845056, ref bytenr=13744632839234567870
backpointer mismatch on [12845056 1048576]
owner ref check failed [12845056 1048576]
ref mismatch on [755944791 1048576] extent item 0, found 1
Backref 755944791 root 5 owner 257 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 755944791 root 5 owner 257 offset 0 found 1 wanted 0 back 0x6070000004f0
backpointer mismatch on [755944791 1048576]
bad extent [755944791, 756993367), type mismatch with chunk
checking free space cache
checking fs roots
root 5 inode 257 errors 1000, some csum missing
ERROR: errors found in fs roots
Checking filesystem on ./default_case.img.restored
UUID: 17442351-31aa-45fa-9503-90fd48874c3e
cache and super generation don't match, space cache will be invalidated
found 2392064 bytes used, error(s) found
total csum bytes: 1024
total tree bytes: 32768
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 24211
file data blocks allocated: 1310720
 referenced 1310720
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
checking extents
ref mismatch on [12845056 1048576] extent item 1, found 0
Incorrect local backref count on 12845056 root 5 owner 257 offset 0 found 0 wanted 1 back 0x607000000480
Backref disk bytenr does not match extent record, bytenr=12845056, ref bytenr=13744632839234567870
backpointer mismatch on [12845056 1048576]
owner ref check failed [12845056 1048576]
attempting to repair backref discrepency for bytenr 12845056
Fixed 0 roots.
checking free space cache
checking fs roots
checking csums
checking root refs
enabling repair mode
Checking filesystem on ./default_case.img.restored
UUID: 17442351-31aa-45fa-9503-90fd48874c3e
cache and super generation don't match, space cache will be invalidated
found 3735552 bytes used, no error found
total csum bytes: 2048
total tree bytes: 65536
total fs tree bytes: 16384
total extent tree bytes: 8192
btree space waste bytes: 48422
file data blocks allocated: 2621440
 referenced 2621440
############### /home/matthias/vcs/github/btrfs-progs/btrfs check ./default_case.img.restored
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on ./default_case.img.restored
UUID: 17442351-31aa-45fa-9503-90fd48874c3e
cache and super generation don't match, space cache will be invalidated
found 1343488 bytes used, no error found
total csum bytes: 1024
total tree bytes: 32768
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 24211
file data blocks allocated: 1310720
 referenced 1310720
=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/002-bad-transid
restoring image default_case.img
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
Ignoring transid failure
testing image default_case.img.restored
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
Ignoring transid failure
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
ERROR: transid errors in file system
Checking filesystem on ./default_case.img.restored
UUID: e0da4603-3bc7-4678-8e1d-d4913cff33e3
cache and super generation don't match, space cache will be invalidated
found 1343488 bytes used, error(s) found
total csum bytes: 1024
total tree bytes: 32768
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 24211
file data blocks allocated: 1310720
 referenced 1310720
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
parent transid verify failed on 29360128 wanted 9 found 755944791
Ignoring transid failure
checking extents
Fixed 0 roots.
checking free space cache
checking fs roots
checking csums
checking root refs
extent buffer leak: start 29360128 len 4096
enabling repair mode
Checking filesystem on ./default_case.img.restored
UUID: e0da4603-3bc7-4678-8e1d-d4913cff33e3
cache and super generation don't match, space cache will be invalidated
Recowing metadata block 29360128
found 1343488 bytes used, no error found
total csum bytes: 1024
total tree bytes: 32768
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 24211
file data blocks allocated: 1310720
 referenced 1310720
############### /home/matthias/vcs/github/btrfs-progs/btrfs check ./default_case.img.restored
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on ./default_case.img.restored
UUID: e0da4603-3bc7-4678-8e1d-d4913cff33e3
cache and super generation don't match, space cache will be invalidated
found 1343488 bytes used, no error found
total csum bytes: 1024
total tree bytes: 32768
total fs tree bytes: 8192
total extent tree bytes: 4096
btree space waste bytes: 24211
file data blocks allocated: 1310720
 referenced 1310720
=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/003-shift-offsets
restoring image default_case.img
testing image default_case.img.restored
checking extents
incorrect offsets 15018 9387
bad block 29360128
ERROR: errors found in extent allocation tree or chunk allocation
checking free space cache
checking fs roots
incorrect offsets 15018 9387
ERROR: errors found in fs roots

=================================================================
==26624==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 768 byte(s) in 4 object(s) allocated from:
    #0 0x4ca51c in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x7df0b1 in add_extent_rec_nolookup /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6032:8
    #2 0x7dd409 in add_extent_rec /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6174:8
    #3 0x7e7c7b in process_extent_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6818:2
    #4 0x7d658f in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7710:5
    #5 0x7c995b in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9751:10
    #6 0x7954e8 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9918:8
    #7 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f697628a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Indirect leak of 216 byte(s) in 3 object(s) allocated from:
    #0 0x4ca51c in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x7c8349 in add_root_item_to_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9683:11
    #2 0x794efc in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9886:11
    #3 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f697628a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Indirect leak of 128 byte(s) in 4 object(s) allocated from:
    #0 0x4ca51c in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x7e1f05 in alloc_tree_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5886:29
    #2 0x7ddb48 in add_tree_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6216:10
    #3 0x7e7f8b in process_extent_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6832:10
    #4 0x7d658f in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7710:5
    #5 0x7c995b in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9751:10
    #6 0x7954e8 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9918:8
    #7 0x78b12d in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12961:9
    #8 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #9 0x7f697628a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 1112 byte(s) leaked in 11 allocation(s).
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
checking extents
incorrect offsets 15018 9387
Fixed 0 roots.
checking free space cache
checking fs roots
checking csums
checking root refs
enabling repair mode
Checking filesystem on ./default_case.img.restored
UUID: 96ab8688-d6d5-44b0-849e-63720c2c79db
Shifting item nr 28 by 5631 bytes in block 29376512
Shifting item nr 29 by 5631 bytes in block 29376512
Shifting item nr 30 by 5631 bytes in block 29376512
Shifting item nr 31 by 5631 bytes in block 29376512
Shifting item nr 32 by 5631 bytes in block 29376512
Shifting item nr 33 by 5631 bytes in block 29376512
Shifting item nr 34 by 5631 bytes in block 29376512
Shifting item nr 35 by 5631 bytes in block 29376512
Shifting item nr 36 by 5631 bytes in block 29376512
Shifting item nr 37 by 5631 bytes in block 29376512
Shifting item nr 38 by 5631 bytes in block 29376512
Shifting item nr 39 by 5631 bytes in block 29376512
Shifting item nr 40 by 5631 bytes in block 29376512
Shifting item nr 41 by 5631 bytes in block 29376512
Shifting item nr 42 by 5631 bytes in block 29376512
Shifting item nr 43 by 5631 bytes in block 29376512
Shifting item nr 44 by 5631 bytes in block 29376512
Shifting item nr 45 by 5631 bytes in block 29376512
Shifting item nr 46 by 5631 bytes in block 29376512
Shifting item nr 47 by 5631 bytes in block 29376512
Shifting item nr 48 by 5631 bytes in block 29376512
Shifting item nr 49 by 5631 bytes in block 29376512
Shifting item nr 50 by 5631 bytes in block 29376512
Shifting item nr 51 by 5631 bytes in block 29376512
Shifting item nr 52 by 5631 bytes in block 29376512
Shifting item nr 53 by 5631 bytes in block 29376512
Shifting item nr 54 by 5631 bytes in block 29376512
Shifting item nr 55 by 5631 bytes in block 29376512
Shifting item nr 56 by 5631 bytes in block 29376512
cache and super generation don't match, space cache will be invalidated
found 786432 bytes used, no error found
total csum bytes: 0
total tree bytes: 196608
total fs tree bytes: 32768
total extent tree bytes: 32768
btree space waste bytes: 178837
file data blocks allocated: 524288
 referenced 524288
############### /home/matthias/vcs/github/btrfs-progs/btrfs check ./default_case.img.restored
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on ./default_case.img.restored
UUID: 96ab8688-d6d5-44b0-849e-63720c2c79db
cache and super generation don't match, space cache will be invalidated
found 393216 bytes used, no error found
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 119363
file data blocks allocated: 262144
 referenced 262144

Add reiserfs support to btrfs-convert

There are patches to support reiserfs for convert, but that was for the "old" way of conversion. The patches do not apply to the reworked convert.
Adding new filesystems should be easier now, the convert/ directory is split and common code factored out. What's missing:

  • add support to configure
  • port the old code to new set of convert callbacks
  • extend convert tests

btrfs subvolume list shows a "TOPLEVEL" subvolume after removing it

After removing a subvolume, running "btrfs subvolume list" shows a new entry "ID 257 gen 12 top level 0 path TOPLEVEL".

# btrfs subvolume list /mnt/test

# btrfs subvolume create /mnt/test/a
Create subvolume '/mnt/test/a'

# btrfs subvolume list /mnt/test
ID 257 gen 12 top level 5 path a

# btrfs subvolume delete -c /mnt/test/a
Delete subvolume (commit): '/mnt/test/a'

# btrfs subvolume list /mnt/test
ID 257 gen 12 top level 0 path TOPLEVEL

This entry disappears after ~10 seconds.

# btrfs --version
btrfs-progs v4.13.2

# uname -r
4.13.0-0.rc5.git4.1.fc28.x86_64

This doesn't happen with v4.13.1.

We are using subvolume list in our tests to check if our code for removing subvolumes works and this "new subvolume" causes our tests to crash.

[mkfs-tests] 001-basic-profiles: UB: misaligned pointer, division by zero, inf to unsigned long long

compiled with clang 4.0
CFLAGS: -g3 -O0 -Wall -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-optimize-sibling-calls -fsanitize=address,undefined
based on master branch / btrfs progs 4.10.1 / 15d37fe
run command (as root): UBSAN_OPTIONS=print_stacktrace=1 make test -k

mkfs-tests-results.txt

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/mkfs-tests/001-basic-profiles
############### losetup --find --show img1
/dev/loop4
############### losetup --find --show img2
/dev/loop5
############### losetup --find --show img3
/dev/loop6
############### losetup --find --show img4
/dev/loop7
############### /home/matthias/vcs/github/btrfs-progs/mkfs.btrfs -f /dev/loop4
btrfs-progs v4.10.1-dirty
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM /dev/loop4 (2.00GiB) ...
Label:              (null)
UUID:               ff839761-b969-4fc0-96d5-439de7e7eb4e
Node size:          16384
Sector size:        4096
Filesystem size:    2.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP             102.38MiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     2.00GiB  /dev/loop4

############### /home/matthias/vcs/github/btrfs-progs/btrfs inspect-internal dump-super /dev/loop4
superblock: bytenr=65536, device=/dev/loop4
---------------------------------------------------------
csum_type		0 (crc32c)
csum_size		4
csum			0xcc25a630 [match]
bytenr			65536
flags			0x1
			( WRITTEN )
magic			_BHRfS_M [match]
fsid			ff839761-b969-4fc0-96d5-439de7e7eb4e
label			
generation		5
root			29491200
sys_array_size		129
chunk_root_generation	5
root_level		0
chunk_root		20987904
chunk_root_level	0
log_root		0
log_root_transid	0
log_root_level		0
total_bytes		2147483648
bytes_used		114688
sectorsize		4096
nodesize		16384
leafsize		16384
stripesize		4096
root_dir		6
num_devices		1
compat_flags		0x0
compat_ro_flags		0x0
incompat_flags		0x141
			( MIXED_BACKREF |
			  EXTENDED_IREF |
			  SKINNY_METADATA )
cache_generation	18446744073709551615
uuid_tree_generation	0
dev_item.uuid		d8f6429b-f567-4af7-ab8b-79e47d5a3a57
dev_item.fsid		ff839761-b969-4fc0-96d5-439de7e7eb4e [match]
dev_item.type		0
dev_item.total_bytes	2147483648
dev_item.bytes_used	239861760
dev_item.io_align	4096
dev_item.io_width	4096
dev_item.sector_size	4096
dev_item.devid		1
dev_item.dev_group	0
dev_item.seek_speed	0
dev_item.bandwidth	0
dev_item.generation	0

############### /home/matthias/vcs/github/btrfs-progs/btrfs check /dev/loop4
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /dev/loop4
UUID: ff839761-b969-4fc0-96d5-439de7e7eb4e
found 114688 bytes used, no error found
total csum bytes: 0
total tree bytes: 114688
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 109471
file data blocks allocated: 0
 referenced 0
############### mount /dev/loop4 /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem df /home/matthias/vcs/github/btrfs-progs/tests/mnt
Data, single: total=8.00MiB, used=64.00KiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=102.38MiB, used=112.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem usage /home/matthias/vcs/github/btrfs-progs/tests/mnt
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: member access within misaligned address 0x7ffc72d78c0a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffc72d78c0a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f27b8 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: load of misaligned address 0x7ffc72d78c26 for type 'const __le32' (aka 'const unsigned int'), which requires 4 byte alignment
0x7ffc72d78c26: note: pointer points here
 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00 00 00  00 00
             ^ 
    #0 0x8f2853 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: member access within misaligned address 0x7ffc72d78c0a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffc72d78c0a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f28f8 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: load of misaligned address 0x7ffc72d78c12 for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffc72d78c12: note: pointer points here
 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00
              ^ 
    #0 0x8f2993 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: member access within misaligned address 0x7ffc72d78c0a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffc72d78c0a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2a18 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: load of misaligned address 0x7ffc72d78c22 for type 'const __le32' (aka 'const unsigned int'), which requires 8 byte alignment
0x7ffc72d78c22: note: pointer points here
 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00
              ^ 
    #0 0x8f2ab3 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: member access within misaligned address 0x7ffc72d78c0a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffc72d78c0a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2b58 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: load of misaligned address 0x7ffc72d78c1a for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffc72d78c1a: note: pointer points here
 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00
              ^ 
    #0 0x8f2bf3 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0244e2400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
Overall:
    Device size:		   2.00GiB
    Device allocated:		 228.75MiB
    Device unallocated:		   1.78GiB
    Device missing:		     0.00B
    Used:			 320.00KiB
    Free (estimated):		   1.78GiB	(min: 917.56MiB)
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		  16.00MiB	(used: 0.00B)

Data,single: Size:8.00MiB, Used:64.00KiB
   /dev/loop4	   8.00MiB

Metadata,DUP: Size:102.38MiB, Used:112.00KiB
   /dev/loop4	 204.75MiB

System,DUP: Size:8.00MiB, Used:16.00KiB
   /dev/loop4	  16.00MiB

Unallocated:
   /dev/loop4	   1.78GiB
############### /home/matthias/vcs/github/btrfs-progs/btrfs device usage /home/matthias/vcs/github/btrfs-progs/tests/mnt
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: member access within misaligned address 0x7ffe5ec4722a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffe5ec4722a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f27b8 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: load of misaligned address 0x7ffe5ec47246 for type 'const __le32' (aka 'const unsigned int'), which requires 4 byte alignment
0x7ffe5ec47246: note: pointer points here
 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00 00 00  00 00
             ^ 
    #0 0x8f2853 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: member access within misaligned address 0x7ffe5ec4722a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffe5ec4722a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f28f8 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: load of misaligned address 0x7ffe5ec47232 for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffe5ec47232: note: pointer points here
 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00
              ^ 
    #0 0x8f2993 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: member access within misaligned address 0x7ffe5ec4722a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffe5ec4722a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2a18 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: load of misaligned address 0x7ffe5ec47242 for type 'const __le32' (aka 'const unsigned int'), which requires 8 byte alignment
0x7ffe5ec47242: note: pointer points here
 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00
              ^ 
    #0 0x8f2ab3 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: member access within misaligned address 0x7ffe5ec4722a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffe5ec4722a: note: pointer points here
 e7 e7  eb 4e 05 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2b58 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: load of misaligned address 0x7ffe5ec4723a for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffe5ec4723a: note: pointer points here
 00 00  00 00 00 00 c0 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 80 00 00 00  00 00 02 00 00 00
              ^ 
    #0 0x8f2bf3 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7f5f52ce1400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
/dev/loop4, ID: 1
   Device size:             2.00GiB
   Device slack:              0.00B
   Data,single:             8.00MiB
   Metadata,DUP:          204.75MiB
   System,DUP:             16.00MiB
   Unallocated:             1.78GiB

############### umount /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/mkfs.btrfs -f -d single -m single /dev/loop4
btrfs-progs v4.10.1-dirty
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM /dev/loop4 (2.00GiB) ...
Label:              (null)
UUID:               b6b9d334-d3e4-4013-95f6-57bc9a11d5b3
Node size:          16384
Sector size:        4096
Filesystem size:    2.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         single            8.00MiB
  System:           single            4.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     2.00GiB  /dev/loop4

############### /home/matthias/vcs/github/btrfs-progs/btrfs inspect-internal dump-super /dev/loop4
superblock: bytenr=65536, device=/dev/loop4
---------------------------------------------------------
csum_type		0 (crc32c)
csum_size		4
csum			0xc5d2ea69 [match]
bytenr			65536
flags			0x1
			( WRITTEN )
magic			_BHRfS_M [match]
fsid			b6b9d334-d3e4-4013-95f6-57bc9a11d5b3
label			
generation		5
root			4210688
sys_array_size		97
chunk_root_generation	4
root_level		0
chunk_root		131072
chunk_root_level	0
log_root		0
log_root_transid	0
log_root_level		0
total_bytes		2147483648
bytes_used		114688
sectorsize		4096
nodesize		16384
leafsize		16384
stripesize		4096
root_dir		6
num_devices		1
compat_flags		0x0
compat_ro_flags		0x0
incompat_flags		0x141
			( MIXED_BACKREF |
			  EXTENDED_IREF |
			  SKINNY_METADATA )
cache_generation	18446744073709551615
uuid_tree_generation	0
dev_item.uuid		a97ccd94-5f38-47f0-b774-59d874e529fb
dev_item.fsid		b6b9d334-d3e4-4013-95f6-57bc9a11d5b3 [match]
dev_item.type		0
dev_item.total_bytes	2147483648
dev_item.bytes_used	20971520
dev_item.io_align	4096
dev_item.io_width	4096
dev_item.sector_size	4096
dev_item.devid		1
dev_item.dev_group	0
dev_item.seek_speed	0
dev_item.bandwidth	0
dev_item.generation	0

############### /home/matthias/vcs/github/btrfs-progs/btrfs check /dev/loop4
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /dev/loop4
UUID: b6b9d334-d3e4-4013-95f6-57bc9a11d5b3
found 114688 bytes used, no error found
total csum bytes: 0
total tree bytes: 114688
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 109681
file data blocks allocated: 0
 referenced 0
############### mount /dev/loop4 /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem df /home/matthias/vcs/github/btrfs-progs/tests/mnt
Data, single: total=8.00MiB, used=64.00KiB
System, single: total=4.00MiB, used=16.00KiB
Metadata, single: total=216.00MiB, used=112.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem usage /home/matthias/vcs/github/btrfs-progs/tests/mnt
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: member access within misaligned address 0x7ffde84e5b8a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffde84e5b8a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f27b8 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: load of misaligned address 0x7ffde84e5ba6 for type 'const __le32' (aka 'const unsigned int'), which requires 4 byte alignment
0x7ffde84e5ba6: note: pointer points here
 e4 00 00 00 50 00  00 00 00 00 40 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00 00 00  00 00
             ^ 
    #0 0x8f2853 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: member access within misaligned address 0x7ffde84e5b8a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffde84e5b8a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f28f8 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: load of misaligned address 0x7ffde84e5b92 for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffde84e5b92: note: pointer points here
 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 40 00
              ^ 
    #0 0x8f2993 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: member access within misaligned address 0x7ffde84e5b8a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffde84e5b8a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2a18 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: load of misaligned address 0x7ffde84e5ba2 for type 'const __le32' (aka 'const unsigned int'), which requires 8 byte alignment
0x7ffde84e5ba2: note: pointer points here
 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 40 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00
              ^ 
    #0 0x8f2ab3 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: member access within misaligned address 0x7ffde84e5b8a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffde84e5b8a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2b58 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: load of misaligned address 0x7ffde84e5b9a for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffde84e5b9a: note: pointer points here
 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 40 00 00 00  00 00 02 00 00 00
              ^ 
    #0 0x8f2bf3 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7fa0ebf61400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
Overall:
    Device size:		   2.00GiB
    Device allocated:		 228.00MiB
    Device unallocated:		   1.78GiB
    Device missing:		     0.00B
    Used:			 192.00KiB
    Free (estimated):		   1.78GiB	(min: 1.78GiB)
    Data ratio:			      1.00
    Metadata ratio:		      1.00
    Global reserve:		  16.00MiB	(used: 0.00B)

Data,single: Size:8.00MiB, Used:64.00KiB
   /dev/loop4	   8.00MiB

Metadata,single: Size:216.00MiB, Used:112.00KiB
   /dev/loop4	 216.00MiB

System,single: Size:4.00MiB, Used:16.00KiB
   /dev/loop4	   4.00MiB

Unallocated:
   /dev/loop4	   1.78GiB
############### /home/matthias/vcs/github/btrfs-progs/btrfs device usage /home/matthias/vcs/github/btrfs-progs/tests/mnt
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: member access within misaligned address 0x7ffd949fb18a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffd949fb18a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f27b8 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: load of misaligned address 0x7ffd949fb1a6 for type 'const __le32' (aka 'const unsigned int'), which requires 4 byte alignment
0x7ffd949fb1a6: note: pointer points here
 e4 00 00 00 50 00  00 00 00 00 40 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00 00 00  00 00
             ^ 
    #0 0x8f2853 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: member access within misaligned address 0x7ffd949fb18a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffd949fb18a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f28f8 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: load of misaligned address 0x7ffd949fb192 for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffd949fb192: note: pointer points here
 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 40 00
              ^ 
    #0 0x8f2993 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: member access within misaligned address 0x7ffd949fb18a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffd949fb18a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2a18 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: load of misaligned address 0x7ffd949fb1a2 for type 'const __le32' (aka 'const unsigned int'), which requires 8 byte alignment
0x7ffd949fb1a2: note: pointer points here
 00 00  00 00 e4 00 00 00 50 00  00 00 00 00 40 00 00 00  00 00 02 00 00 00 00 00  00 00 00 00 01 00
              ^ 
    #0 0x8f2ab3 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: member access within misaligned address 0x7ffd949fb18a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffd949fb18a: note: pointer points here
 9a 11  d5 b3 06 00 00 00 00 00  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  00 00 e4 00 00 00
              ^ 
    #0 0x8f2b58 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x70e4fb in _cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:531:8
    #4 0x70c5ca in cmd_device_usage /home/matthias/vcs/github/btrfs-progs/cmds-device.c:577:9
    #5 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #6 0x70c754 in cmd_device /home/matthias/vcs/github/btrfs-progs/cmds-device.c:607:9
    #7 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #8 0x7fc091e78400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #9 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

[...]

############### /home/matthias/vcs/github/btrfs-progs/btrfs inspect-internal dump-super /dev/loop4
superblock: bytenr=65536, device=/dev/loop4
---------------------------------------------------------
csum_type		0 (crc32c)
csum_size		4
csum			0x68801fef [match]
bytenr			65536
flags			0x1
			( WRITTEN )
magic			_BHRfS_M [match]
fsid			8fecceaa-c1df-4436-bb41-0badd87fdda9
label			
generation		5
root			37879808
sys_array_size		193
chunk_root_generation	5
root_level		0
chunk_root		20987904
chunk_root_level	0
log_root		0
log_root_transid	0
log_root_level		0
total_bytes		8589934592
bytes_used		114688
sectorsize		4096
nodesize		16384
leafsize		16384
stripesize		4096
root_dir		6
num_devices		4
compat_flags		0x0
compat_ro_flags		0x0
incompat_flags		0x1c1
			( MIXED_BACKREF |
			  EXTENDED_IREF |
			  RAID56 |
			  SKINNY_METADATA )
cache_generation	18446744073709551615
uuid_tree_generation	0
dev_item.uuid		f8fdef2b-6a8c-434b-a68e-b4c0e744e2b3
dev_item.fsid		8fecceaa-c1df-4436-bb41-0badd87fdda9 [match]
dev_item.type		0
dev_item.total_bytes	2147483648
dev_item.bytes_used	437780480
dev_item.io_align	4096
dev_item.io_width	4096
dev_item.sector_size	4096
dev_item.devid		1
dev_item.dev_group	0
dev_item.seek_speed	0
dev_item.bandwidth	0
dev_item.generation	0

############### /home/matthias/vcs/github/btrfs-progs/btrfs check /dev/loop4
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on /dev/loop4
UUID: 8fecceaa-c1df-4436-bb41-0badd87fdda9
found 114688 bytes used, no error found
total csum bytes: 0
total tree bytes: 114688
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 108367
file data blocks allocated: 0
 referenced 0
############### mount /dev/loop4 /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem df /home/matthias/vcs/github/btrfs-progs/tests/mnt
Data, RAID6: total=409.50MiB, used=128.00KiB
System, RAID6: total=16.00MiB, used=16.00KiB
Metadata, RAID6: total=409.50MiB, used=112.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B
############### /home/matthias/vcs/github/btrfs-progs/btrfs filesystem usage /home/matthias/vcs/github/btrfs-progs/tests/mnt
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: member access within misaligned address 0x7ffcfc2f358a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffcfc2f358a: note: pointer points here
 d8 7f  dd a9 05 00 00 00 00 00  00 00 01 00 00 00 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00
              ^ 
    #0 0x8f27b8 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9: runtime error: load of misaligned address 0x7ffcfc2f35a6 for type 'const __le32' (aka 'const unsigned int'), which requires 4 byte alignment
0x7ffcfc2f35a6: note: pointer points here
 d8 00 00 00 62 00  00 00 02 00 00 00 00 00  00 00 00 00 00 80 00 00  00 00 00 00 18 1a 00 00  00 00
             ^ 
    #0 0x8f2853 in btrfs_search_header_len /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9
    #1 0x8ea71c in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:189:11
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2388:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: member access within misaligned address 0x7ffcfc2f358a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffcfc2f358a: note: pointer points here
 d8 7f  dd a9 05 00 00 00 00 00  00 00 01 00 00 00 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00
              ^ 
    #0 0x8f28f8 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9: runtime error: load of misaligned address 0x7ffcfc2f3592 for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffcfc2f3592: note: pointer points here
 00 00  00 00 01 00 00 00 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00 62 00  00 00 02 00 00 00
              ^ 
    #0 0x8f2993 in btrfs_search_header_objectid /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9
    #1 0x8ea73a in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:191:23
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2373:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: member access within misaligned address 0x7ffcfc2f358a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffcfc2f358a: note: pointer points here
 d8 7f  dd a9 05 00 00 00 00 00  00 00 01 00 00 00 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00
              ^ 
    #0 0x8f2a18 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9: runtime error: load of misaligned address 0x7ffcfc2f35a2 for type 'const __le32' (aka 'const unsigned int'), which requires 8 byte alignment
0x7ffcfc2f35a2: note: pointer points here
 00 00  00 00 d8 00 00 00 62 00  00 00 02 00 00 00 00 00  00 00 00 00 00 80 00 00  00 00 00 00 18 1a
              ^ 
    #0 0x8f2ab3 in btrfs_search_header_type /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9
    #1 0x8ea836 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:192:19
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2383:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: member access within misaligned address 0x7ffcfc2f358a for type 'struct btrfs_ioctl_search_header', which requires 8 byte alignment
0x7ffcfc2f358a: note: pointer points here
 d8 7f  dd a9 05 00 00 00 00 00  00 00 01 00 00 00 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00
              ^ 
    #0 0x8f2b58 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
/home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9: runtime error: load of misaligned address 0x7ffcfc2f359a for type 'const __le64' (aka 'const unsigned long long'), which requires 8 byte alignment
0x7ffcfc2f359a: note: pointer points here
 00 00  00 00 02 00 00 00 00 00  00 00 d8 00 00 00 62 00  00 00 02 00 00 00 00 00  00 00 00 00 00 80
              ^ 
    #0 0x8f2bf3 in btrfs_search_header_offset /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9
    #1 0x8ea956 in load_chunk_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:193:21
    #2 0x8e913a in load_chunk_and_device_info /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:590:8
    #3 0x8ed0ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:974:9
    #4 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #5 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #8 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior /home/matthias/vcs/github/btrfs-progs/ctree.h:2378:9 in 
WARNING: RAID56 detected, not implemented
WARNING: RAID56 detected, not implemented
WARNING: RAID56 detected, not implemented
cmds-fi-usage.c:447:49: runtime error: division by zero
    #0 0x8ef67b in print_filesystem_usage_overall /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:447:49
    #1 0x8ed2ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:979:9
    #2 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #3 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #6 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior cmds-fi-usage.c:447:49 in 
cmds-fi-usage.c:447:19: runtime error: value -nan is outside the range of representable values of type 'unsigned long long'
    #0 0x8ef6db in print_filesystem_usage_overall /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:447:19
    #1 0x8ed2ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:979:9
    #2 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #3 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #6 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior cmds-fi-usage.c:447:19 in 
cmds-fi-usage.c:460:36: runtime error: division by zero
    #0 0x8ef7e4 in print_filesystem_usage_overall /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:460:36
    #1 0x8ed2ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:979:9
    #2 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #3 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #6 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior cmds-fi-usage.c:460:36 in 
cmds-fi-usage.c:460:18: runtime error: value inf is outside the range of representable values of type 'unsigned long long'
    #0 0x8ef870 in print_filesystem_usage_overall /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:460:18
    #1 0x8ed2ef in cmd_filesystem_usage /home/matthias/vcs/github/btrfs-progs/cmds-fi-usage.c:979:9
    #2 0x4f828f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:136:9
    #3 0x6fa874 in cmd_filesystem /home/matthias/vcs/github/btrfs-progs/cmds-filesystem.c:1318:9
    #4 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #5 0x7f5a81c5a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #6 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

SUMMARY: AddressSanitizer: undefined-behavior cmds-fi-usage.c:460:18 in 
Overall:
    Device size:		   8.00GiB
    Device allocated:		     0.00B
    Device unallocated:		   8.00GiB
    Device missing:		     0.00B
    Used:			     0.00B
    Free (estimated):		     0.00B	(min: 8.00EiB)
    Data ratio:			      0.00
    Metadata ratio:		      0.00
    Global reserve:		  16.00MiB	(used: 0.00B)

Data,RAID6: Size:409.50MiB, Used:128.00KiB
   /dev/loop4	 204.75MiB
   /dev/loop5	 204.75MiB
   /dev/loop6	 204.75MiB
   /dev/loop7	 204.75MiB

Metadata,RAID6: Size:409.50MiB, Used:112.00KiB
   /dev/loop4	 204.75MiB
   /dev/loop5	 204.75MiB
   /dev/loop6	 204.75MiB
   /dev/loop7	 204.75MiB

System,RAID6: Size:16.00MiB, Used:16.00KiB
   /dev/loop4	   8.00MiB
   /dev/loop5	   8.00MiB
   /dev/loop6	   8.00MiB
   /dev/loop7	   8.00MiB

Unallocated:
   /dev/loop4	   1.59GiB
   /dev/loop5	   1.59GiB
   /dev/loop6	   1.59GiB
   /dev/loop7	   1.59GiB

More build checks: musl

In order to avoid build breakage on musl, find a way how to extend current travis CI builds to achieve this.
The main task is to get the system image with musl installation where we can buid progs, the rest should be just configuration.
We can make use of:

  • test musl through specific branch
  • pull an image from docker hub
  • run pre-build scripts if needed

GPG key is invalid for btrfs-progs 4.11

Files downloaded from https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/ .

$ gpg --verify /var/spool/sorcery/btrfs-progs-v4.11.tar.sign /var/spool/sorcery/btrfs-progs-v4.11.tar.xz gpg: Signature made Thu May 18 07:16:47 2017 PDT using RSA key ID D76D583B gpg: requesting key D76D583B from hkp server pgp.mit.edu gpg: key D76D583B: public key "David Sterba <[email protected]>" imported gpg: public key EB203A7A is 4060667 seconds newer than the signature gpg: 3 marginal(s) needed, 1 complete(s) needed, classic trust model gpg: depth: 0 valid: 4 signed: 21 trust: 0-, 0q, 0n, 0m, 0f, 4u gpg: depth: 1 valid: 21 signed: 84 trust: 0-, 1q, 0n, 15m, 5f, 0u gpg: depth: 2 valid: 77 signed: 24 trust: 0-, 0q, 7n, 52m, 18f, 0u gpg: depth: 3 valid: 4 signed: 2 trust: 0-, 0q, 0n, 2m, 2f, 0u gpg: depth: 4 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 1f, 0u gpg: next trustdb check due at 2035-01-22 gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) gpg: BAD signature from "David Sterba <[email protected]>"

Yet the SHA256 hash matches https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/sha256sums.asc .
sha256sum /var/spool/sorcery/btrfs-progs-v4.11.tar.* addf707e41870c284ba17356745bef6c5b4ff2232ebf62b216954ec21e79b5d3 /var/spool/sorcery/btrfs-progs-v4.11.tar.sign e17a68cc52a27d905b715445e91ddbaa4d42de4847d54836d6ed21e012dabf0e /var/spool/sorcery/btrfs-progs-v4.11.tar.xz

Introduce a possibility to resize the filesystem to the left without copying all data

Hi,
to resize is very fast if you want resize to the right, but not if you want resize to the left. You have to copy in that case all data. It's fairly easy with GParted, but it takes much time.
Of course it's necessary to copy important file system data (superblock and data structure at the beginng of the file system), but nothing more. That data can be copied by the btrfs fi resize command, similiar to needed relocations if you want to reduce a filesystem where are data in the device area beyond the new end.

[btrfs-tools] Two consecutive identical calls of "btrfs subvolume snapshot" create two different snapshots instead of rejecting the second one

Usecase:

Create a snapshot of source:/mnt/mount_fs to destination:/mnt/mount_fs/Snapshots with the name: Snapshot_001

Precondition:

folder /mnt/mount_fs/Snapshots/ exists at the time when the command is executed as destination path for the snapshots

Issue

Two consecutive identical calls of "btrfs subvolume snapshot .." create two snapshots instead of rejecting the second call (as occurred with the third command) I don't think this is a right behavior because it can lead to unnecessary identical snapshots under different names in case when the second call is executed by mistake.
Tested with btrfs-progs v4.12.0 and btrfs-progs v4.13.3 but I think it occurs with other versions too.

Testcase

First call OK

osboxes@osboxes:~/Working/tests$ sudo btrfs subvolume snapshot /mnt/mount_fs /mnt/mount_fs/Snapshots/Snapshot_001
Create a snapshot of '/mnt/mount_fs' in '/mnt/mount_fs/Snapshots/Snapshot_001'
osboxes@osboxes:~/Working/tests$

osboxes@osboxes:~/Working/tests$ sudo btrfs su li /mnt/mount_fs/
ID 310 gen 131 top level 5 path Snapshots/Snapshot_001
osboxes@osboxes:~/Working/tests$

Second identical call => NOT OK !!! (???)

osboxes@osboxes:~/Working/tests$ sudo btrfs subvolume snapshot /mnt/mount_fs /mnt/mount_fs/Snapshots/Snapshot_001
Create a snapshot of '/mnt/mount_fs' in '/mnt/mount_fs/Snapshots/Snapshot_001/mount_fs'
osboxes@osboxes:~/Working/tests$

osboxes@osboxes:~/Working/tests$ sudo btrfs su li /mnt/mount_fs/
ID 310 gen 132 top level 5 path Snapshots/Snapshot_001
ID 311 gen 132 top level 310 path Snapshots/Snapshot_001/mount_fs
osboxes@osboxes:~/Working/tests$

Third identical call

osboxes@osboxes:~/Working/tests$ sudo btrfs subvolume snapshot /mnt/mount_fs /mnt/mount_fs/Snapshots/Snapshot_001
Create a snapshot of '/mnt/mount_fs' in '/mnt/mount_fs/Snapshots/Snapshot_001/mount_fs'
ERROR: cannot snapshot '/mnt/mount_fs': File exists
osboxes@osboxes:~/Working/tests$

osboxes@osboxes:~/Working/tests$ sudo btrfs su li /mnt/mount_fs/
ID 310 gen 132 top level 5 path Snapshots/Snapshot_001
ID 311 gen 132 top level 310 path Snapshots/Snapshot_001/mount_fs
osboxes@osboxes:~/Working/tests$

Funded fuzzing running out

Hi,

there are still several weeks worth of donated 24/7-fuzzing available. The grace period on that funding is running out in October, unused funds expire by then. Most of the bugs found so far are currently unresolved and there has been no movement in close to a year.

In order not to swamp reports, the above-mentioned bugs need to be resolved before we can continue fuzzing BTRFS. Is there a chance for progress on this? If not, I'd use those funds for other OSS-work.

btrfs check segfault on badly broken image

btrfs check segfaults when run on a disk i probably broke by a bad combination of btrfs and lvm.

in v4.12 and a build with CFLAGS=-g3 --disable-documentation --disable-convert, i looked around in gdb and found the attached (correction to-be-copied-in) -- at some point in digging down, i got lost between what are pointers, what are offsets, and where are the macros from.

Document ioctls

  • make list of all supported ioctls
  • annotate with versions
  • list used structures
  • enumerate constraints
  • possibly make short examples
  • refer to existing commands

The format should suit a manual page, the html output generated from asciidoc is usually ok.

ETA for scrub, improved status

Scrub status could estimate run time, by calculating average progress on all devices. This can be tricky in case other system activity that will preempt the scrub io, but some kind of estimate could be given nevertheless.

The status report can be reworked so we can put more information there. Eg. do the key: value style of output, per device stats, continuous updates, bandwidth utilization, current progress, etc.

[cli-tests] 005-qgroup-show: memory leak

compiled with clang 4.0
CFLAGS: -O0 -g3 -fsanitize=address,undefined -fno-omit-frame-pointer
based on maste branch / btrfs progs v4.12 / 0607132

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/cli-tests/005-qgroup-show
$TEST_DEV not given, use /home/matthias/vcs/github/btrfs-progs/test/test.img as fallback
############### /home/matthias/vcs/github/btrfs-progs/mkfs.btrfs -f /home/matthias/vcs/github/btrfs-progs/tests/test.img
btrfs-progs v4.12-2-gb740108
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               0a7fbc93-c713-45ab-bd97-02930cbe2dc8
Node size:          16384
Sector size:        4096
Filesystem size:    2.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP             102.38MiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     2.00GiB  /home/matthias/vcs/github/btrfs-progs/tests/test.img

############### mount -t btrfs -o loop /home/matthias/vcs/github/btrfs-progs/tests/test.img /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
ERROR: can't list qgroups: quotas not enabled

=================================================================
==14712==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 168 byte(s) in 1 object(s) allocated from:
    #0 0x4ca9c3 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x64c576 in btrfs_qgroup_alloc_comparer_set /home/matthias/vcs/github/btrfs-progs/qgroup.c:440:8
    #2 0x767418 in cmd_qgroup_show /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:309:17
    #3 0x4f854f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:137:9
    #4 0x769814 in cmd_qgroup /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:529:9
    #5 0x4f9423 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #6 0x7f308a755400 in __libc_start_main (/lib64/libc.so.6+0x20400)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x4ca9c3 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x64dbed in btrfs_qgroup_alloc_filter_set /home/matthias/vcs/github/btrfs-progs/qgroup.c:810:8
    #2 0x7673d7 in cmd_qgroup_show /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:308:15
    #3 0x4f854f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:137:9
    #4 0x769814 in cmd_qgroup /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:529:9
    #5 0x4f9423 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #6 0x7f308a755400 in __libc_start_main (/lib64/libc.so.6+0x20400)

SUMMARY: AddressSanitizer: 240 byte(s) leaked in 2 allocation(s).
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
ERROR: can't list qgroups: quotas not enabled

=================================================================
==14718==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 168 byte(s) in 1 object(s) allocated from:
    #0 0x4ca9c3 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x64c576 in btrfs_qgroup_alloc_comparer_set /home/matthias/vcs/github/btrfs-progs/qgroup.c:440:8
    #2 0x767418 in cmd_qgroup_show /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:309:17
    #3 0x4f854f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:137:9
    #4 0x769814 in cmd_qgroup /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:529:9
    #5 0x4f9423 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #6 0x7f28c4813400 in __libc_start_main (/lib64/libc.so.6+0x20400)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x4ca9c3 in calloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74:3
    #1 0x64dbed in btrfs_qgroup_alloc_filter_set /home/matthias/vcs/github/btrfs-progs/qgroup.c:810:8
    #2 0x7673d7 in cmd_qgroup_show /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:308:15
    #3 0x4f854f in handle_command_group /home/matthias/vcs/github/btrfs-progs/btrfs.c:137:9
    #4 0x769814 in cmd_qgroup /home/matthias/vcs/github/btrfs-progs/cmds-qgroup.c:529:9
    #5 0x4f9423 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #6 0x7f28c4813400 in __libc_start_main (/lib64/libc.so.6+0x20400)

SUMMARY: AddressSanitizer: 240 byte(s) leaked in 2 allocation(s).
failed (ignored, ret=1): /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs quota enable /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
WARNING: rescan is running, qgroup data may be incorrect
qgroupid         rfer         excl 
--------         ----         ---- 
0/5          16.00KiB     16.00KiB 
############### /home/matthias/vcs/github/btrfs-progs/btrfs qgroup show /home/matthias/vcs/github/btrfs-progs/tests/mnt
WARNING: rescan is running, qgroup data may be incorrect
qgroupid         rfer         excl 
--------         ----         ---- 
0/5          16.00KiB     16.00KiB 
############### /home/matthias/vcs/github/btrfs-progs/btrfs quota disable /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### umount /home/matthias/vcs/github/btrfs-progs/tests/test.img

btrfs send/receive should not respect replaying lremovexattr on SElinux permissive and above systems

Version of btrfs-progs: btrfs-progs-4.9.1-2.fc26.x86_64
Kernel: 4.12.12-300.fc26.x86_64 (also tested prior kernels)

Related to: digint/btrbk#160 as that is downstream from this bug. Initially filed as a bug against btrbk, it's trivial to output the debug from btrbk and replay the commands and prove that it is in fact btrfs send/receive upstream producing the following error:

### btrfs send -p /mnt/btrfs_root/snapshots/home.20170910T150101-0400 /mnt/btrfs_root/snapshots/home.20170915T180117-0400 | btrfs receive /mnt/external1/icarus_main/
Command execution failed (exitcode=1): "{ btrfs send -p /mnt/btrfs_root/snapshots/home.20170910T150101-0400 /mnt/btrfs_root/snapshots/home.20170915T180117-0400 2>&3 | btrfs receive /mnt/external1/icarus_main/ 2>&3 ; } 3>&1"
WARNING: [send/receive] (send=/mnt/btrfs_root/snapshots/home.20170915T180117-0400, receive=/mnt/external1/icarus_main) At subvol /mnt/btrfs_root/snapshots/home.20170915T180117-0400
ERROR: lremovexattr xenith/.config/Rocket.Chat+/Cookies security.selinux failed: Permission denied

This code is breaking send/receive backup strategies for any one SELinux permissive and enabled systems.

As per what SELinux developer Stephen Smalley said on an old bug here: https://bugzilla.redhat.com/show_bug.cgi?id=450360#c1

Bug in rsync: don't try to remove the SELinux attribute.
SELinux doesn't ever allow removal of its attributes if enabled; you can change
the label, but all data must be labeled.

And this is still the case today (as it should be). Therefore, the bottom line is that you can't delete selinux attributes on permissive and above SElinux systems, so btrfs send/receive shouldn't even be attempting to do that on permissive and above systems. Either btrfs send is messing up by attempting to replay it, or btrfs receive is messing up by not filtering it out. This means all Fedora and RHEL/CentOS systems by default are affected (who use btrfs and send/receive).

Please fix this as this breaks many local and remote backup strategies where btrfs and selinux are concerned.

[misc-tests] 019-receive-clones-on-munted-subvol: memory leak

compiled with clang 4.0
CFLAGS: -g3 -O0 -Wall -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-optimize-sibling-calls -fsanitize=address,undefined
based on master branch / btrfs progs 4.10.1 / 15d37fe
run command (as root): UBSAN_OPTIONS=print_stacktrace=1 make test -k

misc-tests-results.txt

From the stacktrace it looks like this memleak is only caused by the test-code itself and not by the code being tested.

[...]
############### mount -o loop /home/matthias/vcs/github/btrfs-progs/tests/test.img /home/matthias/vcs/github/btrfs-progs/tests/mnt
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume create /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo
Create subvolume '/home/matthias/vcs/github/btrfs-progs/tests/mnt/foo'
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume create /home/matthias/vcs/github/btrfs-progs/tests/mnt/bar
Create subvolume '/home/matthias/vcs/github/btrfs-progs/tests/mnt/bar'
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume create /home/matthias/vcs/github/btrfs-progs/tests/mnt/baz
Create subvolume '/home/matthias/vcs/github/btrfs-progs/tests/mnt/baz'
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume create /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap
Create subvolume '/home/matthias/vcs/github/btrfs-progs/tests/mnt/snap'
############### dd of=/home/matthias/vcs/github/btrfs-progs/tests/mnt/foo/file_a bs=4096 count=32
0+0 records in
0+0 records out
0 bytes copied, 0.0512679 s, 0.0 kB/s
############### dd of=/home/matthias/vcs/github/btrfs-progs/tests/mnt/bar/file_b bs=4096 count=32
0+0 records in
0+0 records out
0 bytes copied, 3.5627e-05 s, 0.0 kB/s
############### cp --reflink=always /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo/file_a /home/matthias/vcs/github/btrfs-progs/tests/mnt/baz/file_a
############### cp --reflink=always /home/matthias/vcs/github/btrfs-progs/tests/mnt/bar/file_b /home/matthias/vcs/github/btrfs-progs/tests/mnt/baz/file_b
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume snapshot -r /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0
Create a readonly snapshot of '/home/matthias/vcs/github/btrfs-progs/tests/mnt/foo' in '/home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0'
############### /home/matthias/vcs/github/btrfs-progs/btrfs send -f ./send-test-dir/foo.0.snap /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0
At subvol /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume snapshot -r /home/matthias/vcs/github/btrfs-progs/tests/mnt/bar /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/bar.0
Create a readonly snapshot of '/home/matthias/vcs/github/btrfs-progs/tests/mnt/bar' in '/home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/bar.0'
############### /home/matthias/vcs/github/btrfs-progs/btrfs send -f ./send-test-dir/bar.0.snap /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/bar.0
At subvol /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/bar.0
############### cp --reflink=always /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo/file_a /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo/file_a.clone
############### rm -f -- /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo/file_a
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume snapshot -r /home/matthias/vcs/github/btrfs-progs/tests/mnt/foo /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.1
Create a readonly snapshot of '/home/matthias/vcs/github/btrfs-progs/tests/mnt/foo' in '/home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.1'
############### /home/matthias/vcs/github/btrfs-progs/btrfs send -p /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0 -f ./send-test-dir/foo.1.snap /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.1
At subvol /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.1
############### /home/matthias/vcs/github/btrfs-progs/btrfs subvolume snapshot -r /home/matthias/vcs/github/btrfs-progs/tests/mnt/baz /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/baz.0
Create a readonly snapshot of '/home/matthias/vcs/github/btrfs-progs/tests/mnt/baz' in '/home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/baz.0'
############### /home/matthias/vcs/github/btrfs-progs/btrfs send -p /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.1 -c /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/bar.0 -f ./send-test-dir/baz.0.snap /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/baz.0
At subvol /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/baz.0
############### /home/matthias/vcs/github/btrfs-progs/fssum -A -f -w ./send-test-dir/foo.0.fssum /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0

=================================================================
==6787==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32816 byte(s) in 1 object(s) allocated from:
    #0 0x4c20cc in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x7f225ae42e93 in __alloc_dir /usr/src/debug/glibc-2.24-33-ge9e69e4/dirent/../sysdeps/posix/opendir.c:247

Direct leak of 1024 byte(s) in 1 object(s) allocated from:
    #0 0x4c247e in realloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:79:3
    #1 0x4f3b5b in sum /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:492:15
    #2 0x4f8ebe in main /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:786:2
    #3 0x7f225ad9b400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Direct leak of 65 byte(s) in 1 object(s) allocated from:
    #0 0x4c20cc in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x4f0ac4 in alloc /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:163:12
    #2 0x4f0fe4 in sum_to_string /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:214:12
    #3 0x4f9032 in main /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:801:27
    #4 0x7f225ad9b400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Indirect leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x4ae7b3 in strdup /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:550:3
    #1 0x4f3c87 in sum /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:499:23
    #2 0x4f8ebe in main /home/matthias/vcs/github/btrfs-progs/tests/fssum.c:786:2
    #3 0x7f225ad9b400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 33912 byte(s) leaked in 4 allocation(s).
failed: /home/matthias/vcs/github/btrfs-progs/fssum -A -f -w ./send-test-dir/foo.0.fssum /home/matthias/vcs/github/btrfs-progs/tests/mnt/snap/foo.0
test failed for case 019-receive-clones-on-munted-subvol

mkfs: create initial subvolume

Create an initial subvolume or subvolumes.
Usecase:

  • allow --root-dir to put the files there
  • allow creating nested subvolumes
  • allow creating arbitrary paths
  • allow multiple subvolumes

Add support for running the tools from a given path

... (git, /usr/bin, /usr/local/bin), so the testsuite can be run independently.

The idea is to export the testsuite files to a separate tar, run from a script. In that case the system binaries will be preferred.

This is supposed to extend the testing possibilities. The packaging phase could run some tests, many tools run post-build tests, but we need to manage devices and require root in general. This is not always possible, besides that it requires to run from the sources directory.

BTRFS should grow a RAID1 filesystem when replacing smaller drives with bigger ones

Suppose you have a BTRFS RAID1 filesystem with 4 drives, 3 GB each, 6 GB capacity:

# mkfs.btrfs -f -draid1 -mraid1 /dev/sdb /dev/sdc /dev/sdd /dev/sde >/dev/null 
# mount /dev/sdb BTRFS/
# btrfs fi show BTRFS/
Label: none  uuid: e6dc6a95-ae5e-49c4-bded-77001b445ac7
    Total devices 4 FS bytes used 192.00KiB
    devid    1 size 3.00GiB used 331.12MiB path /dev/sdb
    devid    2 size 3.00GiB used 0.00B path /dev/sdc
    devid    3 size 3.00GiB used 0.00B path /dev/sdd
    devid    4 size 3.00GiB used 0.00B path /dev/sde

# parted -s /dev/sdb print | grep Disk
Disk /dev/sdb: 3221MB
Disk Flags: 
# parted -s /dev/sdc print | grep Disk
Disk /dev/sdc: 3221MB
Disk Flags: 
# parted -s /dev/sdd print | grep Disk
Disk /dev/sdd: 3221MB
Disk Flags: 
# parted -s /dev/sde print | grep Disk
Disk /dev/sde: 3221MB
Disk Flags: 
# df -h BTRFS/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        6.0G   17M  5.3G   1% /mnt/BTRFS

After replacing 2 3G drives with 4G drives, you should have a new total capacity of 7 GB...

# parted -s /dev/sdf print | grep Disk
Disk /dev/sdf: 4295MB
Disk Flags: 
# parted -s /dev/sdg print | grep Disk
Disk /dev/sdg: 4295MB
Disk Flags: 
# btrfs replace start -f 3 /dev/sdf BTRFS/
# btrfs replace start -f 4 /dev/sdg BTRFS/
# btrfs fi show BTRFS/
Label: none  uuid: e6dc6a95-ae5e-49c4-bded-77001b445ac7
    Total devices 4 FS bytes used 512.00KiB
    devid    1 size 3.00GiB used 1.28GiB path /dev/sdb
    devid    2 size 3.00GiB used 1.25GiB path /dev/sdc
    devid    3 size 3.00GiB used 1.06GiB path /dev/sdf
    devid    4 size 3.00GiB used 544.00MiB path /dev/sdg

# df -h BTRFS/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        6.0G   17M  5.2G   1% /mnt/BTRFS

... but you don't. The filesystem still has its initial capacity of 6 GB instead of the expected 7 GB.

It is only after manually growing the filesystem on each replaced device that you get the full capacity of the drives:

# btrfs fi resize 3:max BTRFS/
Resize 'BTRFS/' of '3:max'
# btrfs fi resize 4:max BTRFS/
Resize 'BTRFS/' of '4:max'
# df -h BTRFS/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        7.0G   17M  6.8G   1% /mnt/BTRFS

These extra steps should not be necessary. After replacing some drives, it looks like BTRFS is unable to make use of the new capacity when in fact some manual resize commands need to be called.

Tested with btrfs-progs 4.4.

Coverity analysis not checking all sources

https://scan.coverity.com/projects/btrfs-progs

Component Name Pattern Ignore Line of Code Defect density
mkfs .*/mkfs/.* No 0 N/A
convert .*/convert/.* No 0 N/A
image .*/image/.* No 0 N/A
kernel-lib .*/kernel-lib/.* No 335 0.00
kernel-shared .*/kernel-shared/.* No 0 N/A
Other .* No 24,897 0.00

Last full check is reported from August 2017, then the number of defects went to 0. The problem has been reported.

Enhance documentation build, use asciidoctor

The tool asciidoc uses python2 that's going to be phased out soon (next year). There's a replacement, asciidoctor. Add a configure-time detection what tool is available, update Documentation/Makefile.

Our doc build is copied from The git project, and the transition to asciidoctor is already done. There are some commandline and config file changes needed.

Test misc/015-dump-super-garbage occasionally fails

The test fails due to a bad memory access,

(gdb) l
215                             btrfs_chunk_sub_stripes(eb, chunk));
216             for (i = 0 ; i < num_stripes ; i++) {
217                     unsigned char dev_uuid[BTRFS_UUID_SIZE];
218                     char str_dev_uuid[BTRFS_UUID_UNPARSED_SIZE];
219
220                     read_extent_buffer(eb, dev_uuid,
221                             (unsigned long)btrfs_stripe_dev_uuid_nr(chunk, i),
222                             BTRFS_UUID_SIZE);
#2  read_extent_buffer (eb=eb@entry=0x3630420, dst=dst@entry=0x396f990cfd0, start=start@entry=133980, len=len@entry=16) at extent_io.c:863
863             memcpy(dst, eb->data + start, len);

the value of start is out of range, needs to be validated.

capabilities are lost when send/receive

This bug is probably a regression: https://bugzilla.kernel.org/show_bug.cgi?id=68891

btrfs-progs: 4.14
kernel 4.14.14 (on Archlinux)

For the original fs and a readonly snapshot, I get:

# find /usr/bin -type f | xargs getcap                                           
/usr/bin/rsh = cap_net_bind_service+ep
/usr/bin/rcp = cap_net_bind_service+ep
/usr/bin/rlogin = cap_net_bind_service+ep
/usr/bin/ping = cap_net_raw+ep
/usr/bin/mtr-packet = cap_net_bind_service,cap_net_raw+ep
/usr/bin/sway = cap_sys_ptrace+eip
/usr/bin/dumpcap = cap_dac_override,cap_net_admin,cap_net_raw+eip

After send/receive:

# find /usr/bin -type f | xargs getcap
<nothing>

docs: btrfs-man5: nonsensical sentence

In the file Documentation/btrfs-man5.asciidoc, in the File Attributes section, the description for the 'd' attribute is nonsensical.

"on BTRFS the attribute can be set/unset on no other special handling is done"

This description first appeared in Documentation/btrfs-mount.asciidoc in commit a8829f5 before that file was renamed to Documentation/btrfs-man5.asciidoc in commit 32c063c.

ASAN: use after free, memleak, buffer overflow in tests

I worked with commit 5e895dd of the devel branch.

to reproduce:
compile with -fsanitize=address,undefined -g3 -O0 -fno-omit-frame-pointer (I used clang 3.9)
execute UBSAN_OPTIONS=print_stacktrace=1 make test -k

fsck-tests/003-shift-offsets shows indirect memory leaks and fsck-tests/004-no-dir-index crashes with heap use after free.

EDIT: master ( 96485c3 ) seems to suffer from this as well.

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/003-shift-offsets
restoring image default_case.img
testing image default_case.img.restored
checking extents
incorrect offsets 15018 9387
bad block 29360128
ERROR: errors found in extent allocation tree or chunk allocation
checking free space cache
checking fs roots
incorrect offsets 15018 9387

=================================================================
==14890==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 768 byte(s) in 4 object(s) allocated from:
    #0 0x4c233c in malloc /home/matthias/LLVM/LLVM_3_9/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x7c1151 in add_extent_rec_nolookup /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5984:8
    #2 0x7bf5b1 in add_extent_rec /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6126:8
    #3 0x7c9b62 in process_extent_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6770:2
    #4 0x7b899c in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7662:5
    #5 0x7abf8e in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9703:10
    #6 0x778eb9 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9870:8
    #7 0x76f056 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12897:9
    #8 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #9 0x7fa97107a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Indirect leak of 216 byte(s) in 3 object(s) allocated from:
    #0 0x4c233c in malloc /home/matthias/LLVM/LLVM_3_9/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x7aa9d9 in add_root_item_to_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9635:11
    #2 0x77891d in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9838:11
    #3 0x76f056 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12897:9
    #4 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #5 0x7fa97107a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

Indirect leak of 128 byte(s) in 4 object(s) allocated from:
    #0 0x4c233c in malloc /home/matthias/LLVM/LLVM_3_9/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x7c3f65 in alloc_tree_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:5838:29
    #2 0x7bfc56 in add_tree_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6168:10
    #3 0x7c9e6e in process_extent_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:6784:10
    #4 0x7b899c in run_next_block /home/matthias/vcs/github/btrfs-progs/cmds-check.c:7662:5
    #5 0x7abf8e in deal_root_from_list /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9703:10
    #6 0x778eb9 in check_chunks_and_extents /home/matthias/vcs/github/btrfs-progs/cmds-check.c:9870:8
    #7 0x76f056 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12897:9
    #8 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #9 0x7fa97107a400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: 1112 byte(s) leaked in 11 allocation(s).
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
checking extents
incorrect offsets 15018 9387
Fixed 0 roots.
checking free space cache
checking fs roots
checking csums
checking root refs
enabling repair mode
Checking filesystem on ./default_case.img.restored
UUID: 96ab8688-d6d5-44b0-849e-63720c2c79db
Shifting item nr 28 by 5631 bytes in block 29376512
Shifting item nr 29 by 5631 bytes in block 29376512
Shifting item nr 30 by 5631 bytes in block 29376512
Shifting item nr 31 by 5631 bytes in block 29376512
Shifting item nr 32 by 5631 bytes in block 29376512
Shifting item nr 33 by 5631 bytes in block 29376512
Shifting item nr 34 by 5631 bytes in block 29376512
Shifting item nr 35 by 5631 bytes in block 29376512
Shifting item nr 36 by 5631 bytes in block 29376512
Shifting item nr 37 by 5631 bytes in block 29376512
Shifting item nr 38 by 5631 bytes in block 29376512
Shifting item nr 39 by 5631 bytes in block 29376512
Shifting item nr 40 by 5631 bytes in block 29376512
Shifting item nr 41 by 5631 bytes in block 29376512
Shifting item nr 42 by 5631 bytes in block 29376512
Shifting item nr 43 by 5631 bytes in block 29376512
Shifting item nr 44 by 5631 bytes in block 29376512
Shifting item nr 45 by 5631 bytes in block 29376512
Shifting item nr 46 by 5631 bytes in block 29376512
Shifting item nr 47 by 5631 bytes in block 29376512
Shifting item nr 48 by 5631 bytes in block 29376512
Shifting item nr 49 by 5631 bytes in block 29376512
Shifting item nr 50 by 5631 bytes in block 29376512
Shifting item nr 51 by 5631 bytes in block 29376512
Shifting item nr 52 by 5631 bytes in block 29376512
Shifting item nr 53 by 5631 bytes in block 29376512
Shifting item nr 54 by 5631 bytes in block 29376512
Shifting item nr 55 by 5631 bytes in block 29376512
Shifting item nr 56 by 5631 bytes in block 29376512
cache and super generation don't match, space cache will be invalidated
found 786432 bytes used err is 0
total csum bytes: 0
total tree bytes: 196608
total fs tree bytes: 32768
total extent tree bytes: 32768
btree space waste bytes: 178837
file data blocks allocated: 524288
 referenced 524288
############### /home/matthias/vcs/github/btrfs-progs/btrfs check ./default_case.img.restored
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on ./default_case.img.restored
UUID: 96ab8688-d6d5-44b0-849e-63720c2c79db
cache and super generation don't match, space cache will be invalidated
found 393216 bytes used err is 0
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 119363
file data blocks allocated: 262144
 referenced 262144
=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/004-no-dir-index
restoring image default_case.img
testing image default_case.img.restored
checking extents
checking free space cache
checking fs roots
root 5 root dir 256 error
root 5 inode 256 errors 200, dir isize wrong
	unresolved ref dir 256 index 10 namelen 1 name 8 filetype 1 errors 2, no dir index
Checking filesystem on ./default_case.img.restored
UUID: fb9086d2-33f3-4765-a14e-d8a87e3b2ba3
cache and super generation don't match, space cache will be invalidated
found 393216 bytes used err is 1
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 119419
file data blocks allocated: 262144
 referenced 262144
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
checking extents
Fixed 0 roots.
checking free space cache
checking fs roots
repairing missing dir index item for inode 265
=================================================================
==14924==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600000e550 at pc 0x00000084bb44 bp 0x7fffecc38590 sp 0x7fffecc38588
READ of size 1 at 0x60600000e550 thread T0
    #0 0x84bb43 in repair_inode_backrefs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2684:29
    #1 0x82cf9a in check_inode_recs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3325:10
    #2 0x81e21c in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4007:8
    #3 0x77eb49 in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4093:10
    #4 0x76f688 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12944:9
    #5 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #6 0x7fed4a7db400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #7 0x4234a9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x4234a9)

0x60600000e550 is located 16 bytes inside of 50-byte region [0x60600000e540,0x60600000e572)
freed by thread T0 here:
    #0 0x4c1feb in free /home/matthias/LLVM/LLVM_3_9/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:47:3
    #1 0x84ba7f in repair_inode_backrefs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2679:6
    #2 0x82cf9a in check_inode_recs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3325:10
    #3 0x81e21c in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4007:8
    #4 0x77eb49 in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4093:10
    #5 0x76f688 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12944:9
    #6 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #7 0x7fed4a7db400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

previously allocated by thread T0 here:
    #0 0x4c233c in malloc /home/matthias/LLVM/LLVM_3_9/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x83ee0e in get_inode_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1075:12
    #2 0x83c8b3 in add_inode_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1097:12
    #3 0x840053 in process_dir_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1525:4
    #4 0x835780 in process_one_leaf /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1838:10
    #5 0x822ba5 in walk_down_tree /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2134:10
    #6 0x81d158 in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3952:10
    #7 0x77eb49 in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4093:10
    #8 0x76f688 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:12944:9
    #9 0x4f1363 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:302:8
    #10 0x7fed4a7db400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: heap-use-after-free /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2684:29 in repair_inode_backrefs
Shadow bytes around the buggy address:
  0x0c0c7fff9c50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9c60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9c70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9c80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9c90: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
=>0x0c0c7fff9ca0: fd fd fd fa fa fa fa fa fd fd[fd]fd fd fd fd fa
  0x0c0c7fff9cb0: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
  0x0c0c7fff9cc0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c7fff9cd0: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c7fff9ce0: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c7fff9cf0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==14924==ABORTING
failed: /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored

btrfs check, backref.c:466: __add_missing_keys: Assertion `ref->root_id` failed, value 0

$ git branch -v

I'm getting a crash whenever I use btrfs check --mode=lowmem. It doesn't happen without lowmem.

[chris@f27s btrfs-progs]$ sudo ./btrfs check --mode=lowmem /dev/mapper/first
Checking filesystem on /dev/mapper/first
UUID: 0f43f49d-6e63-4b1b-bc8c-c54da409872d
checking extents
backref.c:466: __add_missing_keys: Assertion ref->root_id failed, value 0
./btrfs[0x4335ef]
./btrfs[0x433f03]
./btrfs[0x434db2]
./btrfs(btrfs_find_all_roots+0x9)[0x434e02]
./btrfs[0x4506bc]
./btrfs[0x459ed0]
./btrfs(cmd_check+0x2634)[0x4617ee]
./btrfs(main+0x88)[0x40b61d]
/lib64/libc.so.6(__libc_start_main+0xea)[0x7f6e83a8103a]
./btrfs(_start+0x2a)[0x40b1ea]
Aborted

Attaching file containing versions of everything and the build steps.

btrfs check 4.14 crash.txt

Tracking issue: gcc + asan test coverage

What tests pass with make D=asan CC=gcc build. The list is edited in-place, updates as comments.

  • test-cli
  • test-mkfs
    • 009-special-files-for-rootdir - minor leak
  • test-misc
    • 005-convert-progress-thread-crash - leaks
    • 008-leaf-crossing-stripes - leaks
    • 010-convert-delete-ext2-subvol - leaks
  • test-check
    • 020-extent-ref-cases - heap overflow

btrfs-progs devel: build failure: asciidoc: Too many arguments

Quick bug report. Seems like devel-branch build is failing while building docs:

Making all in Documentation
[ASCII] btrfs-ioctl.xml
asciidoc: Too many arguments

Man page: asciidoc --help manpage
Syntax: asciidoc --help syntax
make[1]: *** [Makefile:125: btrfs-ioctl.xml] Error 1
make: *** [Makefile:294: build-Documentation] Error 2

Here is the logs

fsck/028-unaligned-super-dev-sizes failure report

While running btrfs-progs/devel on latest btrfs-devel/misc-next (4.15.0-rc9), fsck/028-unaligned-super-dev-sizes passed last week

Now it fails with message like:

root_helper mount -t btrfs -o loop /home/fedora/btrfs-progs/tests/test.img /home/fedora/btrfs-progs/tests/mnt
mount: /home/fedora/btrfs-progs/tests/mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
failed: root_helper mount -t btrfs -o loop /home/fedora/btrfs-progs/tests/test.img /home/fedora/btrfs-progs/tests/mnt
test failed for case 028-unaligned-super-dev-sizes

Just want to quickly update this issue, will try to narrow down the patch later this week. build logs

btrfs.mkfs reports incorrect minimum size

If I run mkfs.btrfs on a disk that is less than 41943040 bytes, I get:

ERROR: 'test.img' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 41943040

However, the actual minimum size seems to be much higher. Disks of up to 80MB in size report:

ERROR: not enough free space to allocate chunk

It seems like it would be more useful to report the size needed to successfully complete in the first message.

Checked on mkfs.btrfs, part of btrfs-progs v4.12.1.

subvol set-default: also accept path

User request to make the following a convenience shortcut (instead of
resolving the subvol id):

btrfs subvolume set-default /path/to/subvol
  • ambiguity must be resolved: if there's a subvolume-by-name with a number
    that's also an existing subvol-by-id

[fsck-test] 004-no-dir-index: heap use after free

compiled with clang 4.0
CFLAGS: -g3 -O0 -Wall -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-optimize-sibling-calls -fsanitize=address,undefined
based on master branch / btrfs progs 4.10.1 / 15d37fe
run command (as root): UBSAN_OPTIONS=print_stacktrace=1 make test -k

fsck-tests-results.txt

Test crashed under address sanitizer with heap-use-after-free

=== Entering /home/matthias/vcs/github/btrfs-progs/tests/fsck-tests/004-no-dir-index
restoring image default_case.img
testing image default_case.img.restored
checking extents
checking free space cache
checking fs roots
root 5 root dir 256 error
root 5 inode 256 errors 200, dir isize wrong
	unresolved ref dir 256 index 10 namelen 1 name 8 filetype 1 errors 2, no dir index
ERROR: errors found in fs roots
Checking filesystem on ./default_case.img.restored
UUID: fb9086d2-33f3-4765-a14e-d8a87e3b2ba3
cache and super generation don't match, space cache will be invalidated
found 393216 bytes used, error(s) found
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 119419
file data blocks allocated: 262144
 referenced 262144
############### /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored
checking extents
Fixed 0 roots.
checking free space cache
checking fs roots
repairing missing dir index item for inode 265
=================================================================
==26658==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000000ab0 at pc 0x00000086c204 bp 0x7ffdf7c168d0 sp 0x7ffdf7c168c8
READ of size 1 at 0x606000000ab0 thread T0
    #0 0x86c203 in repair_inode_backrefs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2689:29
    #1 0x84d277 in check_inode_recs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3330:10
    #2 0x83e3cb in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4012:8
    #3 0x79b3fb in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4098:10
    #4 0x78b850 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13015:9
    #5 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #6 0x7f92e6824400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289
    #7 0x423bf9 in _start (/home/matthias/vcs/github/btrfs-progs/btrfs+0x423bf9)

0x606000000ab0 is located 16 bytes inside of 50-byte region [0x606000000aa0,0x606000000ad2)
freed by thread T0 here:
    #0 0x4ca1cb in free /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:47:3
    #1 0x86c13f in repair_inode_backrefs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2684:6
    #2 0x84d277 in check_inode_recs /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3330:10
    #3 0x83e3cb in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4012:8
    #4 0x79b3fb in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4098:10
    #5 0x78b850 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13015:9
    #6 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #7 0x7f92e6824400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

previously allocated by thread T0 here:
    #0 0x4ca51c in malloc /home/matthias/LLVM/LLVM_4_0/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66:3
    #1 0x85f21e in get_inode_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1075:12
    #2 0x85cca3 in add_inode_backref /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1097:12
    #3 0x8604ca in process_dir_item /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1525:4
    #4 0x855afa in process_one_leaf /home/matthias/vcs/github/btrfs-progs/cmds-check.c:1838:10
    #5 0x842d8c in walk_down_tree /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2134:10
    #6 0x83d300 in check_fs_root /home/matthias/vcs/github/btrfs-progs/cmds-check.c:3957:10
    #7 0x79b3fb in check_fs_roots /home/matthias/vcs/github/btrfs-progs/cmds-check.c:4098:10
    #8 0x78b850 in cmd_check /home/matthias/vcs/github/btrfs-progs/cmds-check.c:13015:9
    #9 0x4f8dd5 in main /home/matthias/vcs/github/btrfs-progs/btrfs.c:246:8
    #10 0x7f92e6824400 in __libc_start_main /usr/src/debug/glibc-2.24-33-ge9e69e4/csu/../csu/libc-start.c:289

SUMMARY: AddressSanitizer: heap-use-after-free /home/matthias/vcs/github/btrfs-progs/cmds-check.c:2689:29 in repair_inode_backrefs
Shadow bytes around the buggy address:
  0x0c0c7fff8100: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c7fff8110: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c7fff8120: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c7fff8130: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c7fff8140: fd fd fd fa fa fa fa fa 00 00 00 00 00 00 00 fa
=>0x0c0c7fff8150: fa fa fa fa fd fd[fd]fd fd fd fd fa fa fa fa fa
  0x0c0c7fff8160: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c7fff8170: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff81a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==26658==ABORTING
failed: /home/matthias/vcs/github/btrfs-progs/btrfs check --repair ./default_case.img.restored

Feature Request: Snapshot Tree

I am comparing the btrfs snapshot functionality to that offered by XenServer.

I will use the term workspace to refer to a reglar subvolume or a r/w snapshot created from a r/o snapshot. I will use snapshot to refer to a r/o snapshot.

Currently there is no way to represent the evolution of a file system with respect to snapshots. Snapshots are tied to a workspace with the parent_uuid but there is no way to track snapshots between workspaces.

For example consider the following workflow:

  1. Create r/w subvolume (workspace)
  2. Write data to workspace
  3. Create snapshot from workspace
  4. Write data to workspace
  5. Create snapshot from workspace
  6. Write data to workspace
  7. Delete workspace
  8. Create new workspace (r/w snapshot from snapshot in step 5)
  9. Write data to workspace
  10. Create snapshot from workspace

In this example there is nothing connecting the snapshot created in step 3 with the snapshot in step 10

What I am looking for is a tree structure to manifest and update such as:

(ss)
├── (ss)
│   ├── (ws)
│   └── (ws)
└── (ss)
    ├── (ws)
    └── (ss)
        └── (ss)
            └── (ss)

If intermediary snapshots are deleted I would like the remaining snapshots to "re-link" to display the correct relationship.

I am writing something in python to do this but I was hoping to get tighter integration. If any developers can reach out that would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.