diff mbox series

[13/16] btrfs-progs: tune use the latest bdev in fs_devices for super_copy

Message ID 909e4475e288ce2a559d4cd7bf5a9d84206c3f36.1692018849.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: recover from failed metadata_uuid | expand

Commit Message

Anand Jain Aug. 14, 2023, 3:28 p.m. UTC
btrfstune relies on the superblock of the device specified in the
btrfstune argument for fs_info::super_copy. Instead, should use
fs_devices::latest_bdev.

To support for reuniting devices following past failures of
btrfstune -m|M|u|U as in the following patch, use
fs_devices::latest_bdev.

 btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag
 btrfs-progs: recover from the failed btrfstune -m|M

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tune/main.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/tune/main.c b/tune/main.c
index e3b199c10dad..e47047450b24 100644
--- a/tune/main.c
+++ b/tune/main.c
@@ -290,6 +290,9 @@  int BOX_MAIN(btrfstune)(int argc, char *argv[])
 		goto free_out;
 	}
 
+	if (change_metadata_uuid || random_fsid || new_fsid_str)
+		ctree_flags |= OPEN_CTREE_USE_LATEST_BDEV;
+
 	root = open_ctree_fd(fd, device, 0, ctree_flags);
 
 	if (!root) {