[Devel] [PATCH 1/2 v2] cgroup: 'release_agent' property is now per-cgroup instead of per-mount.

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Mar 24 11:34:08 MSK 2020


Except one thing below loogs good.

Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

> @@ -1474,6 +1528,7 @@ static int cgroup_test_super(struct super_block *sb, void *data)
>   
>   static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>   {
> +	int ret;
>   	struct cgroupfs_root *root;
>   
>   	if (!opts->subsys_mask && !opts->none)
> @@ -1487,13 +1542,17 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>   		kfree(root);
>   		return ERR_PTR(-ENOMEM);
>   	}
> +	if (opts->release_agent) {
> +		ret = cgroup_set_release_agent_locked(&root->top_cgroup,
> +			opts->release_agent);

Looks like we don't have cgroup_mutex held at this point and you have 
lockdep_assert_held for it inside cgroup_set_release_agent_locked. On 
debug kernel this will trigger warning. You can add version without 
lockdep to call from this place.

> +		if (ret)
> +			return ERR_PTR(ret);
> +	}
>   	init_cgroup_root(root);
>   
>   	root->subsys_mask = opts->subsys_mask;
>   	root->flags = opts->flags;
>   	ida_init(&root->cgroup_ida);
> -	if (opts->release_agent)
> -		strcpy(root->release_agent_path, opts->release_agent);
>   	if (opts->name)
>   		strcpy(root->name, opts->name);
>   	if (opts->cpuset_clone_children)
> @@ -1867,6 +1926,31 @@ int cgroup_path_ve(const struct cgroup *cgrp, char *buf, int buflen)
>   	return __cgroup_path(cgrp, buf, buflen, !ve_is_super(ve) && !ve->is_pseudosuper);
>   }
>   


More information about the Devel mailing list