Allow fake Delegate= setting on slices
This commit is contained in:
parent
b05aec5ee0
commit
bb3fb8bc57
58
0990-Allow-Delegate-to-be-set-on-transient-units.patch
Normal file
58
0990-Allow-Delegate-to-be-set-on-transient-units.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 19da3fec80d3e30191be11f6dc7305f6c82e5254 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 18 Apr 2018 18:48:55 +0200
|
||||
Subject: [PATCH] Allow Delegate= to be set on transient units
|
||||
|
||||
---
|
||||
src/core/dbus-cgroup.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
|
||||
index d77f96fdb3..489112087f 100644
|
||||
--- a/src/core/dbus-cgroup.c
|
||||
+++ b/src/core/dbus-cgroup.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "path-util.h"
|
||||
+#include "unit.h"
|
||||
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy);
|
||||
|
||||
@@ -351,13 +352,13 @@ static int bus_cgroup_set_transient_property(
|
||||
if (streq(name, "Delegate")) {
|
||||
int b;
|
||||
|
||||
- if (!UNIT_VTABLE(u)->can_delegate)
|
||||
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type");
|
||||
-
|
||||
r = sd_bus_message_read(message, "b", &b);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ if (!UNIT_VTABLE(u)->can_delegate && b)
|
||||
+ log_unit_notice(u, "Delegate=yes set, but has no effect for unit type");
|
||||
+
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
c->delegate = b;
|
||||
c->delegate_controllers = b ? _CGROUP_MASK_ALL : 0;
|
||||
@@ -370,9 +371,6 @@ static int bus_cgroup_set_transient_property(
|
||||
} else if (streq(name, "DelegateControllers")) {
|
||||
CGroupMask mask = 0;
|
||||
|
||||
- if (!UNIT_VTABLE(u)->can_delegate)
|
||||
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Delegation not available for unit type");
|
||||
-
|
||||
r = sd_bus_message_enter_container(message, 'a', "s");
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -414,6 +412,9 @@ static int bus_cgroup_set_transient_property(
|
||||
unit_write_settingf(u, flags, name, "Delegate=%s", strempty(t));
|
||||
}
|
||||
|
||||
+ if (!UNIT_VTABLE(u)->can_delegate && c->delegate)
|
||||
+ log_unit_notice(u, "Delegate=yes set, but has no effect for unit type");
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 8eede524d4ec1806554982b67ccfc155fbeb272a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 18 Apr 2018 19:50:07 +0200
|
||||
Subject: [PATCH] core: fix resetting of Delegate= and properly ignore invalid
|
||||
assignment
|
||||
|
||||
The default is false not true. If we say "ignoring" we must return 0.
|
||||
|
||||
(cherry picked from commit ff1b8455c26b560641d476b426209e297209333a)
|
||||
---
|
||||
src/core/load-fragment.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
|
||||
index 5b30c47e83..f1b9b65d1a 100644
|
||||
--- a/src/core/load-fragment.c
|
||||
+++ b/src/core/load-fragment.c
|
||||
@@ -3440,7 +3440,7 @@ int config_parse_delegate(
|
||||
* mask to delegate. */
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
- c->delegate = true;
|
||||
+ c->delegate = false;
|
||||
c->delegate_controllers = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -3461,7 +3461,7 @@ int config_parse_delegate(
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
||||
- return r;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
cc = cgroup_controller_from_string(word);
|
@ -13,7 +13,7 @@
|
||||
Name: systemd
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
Version: 238
|
||||
Release: 7%{?gitcommit:.git%{gitcommitshort}}%{?dist}
|
||||
Release: 7%{?gitcommit:.git%{gitcommitshort}}%{?dist}.1
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
@ -54,6 +54,8 @@ Patch0003: 0003-core-when-reloading-delay-any-actions-on-journal-and.patch
|
||||
Patch0004: 0004-udev-net-id-Fix-check-for-address-to-keep-interface-.patch
|
||||
Patch0005: 0005-core-don-t-include-libmount.h-in-a-header-file-8580.patch
|
||||
|
||||
Patch0990: 0990-Allow-Delegate-to-be-set-on-transient-units.patch
|
||||
Patch0991: 0991-core-fix-resetting-of-Delegate-and-properly-ignore-i.patch
|
||||
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
|
||||
|
||||
%global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);}
|
||||
@ -707,6 +709,9 @@ fi
|
||||
%files tests -f .file-list-tests
|
||||
|
||||
%changelog
|
||||
* Wed Apr 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 238-7.fc28.1
|
||||
- Allow fake Delegate= setting on slices (#1568594)
|
||||
|
||||
* Wed Mar 28 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 238-7
|
||||
- Move udev transfiletriggers to the right package, fix quoting
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user