• Seth Forshee's avatar
    UBUNTU: SAUCE: cgroup: Use a new super block when mounting in a cgroup namespace · 794fbce4
    Seth Forshee authored
    BugLink: http://bugs.launchpad.net/bugs/1566505
    
    Currently a new mount of an existing hierarchy always reuses the
    original super block, even when the new mount is in a cgroup
    namespace. This sometimes conflicts with the user namespace mount
    support, which requires a new mount of an existing super block to
    be in the same user namespace as the original mount. When
    mounting from non-init cgroup and user namespaces sget() will
    fail.
    
    To fix this we can pass a pointer to the cgroup ns to kernfs when
    mounting, causing kernfs_test_super() to no longer match super
    blocks from different cgroup namespaces.
    
    However we do wish to continue sharing the cgroup_root between
    mounts of the same heirarchy. The cgroup_root's lifetime is
    governed by the reference count of its cgrp member, but this is
    a percpu reference count and is not well suited to this new
    situation. Instead a new reference count is added to the
    cgroup_root structure to track the number of super blocks sharing
    that root, and this refcnt is used to determine when to put the
    cgroup reference.
    Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
    Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
    794fbce4
cgroup-defs.h 16 KB