mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-27 00:22:22 +00:00
btrfs-progs: track active metadata_uuid per fs_devices
When the fsid does not match the metadata_uuid, the METADATA_UUID flag is set in the superblock. Changing the fsid using the btrfstune -U|-u option is not possible on a filesystem with the METADATA_UUID flag set. But we are checking the METADATA_UUID only from the super_copy, and not from the other scanned device. To fix this bug, track the metadata_uuid at the fs_devices level instead of checking it only on the specified device in the argument, and use it. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
26f25402ff
commit
9ce233965f
@ -434,6 +434,8 @@ static int device_list_add(const char *path,
|
||||
*/
|
||||
if (changing_fsid)
|
||||
fs_devices->changing_fsid = true;
|
||||
if (metadata_uuid)
|
||||
fs_devices->active_metadata_uuid = true;
|
||||
|
||||
if (found_transid > fs_devices->latest_trans) {
|
||||
fs_devices->latest_devid = devid;
|
||||
|
@ -102,6 +102,7 @@ struct btrfs_fs_devices {
|
||||
enum btrfs_chunk_allocation_policy chunk_alloc_policy;
|
||||
|
||||
bool changing_fsid;
|
||||
bool active_metadata_uuid;
|
||||
};
|
||||
|
||||
struct btrfs_bio_stripe {
|
||||
|
@ -414,7 +414,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (random_fsid || (new_fsid_str && !change_metadata_uuid)) {
|
||||
if (btrfs_fs_incompat(root->fs_info, METADATA_UUID)) {
|
||||
if (root->fs_info->fs_devices->active_metadata_uuid) {
|
||||
error(
|
||||
"Cannot rewrite fsid while METADATA_UUID flag is active. \n"
|
||||
"Ensure fsid and metadata_uuid match before retrying.");
|
||||
|
Loading…
Reference in New Issue
Block a user