btrfs-progs/convert
Nikolay Borisov 5110ad88cb btrfs-progs: convert: properly work with large ext4 filesystems
On large (blockcount > 32bit) filesystems reading directly
super_block->s_blocks_count is not sufficient as the block count is held
in 2 separate 32 bit variables. Instead always use the provided
ext2fs_blocks_count to read the value. This can result in assertion
failure, when the block count is only held in the high 32 bits, in this
case s_block_counts would be zero, which would result in
btrfs_convert_context::block_count/total_bytes to also be 0 and hit an
assertion failure:

    convert/main.c:1162: do_convert: Assertion `cctx.total_bytes != 0` failed, value 0
    btrfs-convert(+0xffb0)[0x557defdabfb0]
    btrfs-convert(main+0x6c5)[0x557defdaa125]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7f66e1f8bd0a]
    btrfs-convert(_start+0x2a)[0x557defdab52a]
    Aborted

What's worse it can also result in btrfs-convert mistakenly thinking
that a filesystem is smaller than it actually is (ignoring the top 32 bits).

Link: https://lore.kernel.org/linux-btrfs/023b5ca9-0610-231b-fc4e-a72fe1377a5a@jansson.tech/
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-08-16 15:18:11 +02:00
..
Makefile
common.c btrfs-progs: remove the _nr from the item helpers 2022-03-09 15:13:13 +01:00
common.h btrfs-progs: convert: rename context volume_name to label 2021-08-20 14:24:55 +02:00
main.c btrfs-progs: convert: properly work with large ext4 filesystems 2022-08-16 15:18:11 +02:00
source-ext2.c btrfs-progs: convert: properly work with large ext4 filesystems 2022-08-16 15:18:11 +02:00
source-ext2.h btrfs-progs: convert: fix support for e2fsprogs < 1.42 2018-06-07 16:37:35 +02:00
source-fs.c btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
source-fs.h btrfs-progs: convert: new option to copy or specify uuid 2021-08-20 14:24:55 +02:00
source-reiserfs.c btrfs-progs: convert: fix self-reference of directory 2022-06-06 15:48:08 +02:00
source-reiserfs.h