[PATCH 1/5] cgroup2: Always apply root flags on successful superblock obtainance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Always apply the v2 cgroup root flag settings after successfully obtaining
a superblock, 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.

This patch is on top of Andrei Vagin's v6 cgroup refcount patch.

Fixes: b3678086951a ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context")
Reported-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Andrei Vagin <avagin@xxxxxxxxx>
---

 kernel/cgroup/cgroup.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a19f0fec9d82..2e5150412ae0 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2044,12 +2044,9 @@ int cgroup_do_get_tree(struct fs_context *fc)
 		fc->root = nsdentry;
 	}
 
+	if (ctx->version == 2)
+		apply_cgroup_root_flags(ctx->flags);
 	ret = 0;
-	if (ctx->kfc.new_sb_created)
-		goto out_cgrp;
-	apply_cgroup_root_flags(ctx->flags);
-	return 0;
-
 out_cgrp:
 	return ret;
 }




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux