Hello, Jens. How should this one be routed? It can go through either block or cgroup tree. Thanks! ------------------------- 8< ------------------------- From: Tejun Heo <tj@xxxxxxxxxx> Subject: blkcg: make blkcg_policy_register() correctly handle cgroup_add_cftypes() failures blkcg_policy_register() currently triggers WARN when cgroup_add_cftypes() fails and proceeds, which is a rather crappy way to handle errors. It was written that way as cgroup_add_cftypes() itself didn't handle errors correctly. Now that cgroup_add_cftypes() correctly handles errors in itself, let's handle its failure properly. Remove the WARN_ON() and cancel and fail policy registration on cgroup_add_cftypes() failure. Signed-off-by: Tejun Heo <tj@xxxxxxxxxx> Cc: Vivek Goyal <vgoyal@xxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> --- block/blk-cgroup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index e8918ff..b27a9d2 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1127,10 +1127,13 @@ int blkcg_policy_register(struct blkcg_policy *pol) pol->plid = i; blkcg_policy[i] = pol; - /* everything is in place, add intf files for the new policy */ - if (pol->cftypes) - WARN_ON(cgroup_add_cftypes(&blkio_subsys, pol->cftypes)); + /* try to add intf files for the new policy */ ret = 0; + if (pol->cftypes) { + ret = cgroup_add_cftypes(&blkio_subsys, pol->cftypes); + if (ret) + blkcg_policy[i] = NULL; + } out_unlock: mutex_unlock(&blkcg_pol_mutex); return ret; -- 1.8.3.1 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/containers