]> git.ipfire.org Git - thirdparty/lxc.git/commit
fix multithreaded create()
authorDwight Engen <dwight.engen@oracle.com>
Tue, 12 Nov 2013 19:04:45 +0000 (14:04 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 12 Nov 2013 20:43:31 +0000 (14:43 -0600)
commit6c6892b5c5c6281d1e74c979168d1cbbe6a50ffc
tree739b927a2b310a852650b0b98a25405e7114d424
parentbdb3f44147bc1a55a97131b4b39d42844ae4fb9e
fix multithreaded create()

We were calling save_config() twice within the create() flow, each
from a different process. Depending on order of scheduling, sometimes
the data from the first save_config() (which was just the stuff from
LXC_DEFAULT_CONFIG) would overwrite the config we wanted (the full
config), causing a truncated config file which would then cause lxc
to segfault once it read it back in because no rootfs.path was set.

This fixes it by only calling save_config() once in the create()
flow. A rejected alternative was to call fsync(fileno(fout)) before
the fclose in save_config.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c