[lxc-devel] [PATCH 1/2] lxc-start: ensure overlayfs workdir exists
    Marcin Bachry 
    hegel666 at gmail.com
       
    Sun May  3 21:46:29 UTC 2015
    
    
  
New versions of overlayfs require "workdir" mount option. LXC silently
infers workdir path from upper directory provided by user in the
config, but makes no effort to ensure the directory actually
exists.
Signed-off-by: Marcin Bachry <hegel666 at gmail.com>
---
 src/lxc/bdev.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
index cf7c043..abc75f8 100644
--- a/src/lxc/bdev.c
+++ b/src/lxc/bdev.c
@@ -2204,6 +2204,10 @@ static int overlayfs_mount(struct bdev *bdev)
 	work = alloca(lastslashidx + 7);
 	strncpy(work, upper, lastslashidx+7);
 	strcpy(work+lastslashidx, "olwork");
+	if ((mkdir(work, 0755) < 0) && errno != EEXIST) {
+		SYSERROR("error: mkdir %s", work);
+		return -22;
+	}
 
 	if (parse_mntopts(bdev->mntopts, &mntflags, &mntdata) < 0) {
 		free(mntdata);
-- 
2.1.4
    
    
More information about the lxc-devel
mailing list