[Devel] [PATCH RHEL7 COMMIT] fairsched: fix output of /proc/fairsched[2]
Konstantin Khorenko
khorenko at virtuozzo.com
Fri May 29 03:53:03 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.7
------>
commit 7b768085e56d53826162aef58ace5f58adc1b4c9
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Fri May 29 14:53:03 2015 +0400
fairsched: fix output of /proc/fairsched[2]
It must never show UUID-named containers there, but currently it will if
UUID, and therefore cpu cgroup name, starts with a digit. This is due to
the way sscanf called by legacy_veid_to_name, which is used for
converting cpu cgroup names to fairsched ids, works.
Fix this by using kstrtoul for parsing fairsched ids from cgroup name.
https://jira.sw.ru/browse/PSBM-33806
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
kernel/fairsched.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/kernel/fairsched.c b/kernel/fairsched.c
index 412afed..3879f8e 100644
--- a/kernel/fairsched.c
+++ b/kernel/fairsched.c
@@ -32,6 +32,16 @@ static struct fairsched_node root_node = {NULL, NULL};
#define fairsched_id(id) (id == FAIRSCHED_HOST_NODE ? 0 : id)
+static int fairsched_id_parse(const char *s)
+{
+ unsigned long id;
+
+ if (kstrtoul(s, 10, &id))
+ return -1;
+
+ return id ?: FAIRSCHED_HOST_NODE;
+}
+
static int fairsched_open(struct fairsched_node *node, int id)
{
envid_t veid = fairsched_id(id);
@@ -467,7 +477,8 @@ static struct fairsched_dump *fairsched_do_dump(int compat)
if (d_unhashed(dentry) || !dentry->d_inode ||
!S_ISDIR(dentry->d_inode->i_mode))
continue;
- if (legacy_name_to_veid(dentry->d_name.name, &id) < 0)
+ id = fairsched_id_parse(dentry->d_name.name);
+ if (id < 0)
continue;
if (!ve_is_super(ve) &&
strcmp(ve_name(ve), dentry->d_name.name))
More information about the Devel
mailing list