Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-4.6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fixes from Tejun Heo:
"During v4.6-rc1 cgroup namespace support was merged. There is an
issue where it's impossible to tell whether a given cgroup mount point
is bind mounted or namespaced. Serge has been working on the issue
but it took longer than expected to resolve, so the late pull request.

Given that it's a completely new feature and the patches don't touch
anything else, the risk seems acceptable. However, if this is too
late, an alternative is plugging new cgroup ns creation for v4.6 and
retrying for v4.7"

* 'for-4.6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: fix compile warning
kernfs: kernfs_sop_show_path: don't return 0 after seq_dentry call
cgroup, kernfs: make mountinfo show properly scoped path for cgroup namespaces
kernfs_path_from_node_locked: don't overwrite nlen

+83 -3
+3 -3
fs/kernfs/dir.c
··· 153 153 p = buf + len + nlen; 154 154 *p = '\0'; 155 155 for (kn = kn_to; kn != common; kn = kn->parent) { 156 - nlen = strlen(kn->name); 157 - p -= nlen; 158 - memcpy(p, kn->name, nlen); 156 + size_t tmp = strlen(kn->name); 157 + p -= tmp; 158 + memcpy(p, kn->name, tmp); 159 159 *(--p) = '/'; 160 160 } 161 161
+15
fs/kernfs/mount.c
··· 15 15 #include <linux/slab.h> 16 16 #include <linux/pagemap.h> 17 17 #include <linux/namei.h> 18 + #include <linux/seq_file.h> 18 19 19 20 #include "kernfs-internal.h" 20 21 ··· 41 40 return 0; 42 41 } 43 42 43 + static int kernfs_sop_show_path(struct seq_file *sf, struct dentry *dentry) 44 + { 45 + struct kernfs_node *node = dentry->d_fsdata; 46 + struct kernfs_root *root = kernfs_root(node); 47 + struct kernfs_syscall_ops *scops = root->syscall_ops; 48 + 49 + if (scops && scops->show_path) 50 + return scops->show_path(sf, node, root); 51 + 52 + seq_dentry(sf, dentry, " \t\n\\"); 53 + return 0; 54 + } 55 + 44 56 const struct super_operations kernfs_sops = { 45 57 .statfs = simple_statfs, 46 58 .drop_inode = generic_delete_inode, ··· 61 47 62 48 .remount_fs = kernfs_sop_remount_fs, 63 49 .show_options = kernfs_sop_show_options, 50 + .show_path = kernfs_sop_show_path, 64 51 }; 65 52 66 53 /**
+2
include/linux/kernfs.h
··· 152 152 int (*rmdir)(struct kernfs_node *kn); 153 153 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent, 154 154 const char *new_name); 155 + int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, 156 + struct kernfs_root *root); 155 157 }; 156 158 157 159 struct kernfs_root {
+63
kernel/cgroup.c
··· 1215 1215 cgroup_free_root(root); 1216 1216 } 1217 1217 1218 + /* 1219 + * look up cgroup associated with current task's cgroup namespace on the 1220 + * specified hierarchy 1221 + */ 1222 + static struct cgroup * 1223 + current_cgns_cgroup_from_root(struct cgroup_root *root) 1224 + { 1225 + struct cgroup *res = NULL; 1226 + struct css_set *cset; 1227 + 1228 + lockdep_assert_held(&css_set_lock); 1229 + 1230 + rcu_read_lock(); 1231 + 1232 + cset = current->nsproxy->cgroup_ns->root_cset; 1233 + if (cset == &init_css_set) { 1234 + res = &root->cgrp; 1235 + } else { 1236 + struct cgrp_cset_link *link; 1237 + 1238 + list_for_each_entry(link, &cset->cgrp_links, cgrp_link) { 1239 + struct cgroup *c = link->cgrp; 1240 + 1241 + if (c->root == root) { 1242 + res = c; 1243 + break; 1244 + } 1245 + } 1246 + } 1247 + rcu_read_unlock(); 1248 + 1249 + BUG_ON(!res); 1250 + return res; 1251 + } 1252 + 1218 1253 /* look up cgroup associated with given css_set on the specified hierarchy */ 1219 1254 static struct cgroup *cset_cgroup_from_root(struct css_set *cset, 1220 1255 struct cgroup_root *root) ··· 1626 1591 1627 1592 kernfs_activate(dcgrp->kn); 1628 1593 return 0; 1594 + } 1595 + 1596 + static int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, 1597 + struct kernfs_root *kf_root) 1598 + { 1599 + int len = 0; 1600 + char *buf = NULL; 1601 + struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root); 1602 + struct cgroup *ns_cgroup; 1603 + 1604 + buf = kmalloc(PATH_MAX, GFP_KERNEL); 1605 + if (!buf) 1606 + return -ENOMEM; 1607 + 1608 + spin_lock_bh(&css_set_lock); 1609 + ns_cgroup = current_cgns_cgroup_from_root(kf_cgroot); 1610 + len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX); 1611 + spin_unlock_bh(&css_set_lock); 1612 + 1613 + if (len >= PATH_MAX) 1614 + len = -ERANGE; 1615 + else if (len > 0) { 1616 + seq_escape(sf, buf, " \t\n\\"); 1617 + len = 0; 1618 + } 1619 + kfree(buf); 1620 + return len; 1629 1621 } 1630 1622 1631 1623 static int cgroup_show_options(struct seq_file *seq, ··· 5495 5433 .mkdir = cgroup_mkdir, 5496 5434 .rmdir = cgroup_rmdir, 5497 5435 .rename = cgroup_rename, 5436 + .show_path = cgroup_show_path, 5498 5437 }; 5499 5438 5500 5439 static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)