diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 9995bac5..6b38e74c 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -342,6 +342,9 @@ static int device_list_add(const char *path, u64 devid = btrfs_stack_device_id(&disk_super->dev_item); bool metadata_uuid = (btrfs_super_incompat_flags(disk_super) & BTRFS_FEATURE_INCOMPAT_METADATA_UUID); + bool changing_fsid = (btrfs_super_flags(disk_super) & + (BTRFS_SUPER_FLAG_CHANGING_FSID | + BTRFS_SUPER_FLAG_CHANGING_FSID_V2)); if (metadata_uuid) fs_devices = find_fsid(disk_super->fsid, @@ -424,6 +427,12 @@ static int device_list_add(const char *path, device->name = name; } + /* + * If changing_fsid the fs_devices will still hold the status from + * the other devices. + */ + if (changing_fsid) + fs_devices->changing_fsid = true; if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 24b52c86..786add2c 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -99,6 +99,8 @@ struct btrfs_fs_devices { struct btrfs_fs_devices *seed; enum btrfs_chunk_allocation_policy chunk_alloc_policy; + + bool changing_fsid; }; struct btrfs_bio_stripe { diff --git a/tune/change-uuid.c b/tune/change-uuid.c index cbfc8634..30cfb145 100644 --- a/tune/change-uuid.c +++ b/tune/change-uuid.c @@ -214,10 +214,8 @@ int check_unfinished_fsid_change(struct btrfs_fs_info *fs_info, uuid_t fsid_ret, uuid_t chunk_id_ret) { struct btrfs_root *tree_root = fs_info->tree_root; - u64 flags = btrfs_super_flags(fs_info->super_copy); - if (flags & (BTRFS_SUPER_FLAG_CHANGING_FSID | - BTRFS_SUPER_FLAG_CHANGING_FSID_V2)) { + if (fs_info->fs_devices->changing_fsid) { memcpy(fsid_ret, fs_info->super_copy->fsid, BTRFS_FSID_SIZE); read_extent_buffer(tree_root->node, chunk_id_ret, btrfs_header_chunk_tree_uuid(tree_root->node),