RFC: Fix cgroup_find_parent function
RFC: Fix cgroup_find_parent function

There are more issues with cgroup_find_parent function:

1.
The cgroup_find_parent expects, that it's argument is group in
cg_mount_table[0] controller, which is not always the case.

IMHO the function should accept complete struct cgroup and find real parent.

2.
when checking the st_dev of the group and it's parent to prevent
"underflow" to real filesystem, actually the parent and it's parent are
checked instead of group and it's parent.

In addition, I enhanced the function to return real error code when something
goes wrong.

Open question is, if the function should return just char* as parent's
name or whole struct cgroup*. The second case is more natural - we should
work with groups and not group names, but in some cases just the name is
needed and whole cgroup creation would be unnecessary overhead (I have
prepared cgcdelete tool, which needs just parent's name).

Signed-off-by: Jan Safranek <a7f4b96ffdd515ecef00f117294da18555749b0b@redhat.com>
Signed-off-by: Dhaval Giani <9e8a88f272eaf8af1eb7757146d1fb3d7f128182@linux.vnet.ibm.com>

rafalmiel/libcg,rafalmiel/libcg,rafalmiel/libcg,jrfastab/Linux-cgdcbxd,rafalmiel/libcg,jrfastab/Linux-cgdcbxd,jrfastab/Linux-cgdcbxd,jrfastab/Linux-cgdcbxd