btrfs-progs: tune: use the latest bdev in fs_devices for super_copy
Currently, btrfstune relies on the superblock of the device specified in the btrfstune argument for fs_info::super_copy. However, it should use fs_devices::latest_bdev, as it points to the device with the highest fs_devices::generation number. This will contain the superblock updates that other devices may have missed and we can now support reuniting devices following failures of btrfstune -m|M|u|U as in the patches: 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> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
fe7bcc5d7b
commit
dd718e9f6f
|
@ -355,6 +355,14 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
|
||||||
goto free_out;
|
goto free_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For fsid changes we must use the latest device (not necessarily the
|
||||||
|
* one specified on command line so the matching of the device
|
||||||
|
* belonging to the filesystem works.
|
||||||
|
*/
|
||||||
|
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);
|
root = open_ctree_fd(fd, device, 0, ctree_flags);
|
||||||
|
|
||||||
if (!root) {
|
if (!root) {
|
||||||
|
|
Loading…
Reference in New Issue