@@ -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;
@@ -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 {
@@ -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),
To prepare for reuniting separated devices due to an incomplete fsid change task, consolidate and monitor the per device's changing_fsid flag in the struct btrfs_fs_devices. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- kernel-shared/volumes.c | 9 +++++++++ kernel-shared/volumes.h | 2 ++ tune/change-uuid.c | 4 +--- 3 files changed, 12 insertions(+), 3 deletions(-)