On 04/23/2013 05:29 AM, S.Çağlar Onur wrote: > Hey Stéphane, > > On Wed, Apr 17, 2013 at 6:06 PM, Serge Hallyn <serge.hal...@ubuntu.com > <mailto:serge.hal...@ubuntu.com>> wrote: > > Quoting S.Çağlar Onur (cag...@10ur.org <mailto:cag...@10ur.org>): > > From: "S.Çağlar Onur" <cag...@10ur.org <mailto:cag...@10ur.org>> > > > > Trying to stop multiple containers concurrently ends up with > "cgroup is not mounted" errors as multiple threads corrupts the > shared variables. > > Fix that stack corruption and start to use getmntent_r to support > stopping multiple containers concurrently. > > > > Signed-off-by: S.Çağlar Onur <cag...@10ur.org > <mailto:cag...@10ur.org>> > > --- > > src/lxc/cgroup.c | 152 > +++++++++++++++++++++++++++++++++++------------------ > > src/lxc/freezer.c | 18 +++++-- > > src/lxc/state.c | 15 ++++-- > > 3 files changed, 126 insertions(+), 59 deletions(-) > > > > diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c > > index 368214f..0739477 100644 > > --- a/src/lxc/cgroup.c > > +++ b/src/lxc/cgroup.c > > @@ -54,6 +54,11 @@ lxc_log_define(lxc_cgroup, lxc); > > > > #define MTAB "/proc/mounts" > > > > +/* In the case of a bind mount, there could be two long pathnames > in the > > + * mntent plus options so use large enough buffer size > > + */ > > +#define LARGE_MAXPATHLEN 4 * MAXPATHLEN > > + > > /* Check if a mount is a cgroup hierarchy for any subsystem. > > * Return the first subsystem found (or NULL if none). > > */ > > @@ -100,29 +105,31 @@ static char *mount_has_subsystem(const > struct mntent *mntent) > > */ > > static int get_cgroup_mount(const char *subsystem, char *mnt) > > { > > - struct mntent *mntent; > > + struct mntent *mntent, mntent_r; > > FILE *file = NULL; > > int ret, err = -1; > > > > + char buf[LARGE_MAXPATHLEN] = {0}; > > Ah yes, this must be what I thought we were waiting on - a response > from Stéphane on this. > > I'm still worried about this stack usage, especially in something > which is rather commonly called. Stéphane, is this a non-issue > for arm?
So I had a quick look on an Android device. The stack size is the same as a desktop machine (8192KB), so the 16KB used by that variable won't be a problem. > > > Have you had a chance to look at that? Should I keep them like this or > start to allocate them via calloc? > > > -serge > > > > Cheers, > -- > S.Çağlar Onur <cag...@10ur.org <mailto:cag...@10ur.org>> -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel