|
|
cb2855 |
From 4557f90ba7c744e5240e6b494f1eb1ef66ae6ea6 Mon Sep 17 00:00:00 2001
|
|
|
cb2855 |
From: Lukas Nykryn <lnykryn@redhat.com>
|
|
|
cb2855 |
Date: Mon, 11 May 2015 13:17:03 +0200
|
|
|
cb2855 |
Subject: [PATCH] cgroup: downgrade log messages when we cannot write to cgroup
|
|
|
cb2855 |
trees that are mounted read-only
|
|
|
cb2855 |
|
|
|
cb2855 |
rhel-only (fixed in upstream differently)
|
|
|
cb2855 |
|
|
|
cb2855 |
Resolves: #1220298
|
|
|
cb2855 |
---
|
|
|
cb2855 |
src/core/cgroup.c | 13 +++++++------
|
|
|
cb2855 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
cb2855 |
|
|
|
cb2855 |
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
|
|
|
cb2855 |
index 5163ee4..71d64a1 100644
|
|
|
cb2855 |
--- a/src/core/cgroup.c
|
|
|
cb2855 |
+++ b/src/core/cgroup.c
|
|
|
cb2855 |
@@ -188,7 +188,7 @@ static int whitelist_device(const char *path, const char *node, const char *acc)
|
|
|
cb2855 |
|
|
|
cb2855 |
r = cg_set_attribute("devices", path, "devices.allow", buf);
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_warning("Failed to set devices.allow on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS, -EINVAL) ? LOG_DEBUG : LOG_WARNING, "Failed to set devices.allow on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
|
|
|
cb2855 |
return r;
|
|
|
cb2855 |
}
|
|
|
cb2855 |
@@ -208,7 +208,8 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
|
|
cb2855 |
sprintf(buf, "%lu\n", c->cpu_shares);
|
|
|
cb2855 |
r = cg_set_attribute("cpu", path, "cpu.shares", buf);
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_warning("Failed to set cpu.shares on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, "Failed to set cpu.shares on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+
|
|
|
cb2855 |
}
|
|
|
cb2855 |
|
|
|
cb2855 |
if (mask & CGROUP_BLKIO) {
|
|
|
cb2855 |
@@ -221,7 +222,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
|
|
cb2855 |
sprintf(buf, "%lu\n", c->blockio_weight);
|
|
|
cb2855 |
r = cg_set_attribute("blkio", path, "blkio.weight", buf);
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_warning("Failed to set blkio.weight on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, "Failed to set blkio.weight on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
|
|
|
cb2855 |
/* FIXME: no way to reset this list */
|
|
|
cb2855 |
LIST_FOREACH(device_weights, w, c->blockio_device_weights) {
|
|
|
cb2855 |
@@ -234,7 +235,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
|
|
cb2855 |
sprintf(buf, "%u:%u %lu", major(dev), minor(dev), w->weight);
|
|
|
cb2855 |
r = cg_set_attribute("blkio", path, "blkio.weight_device", buf);
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_error("Failed to set blkio.weight_device on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, "Failed to set blkio.weight_device on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
}
|
|
|
cb2855 |
|
|
|
cb2855 |
/* FIXME: no way to reset this list */
|
|
|
cb2855 |
@@ -251,7 +252,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
|
|
cb2855 |
sprintf(buf, "%u:%u %" PRIu64 "\n", major(dev), minor(dev), b->bandwidth);
|
|
|
cb2855 |
r = cg_set_attribute("blkio", path, a, buf);
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_error("Failed to set %s on %s: %s", a, path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, "Failed to set %s on %s: %s", a, path, strerror(-r));
|
|
|
cb2855 |
}
|
|
|
cb2855 |
}
|
|
|
cb2855 |
|
|
|
cb2855 |
@@ -265,7 +266,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
|
|
cb2855 |
r = cg_set_attribute("memory", path, "memory.limit_in_bytes", "-1");
|
|
|
cb2855 |
|
|
|
cb2855 |
if (r < 0)
|
|
|
cb2855 |
- log_error("Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
+ log_full(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, "Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
|
|
|
cb2855 |
}
|
|
|
cb2855 |
|
|
|
cb2855 |
if (mask & CGROUP_DEVICE) {
|