btrfs-progs: allow duplicate fsid for single device filesystems

For single device btrfs filesystem, allow duplicate fsid to be created.
This should be used with caution as more devices with the same uuid
could be confused with each other.

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-09-28 09:09:18 +08:00 committed by David Sterba
parent 93e8b661f6
commit ff4c4a3a00

View file

@ -1265,7 +1265,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
error("could not parse UUID: %s", fs_uuid);
goto error;
}
if (!test_uuid_unique(fs_uuid)) {
/* We allow non-unique fsid for single device btrfs filesystem. */
if (device_count != 1 && !test_uuid_unique(fs_uuid)) {
error("non-unique UUID: %s", fs_uuid);
goto error;
}