From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:48336 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfABWaH (ORCPT ); Wed, 2 Jan 2019 17:30:07 -0500 Subject: [PATCH] cgroup: Always apply root flags on successful tree creation From: David Howells To: viro@zeniv.linux.org.uk Cc: Andrei Vagin , dhowells@redhat.com, linux-fsdevel@vger.kernel.org Date: Wed, 02 Jan 2019 22:30:05 +0000 Message-ID: <154646820518.25536.11858510610339458118.stgit@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Always apply the root flags on mounting, both when the superblock is new and when an already extant superblock is being shared. Currently there's a bug in commit b3678086951a5 whereby the flags are only changed if the superblock wasn't new. The intention was originally to effect the change for a new superblock by having kernfs_fill_super() call back into the subclassing filesystem, but that never got completed. On further reflection, it's possibly better not to do that so that we don't have to revert the flag change if there's a later failure. Fixes: b3678086951a ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context") Reported-by: Al Viro Signed-off-by: David Howells cc: Andrei Vagin --- kernel/cgroup/cgroup.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index a19f0fec9d82..ff6627ec1e3e 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2044,12 +2044,8 @@ int cgroup_do_get_tree(struct fs_context *fc) fc->root = nsdentry; } - ret = 0; - if (ctx->kfc.new_sb_created) - goto out_cgrp; apply_cgroup_root_flags(ctx->flags); - return 0; - + ret = 0; out_cgrp: return ret; }