[lxc-users] overlayfs error after upgrade to vivid

Serge Hallyn serge.hallyn at ubuntu.com
Fri May 1 13:34:52 UTC 2015


Quoting KATOH Yasufumi (karma at jazz.email.ne.jp):
> >>> On Fri, 1 May 2015 10:15:41 +0000
>     in message   "Re: [lxc-users] overlayfs error after upgrade to vivid"
>                   Serge Hallyn-san wrote:
> 
> > D'oh.  Confirmed.  To work around this, please do
> 
> > sudo mkdir /var/lib/lxc/ro_nginx/olwork
> 
> > lxc should obvoiusly do this on its own.  I hadn't noticed because normally
> > lxc-create does it, but you have a preexisting container.
> 
> Oh... I had not noticed too...
> 
> We should mkdir in overlayfs_mount() if it doesn't exist.

Yeah, something like

>From 31050b47e9feb0c4bc763c7e7497f4edf694dee5 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Fri, 1 May 2015 14:56:33 +0200
Subject: [PATCH 1/1] overlay: create workdir if it doesn't exist

Otherwise a container created before we needed workdir will fail
to start after a kernel+lxc update.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/bdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
index cf7c043..873392a 100644
--- a/src/lxc/bdev.c
+++ b/src/lxc/bdev.c
@@ -2210,6 +2210,11 @@ static int overlayfs_mount(struct bdev *bdev)
 		return -22;
 	}
 
+	if (mkdir_p(work, 0755) < 0 && errno != EEXIST) {
+		free(mntdata);
+		return -22
+	}
+
 	// TODO We should check whether bdev->src is a blockdev, and if so
 	// but for now, only support overlays of a basic directory
 
-- 
2.1.4



More information about the lxc-users mailing list