The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/857

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) ===
Dirty fix for the current noisiness when lxc_cgroupfs_create() could not create
cgroups.

Signed-off-by: Christian Brauner <christian.brau...@mailbox.org>
From 45b33434eddcaa9cdea931fb2a88158d8d0a5317 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@mailbox.org>
Date: Sat, 27 Feb 2016 17:00:45 +0100
Subject: [PATCH] cgfs: don't try to chown/chmod non-existing paths

Dirty fix for the current noisiness when lxc_cgroupfs_create() could not create
cgroups.

Signed-off-by: Christian Brauner <christian.brau...@mailbox.org>
---
 src/lxc/cgfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lxc/cgfs.c b/src/lxc/cgfs.c
index 16c80eb..22e508d 100644
--- a/src/lxc/cgfs.c
+++ b/src/lxc/cgfs.c
@@ -162,6 +162,9 @@ static int cgroup_rmdir(char *dirname)
        int ret, failed=0;
        char pathname[MAXPATHLEN];
 
+       if (!dir_exists(dirname))
+               return 0;
+
        dir = opendir(dirname);
        if (!dir) {
                ERROR("%s: failed to open %s", __func__, dirname);
@@ -2518,7 +2521,6 @@ static int chown_cgroup_wrapper(void *data)
        uid_t destuid;
        char *fpath;
 
-
        if (setresgid(0,0,0) < 0)
                SYSERROR("Failed to setgid to 0");
        if (setresuid(0,0,0) < 0)
@@ -2536,6 +2538,7 @@ static int chown_cgroup_wrapper(void *data)
        if (chown(fpath, destuid, 0) < 0)
                SYSERROR("Error chowning %s\n", fpath);
        free(fpath);
+
        fpath = lxc_append_paths(arg->cgroup_path, "cgroup.procs");
        if (!fpath)
                return -1;
@@ -2551,6 +2554,9 @@ static bool do_cgfs_chown(char *cgroup_path, struct 
lxc_conf *conf)
        struct chown_data data;
        char *fpath;
 
+       if (!dir_exists(cgroup_path))
+               return true;
+
        if (lxc_list_empty(&conf->id_map))
                /* If there's no mapping then we don't need to chown */
                return true;
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to