The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1821
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === So far, we silently skipped over limits that failed to be applied which is very odd. Let's error on when cgroup limits fail to apply. Closes #1815. Signed-off-by: Christian Brauner <[email protected]>
From b3646d7e99abb30c526b1e0be72b7c4a373d3a95 Mon Sep 17 00:00:00 2001 From: Christian Brauner <[email protected]> Date: Tue, 19 Sep 2017 16:24:37 +0200 Subject: [PATCH] cgfsng: fail when limits fail to apply So far, we silently skipped over limits that failed to be applied which is very odd. Let's error on when cgroup limits fail to apply. Closes #1815. Signed-off-by: Christian Brauner <[email protected]> --- src/lxc/cgroups/cgfsng.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index fe3fd7062..ed391a616 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2009,15 +2009,16 @@ static int convert_devpath(const char *invalue, char *dest) */ static int lxc_cgroup_set_data(const char *filename, const char *value, struct cgfsng_handler_data *d) { - char *subsystem = NULL, *p; - int ret = 0; - struct hierarchy *h; + char *fullpath, *p; /* "b|c <2^64-1>:<2^64-1> r|w|m" = 47 chars max */ char converted_value[50]; + struct hierarchy *h; + int ret = 0; + char *controller = NULL; - subsystem = alloca(strlen(filename) + 1); - strcpy(subsystem, filename); - if ((p = strchr(subsystem, '.')) != NULL) + controller = alloca(strlen(filename) + 1); + strcpy(controller, filename); + if ((p = strchr(controller, '.')) != NULL) *p = '\0'; if (strcmp("devices.allow", filename) == 0 && value[0] == '/') { @@ -2028,12 +2029,18 @@ static int lxc_cgroup_set_data(const char *filename, const char *value, struct c } - h = get_hierarchy(subsystem); - if (h) { - char *fullpath = must_make_path(h->fullcgpath, filename, NULL); - ret = lxc_write_to_file(fullpath, value, strlen(value), false); - free(fullpath); + h = get_hierarchy(controller); + if (!h) { + ERROR("Failed to setup limits for the \"%s\" controller. " + "The controller seems to be unused by \"cgfsng\" cgroup " + "driver or not enabled on the cgroup hierarchy", + controller); + return -1; } + + fullpath = must_make_path(h->fullcgpath, filename, NULL); + ret = lxc_write_to_file(fullpath, value, strlen(value), false); + free(fullpath); return ret; }
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
