cgroup: add comment explaining why we ignore EINVAL at two places

These are just copies from further down.
This commit is contained in:
Lennart Poettering 2018-11-20 20:14:59 +01:00
parent 73fe5314bf
commit 8c83840772

View file

@ -431,6 +431,8 @@ static int whitelist_device(BPFProgram *prog, const char *path, const char *node
major(st.st_rdev), minor(st.st_rdev), major(st.st_rdev), minor(st.st_rdev),
acc); acc);
/* Changing the devices list of a populated cgroup might result in EINVAL, hence ignore EINVAL here. */
r = cg_set_attribute("devices", path, "devices.allow", buf); r = cg_set_attribute("devices", path, "devices.allow", buf);
if (r < 0) if (r < 0)
return log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING, return log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING,
@ -517,6 +519,9 @@ static int whitelist_major(BPFProgram *prog, const char *path, const char *name,
maj, maj,
acc); acc);
/* Changing the devices list of a populated cgroup might result in EINVAL, hence ignore EINVAL
* here. */
r = cg_set_attribute("devices", path, "devices.allow", buf); r = cg_set_attribute("devices", path, "devices.allow", buf);
if (r < 0) if (r < 0)
log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING, log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING,
@ -1052,8 +1057,7 @@ static void cgroup_context_apply(
if (r < 0) if (r < 0)
log_unit_warning_errno(u, r, "Failed to initialize device control bpf program: %m"); log_unit_warning_errno(u, r, "Failed to initialize device control bpf program: %m");
} else { } else {
/* Changing the devices list of a populated cgroup /* Changing the devices list of a populated cgroup might result in EINVAL, hence ignore EINVAL
* might result in EINVAL, hence ignore EINVAL
* here. */ * here. */
if (c->device_allow || c->device_policy != CGROUP_AUTO) if (c->device_allow || c->device_policy != CGROUP_AUTO)