From 50f48ad37aad99c54de4db34b07c3825cdedcf41 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 10 Feb 2016 15:44:01 +0100 Subject: cgroup: remove support for NetClass= directive Support for net_cls.class_id through the NetClass= configuration directive has been added in v227 in preparation for a per-unit packet filter mechanism. However, it turns out the kernel people have decided to deprecate the net_cls and net_prio controllers in v2. Tejun provides a comprehensive justification for this in his commit, which has landed during the merge window for kernel v4.5: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=bd1060a1d671 As we're aiming for full support for the v2 cgroup hierarchy, we can no longer support this feature. Userspace tool such as nftables are moving over to setting rules that are specific to the full cgroup path of a task, which obsoletes these controllers anyway. This commit removes support for tweaking details in the net_cls controller, but keeps the NetClass= directive around for legacy compatibility reasons. --- src/core/unit.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src/core/unit.c') diff --git a/src/core/unit.c b/src/core/unit.c index ffefae2b94..d39e3dcaeb 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -458,7 +458,6 @@ static void unit_free_requires_mounts_for(Unit *u) { static void unit_done(Unit *u) { ExecContext *ec; CGroupContext *cc; - int r; assert(u); @@ -475,10 +474,6 @@ static void unit_done(Unit *u) { cc = unit_get_cgroup_context(u); if (cc) cgroup_context_done(cc); - - r = unit_remove_from_netclass_cgroup(u); - if (r < 0) - log_warning_errno(r, "Unable to remove unit from netclass group: %m"); } void unit_free(Unit *u) { @@ -1263,14 +1258,6 @@ int unit_load(Unit *u) { } unit_update_cgroup_members_masks(u); - - /* If we are reloading, we need to wait for the deserializer - * to restore the net_cls ids that have been set previously */ - if (u->manager->n_reloading <= 0) { - r = unit_add_to_netclass_cgroup(u); - if (r < 0) - return r; - } } assert((u->load_state != UNIT_MERGED) == !u->merged_into); @@ -2601,9 +2588,6 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) { unit_serialize_item(u, f, "cgroup", u->cgroup_path); unit_serialize_item(u, f, "cgroup-realized", yes_no(u->cgroup_realized)); - if (u->cgroup_netclass_id) - unit_serialize_item_format(u, f, "netclass-id", "%" PRIu32, u->cgroup_netclass_id); - if (serialize_jobs) { if (u->job) { fprintf(f, "job\n"); @@ -2840,17 +2824,6 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { else u->cgroup_realized = b; - continue; - } else if (streq(l, "netclass-id")) { - r = safe_atou32(v, &u->cgroup_netclass_id); - if (r < 0) - log_unit_debug(u, "Failed to parse netclass ID %s, ignoring.", v); - else { - r = unit_add_to_netclass_cgroup(u); - if (r < 0) - log_unit_debug_errno(u, r, "Failed to add unit to netclass cgroup, ignoring: %m"); - } - continue; } -- cgit v1.2.3-54-g00ecf