btrfs-progs/check
Qu Wenruo 9bded24a46 btrfs-progs: do not use btrfs_commit_transaction() just to update super blocks
There are several call sites utilizing btrfs_commit_transaction() just
to update members in super blocks, without any metadata update.

This can be problematic for some simple call sites, like zero_log_tree()
or check_and_repair_super_num_devs().

If we have big problems preventing the fs to be mounted in the first
place, and need to clear the log or super block size, but by some other
problems in extent tree, we're unable to allocate new blocks.

Then we fall into a deadlock that, we need to mount (even
ro,rescue=all) to collect extra info, but btrfs-progs can not do any
super block updates.

Fix the problem by allowing the following super blocks only operations
to be done without using btrfs_commit_transaction():

- btrfs_fix_super_size()
- check_and_repair_super_num_devs()
- zero_log_tree().

There are some exceptions in btrfstune.c, related to the csum type
conversion and seed flags.

In those btrfstune cases, we in fact wants to proper error report in
btrfs_commit_transaction(), as those operations are not mount critical,
and any early error can be helpful to expose any problems in the fs.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-05-20 15:54:16 +02:00
..
common.h btrfs-progs: check: detect and fix invalid used for block groups 2021-08-25 15:38:54 +02:00
main.c btrfs-progs: do not use btrfs_commit_transaction() just to update super blocks 2022-05-20 15:54:16 +02:00
mode-common.c btrfs-progs: do not use btrfs_commit_transaction() just to update super blocks 2022-05-20 15:54:16 +02:00
mode-common.h btrfs-progs: check: add check and repair ability for super num devs mismatch 2022-03-24 00:36:13 +01:00
mode-lowmem.c btrfs-progs: check: lowmem, fix path leak when dev extents are invalid 2022-05-17 21:12:19 +02:00
mode-lowmem.h btrfs-progs: check btrfs_super_used in lowmem check 2021-08-25 15:38:54 +02:00
mode-original.h btrfs-progs: check: add check for overlong xattr names 2022-04-25 18:52:49 +02:00
qgroup-verify.c btrfs-progs: check: fix two error messages used in qgroup verification 2022-03-23 18:18:31 +01:00
qgroup-verify.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00