Quoting S.Çağlar Onur (cag...@10ur.org):
> From: "S.Çağlar Onur" <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.
> ---
>  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 812bfb8..7212f01 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).
>   */
> @@ -98,29 +103,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};

But here I worry about small stacks.  I suspect Stéphane would see
problems with this on Android.  Stéphane, would this much on the
stack be ok on say the nexus 7, or an android phone?

-serge

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to