btrfs-progs/cmds
Qu Wenruo 9b01db7785 btrfs-progs: rescue/zero-log: Manually write all supers to handle extent tree error more gracefully
[BUG]
Even "btrfs rescue zero-log" only reset btrfs_super_block::log_root and
btrfs_super_block::log_root_level, we still use trasction to write all
super blocks for all devices.

This means we can't handle things like corrupted extent tree:

  checksum verify failed on 2172747776 found 000000B6 wanted 00000000
  checksum verify failed on 2172747776 found 000000B6 wanted 00000000
  bad tree block 2172747776, bytenr mismatch, want=2172747776, have=0
  WARNING: could not setup extent tree, skipping it
  Clearing log on /dev/nvme/btrfs, previous log_root 0, level 0
  ERROR: Corrupted fs, no valid METADATA block group found
  ERROR: attempt to start transaction over already running one

[CAUSE]
Because we have extra check in transaction code to ensure we have valid
METADATA block groups.

In fact we don't really need transaction at all.

[FIX]
Instead of commit transaction, we can just call write_all_supers()
manually, so we can still handle multi-device fs while avoid above
error.

Also, add OPEN_CTREE_NO_BLOCK_GROUPS open ctree flag to make it more
robust.

Link: https://lore.kernel.org/linux-btrfs/CAKbQEqG35D_=8raTFH75-yCYoqH2OvpPEmpj2dxgo+PTc=cfhA@mail.gmail.com/
Reported-by: Christian Pernegger <pernegger@gmail.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:07:21 +01:00
..
balance.c btrfs-progs: balance status: fix usage show long verbose 2019-11-18 19:21:09 +01:00
commands.h btrfs-progs: help: define helper for command with flags 2019-07-03 20:49:04 +02:00
device.c btrfs-progs: utils: split device scanning functions to own file 2019-07-04 02:06:34 +02:00
filesystem-du.c btrfs-progs: fix helpinfo formats, short and options separation 2019-07-03 20:49:04 +02:00
filesystem-usage.c btrfs-progs: fi usage: sort table by device id 2019-11-22 19:07:21 +01:00
filesystem-usage.h btrfs-progs: move all cmds-fi*.c to cmds/ 2019-07-03 20:49:03 +02:00
filesystem.c btrfs-progs: utils: split device scanning functions to own file 2019-07-04 02:06:34 +02:00
inspect-dump-super.c btrfs-progs: add blake2b support 2019-11-18 19:21:06 +01:00
inspect-dump-tree.c btrfs-progs: dump-tree: update help and docs regarding DFS/BFS 2019-10-14 17:27:31 +02:00
inspect-tree-stats.c btrfs-progs: fix helpinfo formats, short and options separation 2019-07-03 20:49:04 +02:00
inspect.c btrfs-progs: fix helpinfo formats, short and options separation 2019-07-03 20:49:04 +02:00
property.c btrfs-progs: props: update help texts 2019-07-26 17:46:42 +02:00
qgroup.c btrfs-progs: qgroups: use parse_size instead of open coding it 2019-10-14 17:27:46 +02:00
quota.c btrfs-progs: move utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
receive.c btrfs-progs: receive: make option quiet work 2019-11-18 19:21:08 +01:00
replace.c btrfs-progs: utils: split device handling functions to own file 2019-07-04 02:06:34 +02:00
rescue-chunk-recover.c btrfs-progs: Replace btrfs_block_group_cache::item with dedicated members 2019-11-18 19:21:09 +01:00
rescue-super-recover.c btrfs-progs: move crc32c implementation to crypto/ 2019-11-18 19:20:02 +01:00
rescue.c btrfs-progs: rescue/zero-log: Manually write all supers to handle extent tree error more gracefully 2019-11-22 19:07:21 +01:00
rescue.h btrfs-progs: move cmds-rescue.c to cmds/ 2019-07-03 20:49:02 +02:00
restore.c btrfs-progs: restore: fix chown of a symlink 2019-07-26 17:46:43 +02:00
scrub.c btrfs-progs: scrub: fix status lines alignment 2019-07-26 17:46:43 +02:00
send.c btrfs-progs: utils: split path related utils to own file 2019-07-04 02:06:31 +02:00
subvolume.c btrfs-progs: utils: split device scanning functions to own file 2019-07-04 02:06:34 +02:00