[libvirt] [PATCH] Fix cgroups when all are mounted on /sys/fs/cgroup

Eric Blake eblake at redhat.com
Tue Sep 10 17:28:30 UTC 2013


On 09/10/2013 07:35 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Some users in Ubuntu/Debian seem to have a setup where all the
> cgroup controllers are mounted on /sys/fs/cgroup rather than
> any /sys/fs/cgroup/<controller> name. In the loop which detects
> which controllers are present for a mount point we were modifying
> 'mnt_dir' field in the 'struct mntent' var, but not always restoring
> the original value. This caused detection to break in the all-in-one
> mount setup.
> 
> Fix that logic bug and add test case coverage for this mount
> setup.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/util/vircgroup.c  |  3 ++-
>  tests/vircgroupmock.c | 42 ++++++++++++++++++++++++++++++++++++---
>  tests/vircgrouptest.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 96 insertions(+), 4 deletions(-)
> 

> @@ -398,7 +431,10 @@ FILE *fopen(const char *path, const char *mode)
>      }
>      if (STREQ(path, "/proc/self/cgroup")) {
>          if (STREQ(mode, "r")) {
> -            return fmemopen((void *)procselfcgroups, strlen(procselfcgroups), mode);
> +            if (allinone)
> +                return fmemopen((void *)procselfcgroupsallinone, strlen(procselfcgroupsallinone), mode);

Maybe worth wrapping to avoid long lines; but that's trivial.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130910/ee97a6bc/attachment-0001.sig>


More information about the libvir-list mailing list