diff mbox series

[1/2] btrfs-progs: allow duplicate fsid for single device

Message ID 9a18c9a1dcf857c3e505994d488facda4bcf37f2.1695861950.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: mkfs: testing cloned-device | expand

Commit Message

Anand Jain Sept. 28, 2023, 1:09 a.m. UTC
For single device btrfs filesystem, allow duplicate fsid to be created.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 mkfs/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

David Sterba Oct. 2, 2023, 3:22 p.m. UTC | #1
On Thu, Sep 28, 2023 at 09:09:18AM +0800, Anand Jain wrote:
> For single device btrfs filesystem, allow duplicate fsid to be created.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

As this is trivial I'll add it to devel now, but the other patch needs
updated.
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index 6b38f8079bb4..68ff5d7785d3 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1321,7 +1321,10 @@  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;
 		}