From: Jie Liu <jeff.liu@xxxxxxxxxx> If the root cgroup is alive without xattr, set extended attributes on a new cgroup with xattr enabled will failed with ENOTSUPP. e.g. # mount -t cgroup -o cpu none /cgroup1 # mount -t cgroup -o cpu,xattr none /cgroup2 # mkdir /cgroup2/test # setfattr -n trusted.name -v test /cgroup2/test setfattr: /cgroup2/test: Operation not supported This patch fix it by checking ROOT_XATTR against the new mount and turn it up on the existing root hierarchy if needed. With this fix: # mount | grep cgroup none on /cgroup1 type cgroup (rw,cpu) none on /cgroup2 type cgroup (rw,xattr,cpu) # mkdir /cgroup2/test # setfattr -n trusted.name -v test /cgroup2/test # getfattr -d -m - /cgroup2/test getfattr: Removing leading '/' from absolute path names trusted.name="test" Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx> Reported-by: Alexey Kodanev <alexey.kodanev@xxxxxxxxxx> --- kernel/cgroup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index a32f943..46e8cbb 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1687,6 +1687,13 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, cgroup_drop_root(opts.new_root); /* no subsys rebinding, so refcounts don't change */ drop_parsed_module_refcounts(opts.subsys_mask); + + /* + * Enable xattr on the existing root hierarchy if it is + * specified on new mount. + */ + if (test_bit(ROOT_XATTR, &opts.flags)) + test_and_set_bit(ROOT_XATTR, &root->flags); } kfree(opts.release_agent); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html