[CRIU] [PATCH] cg: proc_parse -- Don't compare cgroup paths
Tycho Andersen
tycho.andersen at canonical.com
Mon Sep 15 15:02:44 PDT 2014
Hi Cyrill,
On Tue, Sep 16, 2014 at 12:17:07AM +0400, Cyrill Gorcunov wrote:
> When we compare sets in cg_set_compare() we presume that controller
> names are properly sorted but because of use of strcmp(cc->path, path)
> it's not true. In particular in case if there are two same sets which
> differ in paths only
>
> (00.126812) cg: `- New css ID 2
> (00.127051) cg: `- [memory] -> [/vz-1]
> (00.127079) cg: `- [name=systemd] -> [/vz-1]
> (00.127108) cg: `- [net_cls] -> [/vz-1]
>
> (00.239829) cg: `- New css ID 3
> (00.240067) cg: `- [memory] -> [/vz-1]
> (00.240096) cg: `- [net_cls] -> [/vz-1]
> (00.240154) cg: `- [name=systemd] -> [/vz-1/system.slice/dbus.service]
>
> we currently refuse to dump such configuretion. Thus remove
> path comparision from the first place.
>
> CC: Tycho Andersen <tycho.andersen at canonical.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>
> Tycho, could you please explain why it was done this way in commit
> 51876eea5d8dc147d7e5597f38d242d523cc1bf1? Actually I could be missing
> something obvious?
I think it was an attempt to keep the list sorted by first controller
name and then path (which is obviously wrong :). I think an initial
version of the patch depended on this behavior, but I don't see
anywhere that the final version does, so it should be safe to remove.
Acked-by: Tycho Andersen <tycho.andersen at canonical.com>
Tycho
> proc_parse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/proc_parse.c b/proc_parse.c
> index 39cc543eafd3..e311f40a4f88 100644
> --- a/proc_parse.c
> +++ b/proc_parse.c
> @@ -1729,7 +1729,7 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
> }
>
> list_for_each_entry(cc, retl, l)
> - if (strcmp(cc->name, name) >= 0 && strcmp(cc->path, path) >= 0)
> + if (strcmp(cc->name, name) >= 0)
> break;
>
> list_add_tail(&ncc->l, &cc->l);
> --
> 1.9.3
>
More information about the CRIU
mailing list