Thanks for adding the uuid uniqueness check, that was my major objection for previous patch iterations, http://www.spinics.net/lists/linux-btrfs/msg30572.html we can now use it for convert as well (to generate or copy the uuid). On Wed, May 14, 2014 at 10:35:05AM -0500, Eric Sandeen wrote: > @@ -125,7 +154,19 @@ int make_btrfs(int fd, const char *device, const char *label, > memset(&super, 0, sizeof(super)); > > num_bytes = (num_bytes / sectorsize) * sectorsize; > - uuid_generate(super.fsid); > + if (fs_uuid) { > + if (uuid_parse(fs_uuid, super.fsid) != 0) { > + fprintf(stderr, "could not parse UUID: %s\n", fs_uuid); > + ret = -EINVAL; > + goto out; I think the uuid validity check comes too late, IMHO it should be done after the while/getopt block outside of make_btrfs. At this point eg. the discard or device zeroing is already done. I would not mind to keep the check here as well as a last sanity check, though the number of mkfs_btrfs callers is 1 and the function is not exported to the library. > + } > + if (!test_uuid_unique(fs_uuid)) { > + fprintf(stderr, "non-unique UUID: %s\n", fs_uuid); > + ret = -EBUSY; > + goto out; > + } > + } else > + uuid_generate(super.fsid); > uuid_generate(super.dev_item.uuid); > uuid_generate(chunk_tree_uuid); -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
