提交 8f1f7f47 编写于 作者: Z Zefan Li 提交者: Zheng Zengkai

cgroup: check if cgroup root is alive in cgroupstats_show()

euler inclusion
category: bugfix
bugzilla: 47460
CVE: N/A

-------------------------------------------------

If a cgroup root is dying, show its hierarchy_id and num_cgroups
as 0.
Signed-off-by: NZefan Li <lizefan@huawei.com>
Tested-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NHanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: NChangchun Yu <yuchangchun1@huawei.com>
Reviewed-by: NZefan Li <lizefan@huawei.com>
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NLu Jialin <lujialin4@huawei.com>
Reviewed-by: Nxiu jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d4e8b34c
......@@ -655,6 +655,7 @@ int proc_cgroupstats_show(struct seq_file *m, void *v)
{
struct cgroup_subsys *ss;
int i;
bool dead;
seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n");
/*
......@@ -665,10 +666,13 @@ int proc_cgroupstats_show(struct seq_file *m, void *v)
mutex_lock(&cgroup_mutex);
for_each_subsys(ss, i)
for_each_subsys(ss, i) {
dead = percpu_ref_is_dying(&ss->root->cgrp.self.refcnt);
seq_printf(m, "%s\t%d\t%d\t%d\n",
ss->legacy_name, ss->root->hierarchy_id,
atomic_read(&ss->root->nr_cgrps),
ss->legacy_name, dead ? 0 : ss->root->hierarchy_id,
dead ? 0 : atomic_read(&ss->root->nr_cgrps),
cgroup_ssid_enabled(i));
}
mutex_unlock(&cgroup_mutex);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册