Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1868068pxu; Thu, 17 Dec 2020 23:07:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMtyEIpSXmv3cFf2d57bxLiibK1s4mxmJWojmRHkBjXXrcLI5CUhSHgz+uo93Grxa+8kul X-Received: by 2002:a17:907:20a6:: with SMTP id pw6mr2662967ejb.73.1608275241342; Thu, 17 Dec 2020 23:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608275241; cv=none; d=google.com; s=arc-20160816; b=jmArE/GjvNoBCESdhjnFXKdYXeMG6FfRDdge0Kd70OWQ5wzaz5imiha0ArT8vqrOBS seTOr+aG2obc2wtmm6VOFO02vXs7TbqCy7HU2X2J/Rt3s/4xNTgU7tfWXyrYRAGWU8jQ XX123B7IcvHa8ME4x+3x2rCBXtyeYgL2y1acsUb2C7Szy1ZopTXsz49ijIlAUsBF7GzY KVfCSC8M7YsrKHTU70TryxwYYiA8j7Fe2PooU7wZstXz4DuC7WIxfLc66itlXzJf8SFh oA5pDe6odEWSlZd9I/xt8xwlep/GCMNoxmxEAdFuqBiceBZTHOAeCKdBQsg4ptS6CiJW DHEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=+fr5Uiv2m56rDHBXS+SIKVUd0q9NJdkdahalNX+TBMQ=; b=UGRAfhscYWBG2slfLixAdMmtclWWAHxQY/sLHk/MkbU8HaRMAfWUZeIEz1VRDSIknN wddm0A0mp4tmNxGqRTKVYas0MkkVR/gLKzsPHxpY8NWz1paAspmXN54dRtqiV52BulTj 1Zf/6wpusZdH3yVGdE3FarRctRKzmhpunLAKvmYGIKD0VyVczuf4iuG7HGTgAkHebOUv IhRawDRIdazAMhUYzdy1nPt7+lT0XnzC2NgkFgMKkx/aVc8VRpQbjN4s7iM/ZAW7+Bp7 TLrdNflyh7Lg6fl96rPo/x+lOG14UY03nNl9gi4LjLPlzpPYojwDRZkAImdsEo8rVX0S S1Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si4086649ejk.401.2020.12.17.23.06.57; Thu, 17 Dec 2020 23:07:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbgLRHDo (ORCPT + 99 others); Fri, 18 Dec 2020 02:03:44 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9629 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbgLRHDn (ORCPT ); Fri, 18 Dec 2020 02:03:43 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cy0DF6MKCz15flB; Fri, 18 Dec 2020 15:02:21 +0800 (CST) Received: from [10.174.179.9] (10.174.179.9) by smtp.huawei.com (10.3.19.202) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 18 Dec 2020 15:02:54 +0800 Subject: Re: [PATCH v2] cgroup-v1: add disabled controller check in cgroup1_parse_param() To: Chen Zhou , , CC: , References: <20201218061755.121205-1-chenzhou10@huawei.com> From: Zefan Li Message-ID: <2d76fdf3-7f53-49c7-aa9d-13fa58081193@huawei.com> Date: Fri, 18 Dec 2020 15:02:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20201218061755.121205-1-chenzhou10@huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.9] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/18 14:17, Chen Zhou wrote: > When mounting a cgroup hierarchy with disabled controller in cgroup v1, > all available controllers will be attached. > > Add disabled controller check in cgroup1_parse_param() and return directly > if the specified controller is disabled. > > Signed-off-by: Chen Zhou > --- > Changes in v2: > - Fix line over 80 characters warning. > --- > kernel/cgroup/cgroup-v1.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c > index 191c329e482a..5190c42fea8b 100644 > --- a/kernel/cgroup/cgroup-v1.c > +++ b/kernel/cgroup/cgroup-v1.c > @@ -915,6 +915,9 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) > for_each_subsys(ss, i) { > if (strcmp(param->key, ss->legacy_name)) > continue; > + if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i)) > + return invalfc(fc, "Disabled controller '%s'", > + param->key); > ctx->subsys_mask |= (1 << i); > return 0; > } Reviewed-by: Zefan Li