Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 0c3b80f

Browse files
committed
xfs needs nouuid mount option
Otherwise devicemapper/rbd mount might fail due to device UUID conflicts on snapshot/clone devices. Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent 4f5b747 commit 0c3b80f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/container.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static int container_setup_volume(struct hyper_container *container)
5757
for (i = 0; i < container->vols_num; i++) {
5858
char volume[512];
5959
char mountpoint[512];
60+
char *options = NULL;
6061
vol = &container->vols[i];
6162

6263
if (vol->scsiaddr)
@@ -75,7 +76,10 @@ static int container_setup_volume(struct hyper_container *container)
7576
return -1;
7677
}
7778

78-
if (mount(dev, path, vol->fstype, 0, NULL) < 0) {
79+
if (!strncmp(vol->fstype, "xfs", strlen("xfs")))
80+
options = "nouuid";
81+
82+
if (mount(dev, path, vol->fstype, 0, options) < 0) {
7983
perror("mount volume device faled");
8084
return -1;
8185
}
@@ -467,14 +471,18 @@ static int hyper_container_init(void *data)
467471

468472
if (container->fstype) {
469473
char dev[128];
474+
char *options = NULL;
470475

471476
if (container->scsiaddr)
472477
hyper_find_sd(container->scsiaddr, &container->image);
473478

474479
sprintf(dev, "/dev/%s", container->image);
475480
fprintf(stdout, "device %s\n", dev);
476481

477-
if (mount(dev, root, container->fstype, 0, NULL) < 0) {
482+
if (!strncmp(container->fstype, "xfs", strlen("xfs")))
483+
options = "nouuid";
484+
485+
if (mount(dev, root, container->fstype, 0, options) < 0) {
478486
perror("mount device failed");
479487
goto fail;
480488
}

0 commit comments

Comments
 (0)