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

Pull cgroup updates from Tejun Heo:
 "These three patches were scheduled for the merge window but I forgot
  to send them out. Sorry about that.

  None of them are significant and they fit well in a fix pull request
  too - two are cosmetic and one fixes a memory leak in the mount option
  parsing path"

* 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup: Fix memory leak when parsing multiple source parameters
  cgroup/cgroup.c: replace 'of->kn->priv' with of_cft()
  kernel: cgroup: Mundane spelling fixes throughout the file
This commit is contained in:
Linus Torvalds 2020-12-28 11:16:38 -08:00
commit 91afe604c1
2 changed files with 17 additions and 15 deletions

View File

@ -908,6 +908,8 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); opt = fs_parse(fc, cgroup1_fs_parameters, param, &result);
if (opt == -ENOPARAM) { if (opt == -ENOPARAM) {
if (strcmp(param->key, "source") == 0) { if (strcmp(param->key, "source") == 0) {
if (fc->source)
return invalf(fc, "Multiple sources not supported");
fc->source = param->string; fc->source = param->string;
param->string = NULL; param->string = NULL;
return 0; return 0;

View File

@ -244,7 +244,7 @@ bool cgroup_ssid_enabled(int ssid)
* *
* The default hierarchy is the v2 interface of cgroup and this function * The default hierarchy is the v2 interface of cgroup and this function
* can be used to test whether a cgroup is on the default hierarchy for * can be used to test whether a cgroup is on the default hierarchy for
* cases where a subsystem should behave differnetly depending on the * cases where a subsystem should behave differently depending on the
* interface version. * interface version.
* *
* List of changed behaviors: * List of changed behaviors:
@ -262,7 +262,7 @@ bool cgroup_ssid_enabled(int ssid)
* "cgroup.procs" instead. * "cgroup.procs" instead.
* *
* - "cgroup.procs" is not sorted. pids will be unique unless they got * - "cgroup.procs" is not sorted. pids will be unique unless they got
* recycled inbetween reads. * recycled in-between reads.
* *
* - "release_agent" and "notify_on_release" are removed. Replacement * - "release_agent" and "notify_on_release" are removed. Replacement
* notification mechanism will be implemented. * notification mechanism will be implemented.
@ -342,7 +342,7 @@ static bool cgroup_is_mixable(struct cgroup *cgrp)
return !cgroup_parent(cgrp); return !cgroup_parent(cgrp);
} }
/* can @cgrp become a thread root? should always be true for a thread root */ /* can @cgrp become a thread root? Should always be true for a thread root */
static bool cgroup_can_be_thread_root(struct cgroup *cgrp) static bool cgroup_can_be_thread_root(struct cgroup *cgrp)
{ {
/* mixables don't care */ /* mixables don't care */
@ -527,7 +527,7 @@ static struct cgroup_subsys_state *cgroup_e_css_by_mask(struct cgroup *cgrp,
* the root css is returned, so this function always returns a valid css. * the root css is returned, so this function always returns a valid css.
* *
* The returned css is not guaranteed to be online, and therefore it is the * The returned css is not guaranteed to be online, and therefore it is the
* callers responsiblity to tryget a reference for it. * callers responsibility to try get a reference for it.
*/ */
struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
struct cgroup_subsys *ss) struct cgroup_subsys *ss)
@ -933,7 +933,7 @@ void put_css_set_locked(struct css_set *cset)
WARN_ON_ONCE(!list_empty(&cset->threaded_csets)); WARN_ON_ONCE(!list_empty(&cset->threaded_csets));
/* This css_set is dead. unlink it and release cgroup and css refs */ /* This css_set is dead. Unlink it and release cgroup and css refs */
for_each_subsys(ss, ssid) { for_each_subsys(ss, ssid) {
list_del(&cset->e_cset_node[ssid]); list_del(&cset->e_cset_node[ssid]);
css_put(cset->subsys[ssid]); css_put(cset->subsys[ssid]);
@ -1058,7 +1058,7 @@ static struct css_set *find_existing_css_set(struct css_set *old_cset,
/* /*
* Build the set of subsystem state objects that we want to see in the * Build the set of subsystem state objects that we want to see in the
* new css_set. while subsystems can change globally, the entries here * new css_set. While subsystems can change globally, the entries here
* won't change, so no need for locking. * won't change, so no need for locking.
*/ */
for_each_subsys(ss, i) { for_each_subsys(ss, i) {
@ -1148,7 +1148,7 @@ static void link_css_set(struct list_head *tmp_links, struct css_set *cset,
/* /*
* Always add links to the tail of the lists so that the lists are * Always add links to the tail of the lists so that the lists are
* in choronological order. * in chronological order.
*/ */
list_move_tail(&link->cset_link, &cgrp->cset_links); list_move_tail(&link->cset_link, &cgrp->cset_links);
list_add_tail(&link->cgrp_link, &cset->cgrp_links); list_add_tail(&link->cgrp_link, &cset->cgrp_links);
@ -3654,7 +3654,7 @@ static ssize_t cgroup_freeze_write(struct kernfs_open_file *of,
static int cgroup_file_open(struct kernfs_open_file *of) static int cgroup_file_open(struct kernfs_open_file *of)
{ {
struct cftype *cft = of->kn->priv; struct cftype *cft = of_cft(of);
if (cft->open) if (cft->open)
return cft->open(of); return cft->open(of);
@ -3663,7 +3663,7 @@ static int cgroup_file_open(struct kernfs_open_file *of)
static void cgroup_file_release(struct kernfs_open_file *of) static void cgroup_file_release(struct kernfs_open_file *of)
{ {
struct cftype *cft = of->kn->priv; struct cftype *cft = of_cft(of);
if (cft->release) if (cft->release)
cft->release(of); cft->release(of);
@ -3674,7 +3674,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
{ {
struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; struct cgroup_namespace *ns = current->nsproxy->cgroup_ns;
struct cgroup *cgrp = of->kn->parent->priv; struct cgroup *cgrp = of->kn->parent->priv;
struct cftype *cft = of->kn->priv; struct cftype *cft = of_cft(of);
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
int ret; int ret;
@ -3724,7 +3724,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
static __poll_t cgroup_file_poll(struct kernfs_open_file *of, poll_table *pt) static __poll_t cgroup_file_poll(struct kernfs_open_file *of, poll_table *pt)
{ {
struct cftype *cft = of->kn->priv; struct cftype *cft = of_cft(of);
if (cft->poll) if (cft->poll)
return cft->poll(of, pt); return cft->poll(of, pt);
@ -4134,7 +4134,7 @@ struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
* implies that if we observe !CSS_RELEASED on @pos in this RCU * implies that if we observe !CSS_RELEASED on @pos in this RCU
* critical section, the one pointed to by its next pointer is * critical section, the one pointed to by its next pointer is
* guaranteed to not have finished its RCU grace period even if we * guaranteed to not have finished its RCU grace period even if we
* have dropped rcu_read_lock() inbetween iterations. * have dropped rcu_read_lock() in-between iterations.
* *
* If @pos has CSS_RELEASED set, its next pointer can't be * If @pos has CSS_RELEASED set, its next pointer can't be
* dereferenced; however, as each css is given a monotonically * dereferenced; however, as each css is given a monotonically
@ -4382,7 +4382,7 @@ static struct css_set *css_task_iter_next_css_set(struct css_task_iter *it)
} }
/** /**
* css_task_iter_advance_css_set - advance a task itererator to the next css_set * css_task_iter_advance_css_set - advance a task iterator to the next css_set
* @it: the iterator to advance * @it: the iterator to advance
* *
* Advance @it to the next css_set to walk. * Advance @it to the next css_set to walk.
@ -6308,7 +6308,7 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss)
* *
* Find the cgroup at @path on the default hierarchy, increment its * Find the cgroup at @path on the default hierarchy, increment its
* reference count and return it. Returns pointer to the found cgroup on * reference count and return it. Returns pointer to the found cgroup on
* success, ERR_PTR(-ENOENT) if @path doens't exist and ERR_PTR(-ENOTDIR) * success, ERR_PTR(-ENOENT) if @path doesn't exist and ERR_PTR(-ENOTDIR)
* if @path points to a non-directory. * if @path points to a non-directory.
*/ */
struct cgroup *cgroup_get_from_path(const char *path) struct cgroup *cgroup_get_from_path(const char *path)