summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-18 10:45:17 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2008-04-18 10:45:17 -0400
commit0e08036ee4292cb230ce3fb8b8c59407faac7747 (patch)
treefe0755f4ff584578b663e96d4b226b98a4e2099a /mkfs.c
parent734603d9272da5a54c5aa0d688a63193e102fc28 (diff)
Add checks to avoid adding the same device twice during mkfs
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mkfs.c b/mkfs.c
index 5631a62b..bb2c58ed 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -430,6 +430,14 @@ int main(int ac, char **av)
fprintf(stderr, "unable to open %s\n", file);
exit(1);
}
+ ret = btrfs_device_already_in_root(root, fd,
+ BTRFS_SUPER_INFO_OFFSET);
+ if (ret) {
+ fprintf(stderr, "skipping duplicate device %s in FS\n",
+ file);
+ close(fd);
+ continue;
+ }
ret = btrfs_prepare_device(fd, file, zero_end,
&dev_block_count);