From: Jeff Liu <jeff.liu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Alexey Kodanev
<alexey.kodanev-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
James Morris
<james.l.morris-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH] cgroup: enabled xattr on root hierarchy if required
Date: Sat, 25 May 2013 00:03:12 +0800 [thread overview]
Message-ID: <519F8F40.3040601@oracle.com> (raw)
From: Jie Liu <jeff.liu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Reported-by: Alexey Kodanev <alexey.kodanev-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
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
next reply other threads:[~2013-05-24 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 16:03 Jeff Liu [this message]
[not found] ` <519F8F40.3040601-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-05-26 4:10 ` [PATCH] cgroup: enabled xattr on root hierarchy if required Tejun Heo
[not found] ` <20130526041007.GD13771-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-05-26 13:33 ` Jeff Liu
[not found] ` <51A20F15.4030606-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-05-28 22:59 ` [PATCH] cgroup: warn about mismatching options of a new mount of an existing hierarchy Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519F8F40.3040601@oracle.com \
--to=jeff.liu-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=alexey.kodanev-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=james.l.morris-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.