kdave / btrfs-progs

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

btrfs-convert aborted #312

Open jonashaag opened 3 years ago

jonashaag commented 3 years ago

This is with btrfs-progs master

$ sudo ./btrfs-convert /dev/sdc1
create btrfs filesystem:
    blocksize: 4096
    nodesize:  16384
    features:  extref, skinny-metadata (default)
    checksum:  crc32c
free space report:
    total:     417914159104
    free:      101515264 (0.02%)
creating ext2 image file
Unable to find block group for 0
Unable to find block group for 0
Unable to find block group for 0
kernel-shared/ctree.c:2375: split_leaf: BUG_ON `1` triggered, value 1
./btrfs-convert(+0x29cac)[0x5578d3e9fcac]
./btrfs-convert(+0x2dce3)[0x5578d3ea3ce3]
./btrfs-convert(btrfs_search_slot+0x11d5)[0x5578d3ea57f4]
./btrfs-convert(btrfs_csum_file_block+0x42b)[0x5578d3ec2564]
./btrfs-convert(+0xdf52)[0x5578d3e83f52]
./btrfs-convert(main+0x1cd4)[0x5578d3e86120]
/usr/lib/libc.so.6(__libc_start_main+0xf2)[0x7f738f4d1152]
./btrfs-convert(_start+0x2e)[0x5578d3e83a8e]
Aborted
adam900710 commented 3 years ago
free space report:
    total:     417914159104
    free:      101515264 (0.02%)

Isn't this already showing the problem?

You only have around 100MiB For metadata.

Considering how many data you have already, 400+G, just for csum you will need at least 400+MiB space.

No wonder btrfs_search_slot() fails with -ENOSPC

jonashaag commented 3 years ago

Fair enough, I just reported this because the traceback said BUG. If there isn’t anything to fix here maybe at least the error message could be improved.

jonashaag commented 3 years ago

Also, according to df, I’ve had a lot more space left. Could it be that there was some space used by an earlier conversion attempt (that failed due to a bug in v5.4)?

adam900710 commented 3 years ago

For the BUG_ON we definitely need to make it more graceful.

The space reported by ext* is not directly usable for btrfs. The space btrfs can utilize for its metadata is just a subset of the free space.

One of the main reason of greatly reduced usable space is fragmentation.

Btrfs needs somewhat contig free space for its new chunks, thus if your fs has a lot of free space, but very fragmented, then you can see the result.

Previously convert attempt won't cause anything different.

cmurf commented 3 years ago

Downstream bug with btrfs-progs 5.10.

tomchiverton commented 1 year ago

Kernel bug report with v6.2

https://bugzilla.kernel.org/show_bug.cgi?id=203693