btrfs-progs: tune: fix return without flag reset commit

In the function set_metadata_uuid(), we set the flag
BTRFS_SUPER_FLAG_CHANGING_FSID_V2 in step 1 at line 71 as shown below:

   71         super_flags |= BTRFS_SUPER_FLAG_CHANGING_FSID_V2;
   72         btrfs_set_super_flags(disk_super, super_flags);
   73         ret = btrfs_commit_transaction(trans, root);

However, we fail to reset this flag if there is no change in the fsid on
the incoming disks, as we return too early.

  105       } else {
  106               /* Setting the same fsid as current, do nothing */
  107               return 0;

Fix this by allowing the thread to pass through the step 2, where we
reset the flag.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2023-08-14 23:28:05 +08:00 committed by David Sterba
parent fd3c4c4df1
commit 9f6e0ab2a4
1 changed files with 0 additions and 3 deletions

View File

@ -92,9 +92,6 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
memcpy(disk_super->metadata_uuid, disk_super->fsid,
BTRFS_FSID_SIZE);
memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE);
} else {
/* Setting the same fsid as current, do nothing */
return 0;
}
trans = btrfs_start_transaction(root, 1);