]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
overlayfs_mount: create delta dir if it doesn't exist
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 21 Sep 2015 17:09:25 +0000 (17:09 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 21 Sep 2015 20:47:35 +0000 (16:47 -0400)
(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 <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/bdev.c

index 124238b8cec10909c212a820cf4228dfbecd5a6d..46637dd2b3adeed961b457f861600e1dc95c61a0 100644 (file)
@@ -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