[PATCH 00/16] btrfs-progs: recover from failed metadata_uuid
From: Anand Jain <hidden>
Date: 2023-08-14 15:29:35
The kernel reunites split-brained devices after a failed `btrfstune -m|M` operation. We can achieve the same in btrfs-progs. So port it here. Ref the discussion here: https://lore.kernel.org/all/1fa6802b-5812-14a8-3fc8-5da54bb5f79d@oracle.com/ (local) Patch 1/16 wasn't integrated as part of the set [PATCH 00/10 v2] fixes and preparatory related to metadata_uuid it's now merged with this patchset. Patches [2-6,11,12] are cleanup patches. Patches [7,8,10] are preparatory. Patch [9] addresses a bug. Patches [13, 14, 15] provide recovery from previously failed `btrfstune -m|M` operations. Patch [16] enhances the misc-test `034-metadata-uuid` to also validate this new recovery feature. This set has been successfully tested with the btrfs-progs testsuite. This patchset is on top the latest devel last commit: 8aba9b0052b6 btrfs-progs: btrfstune: consolidate error handling in main() Anand Jain (16): btrfs-progs: track num_devices per fs_devices btrfs-progs: tune can use local fs_info variable btrfs-progs: rename set_metadata_uuid arg to new_fsid_str btrfs-progs: rename set_metadata_uuid new_fsid to fsid btrfs-progs: rename set_metadata_uuid new_uuid to new_fsid btrfs-progs: rename set_metadata_uuid uuid_changed to fsid_changed btrfs-progs: pass fsid in check_unfinished_fsid_change arg2 btrfs-progs: pass metadata_uuid in check_unfinished_fsid_change arg3 btrfs-progs: fix return without flag reset commit in tune btrfs-progs: preparing the latest device's superblock for commit btrfs-progs: rename fs_devices::list to match the kernel btrfs-progs: rename fs_devices::latest_trans to match the kernel btrfs-progs: tune use the latest bdev in fs_devices for super_copy btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag btrfs-progs: recover from the failed btrfstune -m|M btrfs-progs: test btrfstune -m|M ability to fix previous failures cmds/filesystem.c | 14 +- common/device-scan.c | 2 +- kernel-shared/disk-io.c | 3 + kernel-shared/disk-io.h | 5 + kernel-shared/volumes.c | 203 +++++++++++++++++++-- kernel-shared/volumes.h | 5 +- tests/misc-tests/034-metadata-uuid/test.sh | 70 +++++-- tune/change-metadata-uuid.c | 56 +++--- tune/main.c | 35 ++-- 9 files changed, 312 insertions(+), 81 deletions(-) -- 2.39.3