From 1ae1239a0c6cd08ebbdb2c1bdd55af6288e8a46e Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Mon, 21 Sep 2015 17:09:25 +0000 Subject: [PATCH] overlayfs_mount: create delta dir if it doesn't exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit (This *should* fix the lxc-test-snapshot testcase, but doesn't seem to by itself.) If it doesn't exist, we may as well start with an empty one. This is needed when creating an overlayfs snapshot. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- src/lxc/bdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index 124238b8c..46637dd2b 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -2232,6 +2232,10 @@ static int overlayfs_mount(struct bdev *bdev) *upper = '\0'; upper++; + // if delta doesn't yet exist, create it + if (mkdir_p(upper, 0755) < 0 && errno != EEXIST) + return -22; + // overlayfs.v22 or higher needs workdir option // if upper is /var/lib/lxc/c2/delta0, // then workdir is /var/lib/lxc/c2/olwork -- 2.47.2