Repository navigation
Expand file tree
/
Copy pathcgroup-prefix-fix.patch
More file actions
59 lines (53 loc) · 2.05 KB
/
Copy pathcgroup-prefix-fix.patch
File metadata and controls
59 lines (53 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a0715925..a31227da 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3387,6 +3387,27 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
spin_unlock_irq(&cgroup_file_kn_lock);
}
+ /*
+ * Droidspaces/LXC: when a hierarchy is mounted with CGRP_ROOT_NOPREFIX the
+ * controller files lose their subsystem prefix (cpuset.cpus becomes cpus,
+ * and so on). runc still opens the prefixed name and dies with
+ * open /sys/fs/cgroup/cpuset/docker/cpuset.cpus: no such file or directory
+ * so expose the prefixed name as an additional symlink to the same file.
+ *
+ * Droidspaces non-GKI patch 02, retargeted to this 4.4 tree: the code lives
+ * in kernel/cgroup.c rather than kernel/cgroup/cgroup.c, and cgroup v1
+ * prefixes with legacy_name rather than name, matching cgroup_file_name().
+ */
+ if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) &&
+ !(cft->flags & CFTYPE_NO_PREFIX)) {
+ char pname[CGROUP_FILE_NAME_MAX];
+
+ snprintf(pname, CGROUP_FILE_NAME_MAX, "%s.%s",
+ cgroup_on_dfl(cgrp) ? cft->ss->name : cft->ss->legacy_name,
+ cft->name);
+ kernfs_create_link(cgrp->kn, pname, kn);
+ }
+
return 0;
}
diff --git a/net/netfilter/xt_qtaguid.c b/net/netfilter/xt_qtaguid.c
index aef139d5..2c740007 100644
--- a/net/netfilter/xt_qtaguid.c
+++ b/net/netfilter/xt_qtaguid.c
@@ -738,7 +738,7 @@ static int iface_stat_fmt_proc_show(struct seq_file *m, void *v)
{
struct proc_iface_stat_fmt_info *p = m->private;
struct iface_stat *iface_entry;
- struct rtnl_link_stats64 dev_stats, *stats;
+ struct rtnl_link_stats64 *stats;
struct rtnl_link_stats64 no_dev_stats = {0};
@@ -747,12 +747,7 @@ static int iface_stat_fmt_proc_show(struct seq_file *m, void *v)
iface_entry = list_entry(v, struct iface_stat, list);
- if (iface_entry->active) {
- stats = dev_get_stats(iface_entry->net_dev,
- &dev_stats);
- } else {
- stats = &no_dev_stats;
- }
+ stats = &no_dev_stats;
/*
* If the meaning of the data changes, then update the fmtX
* string.