From: Andrew Morton Cc: "Eric W. Biederman" Cc: "Serge E. Hallyn" Cc: Balbir Singh Cc: Dave Hansen Cc: Herbert Poetzl Cc: Kirill Korotaev Cc: Paul Jackson Cc: Paul Menage Cc: Srivatsa Vaddagiri Signed-off-by: Andrew Morton --- include/linux/container.h | 2 ++ kernel/container.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff -puN include/linux/container.h~containersv10-add-procfs-interface-fix include/linux/container.h --- a/include/linux/container.h~containersv10-add-procfs-interface-fix +++ a/include/linux/container.h @@ -28,6 +28,8 @@ extern void container_fork(struct task_s extern void container_fork_callbacks(struct task_struct *p); extern void container_exit(struct task_struct *p, int run_callbacks); +extern struct file_operations proc_container_operations; + /* Per-subsystem/per-container state maintained by the system. */ struct container_subsys_state { /* The container that this subsystem is attached to. Useful diff -puN kernel/container.c~containersv10-add-procfs-interface-fix kernel/container.c --- a/kernel/container.c~containersv10-add-procfs-interface-fix +++ a/kernel/container.c @@ -246,7 +246,7 @@ static int container_mkdir(struct inode static int container_rmdir(struct inode *unused_dir, struct dentry *dentry); static int container_populate_dir(struct container *cont); static struct inode_operations container_dir_inode_operations; -struct file_operations proc_containerstats_operations; +static struct file_operations proc_containerstats_operations; static struct inode *container_new_inode(mode_t mode, struct super_block *sb) { @@ -1556,11 +1556,12 @@ static int proc_container_show(struct se struct container *cont; int subsys_id; int count = 0; + /* Skip this hierarchy if it has no active subsystems */ - if (!root->subsys_bits) continue; - for_each_subsys(root, ss) { + if (!root->subsys_bits) + continue; + for_each_subsys(root, ss) seq_printf(m, "%s%s", count++ ? "," : "", ss->name); - } seq_putc(m, ':'); get_first_subsys(&root->top_container, NULL, &subsys_id); cont = task_container(tsk, subsys_id); @@ -1598,6 +1599,7 @@ static int proc_containerstats_show(stru { int i; struct containerfs_root *root; + mutex_lock(&container_mutex); seq_puts(m, "Hierarchies:\n"); for_each_root(root) { @@ -1631,12 +1633,13 @@ static int containerstats_open(struct in return single_open(file, proc_containerstats_show, 0); } -struct file_operations proc_containerstats_operations = { +static struct file_operations proc_containerstats_operations = { .open = containerstats_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; + /** * container_fork - attach newly forked task to its parents container. * @tsk: pointer to task_struct of forking parent process. _