Subject: linux-next: manual merge of the vfs tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 2 Jan 2019 12:32:28 +1100

Hi all,

Today's linux-next merge of the vfs tree got a conflict in:

  kernel/cgroup/cgroup-v1.c

between commit:

  3fc9c12d27b4 ("cgroup: Add named hierarchy disabling to cgroup_no_v1 boot param")

from Linus' tree and commit:

  b3678086951a ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context")

from the vfs tree.

Its a pity that the former commit did not appear until after the merge
window opened.  :-(

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/cgroup/cgroup-v1.c
index 583b969b0c0e,4b189e821cad..000000000000
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@@ -1003,17 -968,91 +971,94 @@@ int cgroup1_parse_param(struct fs_conte
  				continue;
  
  			/* Mutually exclusive option 'all' + subsystem name */
- 			if (all_ss)
- 				return -EINVAL;
- 			opts->subsys_mask |= (1 << i);
- 			one_ss = true;
+ 			if (ctx->all_ss)
+ 				return cg_invalf(fc, "cgroup1: subsys name conflicts with all");
+ 			ctx->subsys_mask |= (1 << i);
+ 			ctx->one_ss = true;
+ 			return 0;
+ 		}
  
- 			break;
+ 		return cg_invalf(fc, "cgroup1: Unknown subsys name '%s'", param->key);
+ 	}
+ 	if (opt < 0)
+ 		return opt;
+ 
+ 	switch (opt) {
+ 	case Opt_none:
+ 		/* Explicitly have no subsystems */
+ 		ctx->none = true;
+ 		return 0;
+ 	case Opt_all:
+ 		/* Mutually exclusive option 'all' + subsystem name */
+ 		if (ctx->one_ss)
+ 			return cg_invalf(fc, "cgroup1: all conflicts with subsys name");
+ 		ctx->all_ss = true;
+ 		return 0;
+ 	case Opt_noprefix:
+ 		ctx->flags |= CGRP_ROOT_NOPREFIX;
+ 		return 0;
+ 	case Opt_clone_children:
+ 		ctx->cpuset_clone_children = true;
+ 		return 0;
+ 	case Opt_cpuset_v2_mode:
+ 		ctx->flags |= CGRP_ROOT_CPUSET_V2_MODE;
+ 		return 0;
+ 	case Opt_xattr:
+ 		ctx->flags |= CGRP_ROOT_XATTR;
+ 		return 0;
+ 	case Opt_release_agent:
+ 		/* Specifying two release agents is forbidden */
+ 		if (ctx->release_agent)
+ 			return cg_invalf(fc, "cgroup1: release_agent respecified");
+ 		ctx->release_agent = param->string;
+ 		param->string = NULL;
+ 		if (!ctx->release_agent)
+ 			return -ENOMEM;
+ 		return 0;
+ 
+ 	case Opt_name:
++		/* blocked by boot param? */
++		if (cgroup_no_v1_named)
++			return cg_invalf(fc, "cgroup1: Blocked by boot paramter");
+ 		/* Can't specify an empty name */
+ 		if (!param->size)
+ 			return cg_invalf(fc, "cgroup1: Empty name");
+ 		if (param->size > MAX_CGROUP_ROOT_NAMELEN - 1)
+ 			return cg_invalf(fc, "cgroup1: Name too long");
+ 		/* Must match [\w.-]+ */
+ 		for (i = 0; i < param->size; i++) {
+ 			char c = param->string[i];
+ 			if (isalnum(c))
+ 				continue;
+ 			if ((c == '.') || (c == '-') || (c == '_'))
+ 				continue;
+ 			return cg_invalf(fc, "cgroup1: Invalid name");
  		}
- 		if (i == CGROUP_SUBSYS_COUNT)
- 			return -ENOENT;
+ 		/* Specifying two names is forbidden */
+ 		if (ctx->name)
+ 			return cg_invalf(fc, "cgroup1: name respecified");
+ 		ctx->name = param->string;
+ 		param->string = NULL;
+ 		return 0;
  	}
  
+ 	return 0;
+ }
+ 
+ /*
+  * Validate the options that have been parsed.
+  */
+ static int cgroup1_validate(struct fs_context *fc)
+ {
+ 	struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
+ 	struct cgroup_subsys *ss;
+ 	u16 mask = U16_MAX;
+ 	int i;
+ 
+ #ifdef CONFIG_CPUSETS
+ 	mask = ~((u16)1 << cpuset_cgrp_id);
+ #endif
+ 
  	/*
  	 * If the 'all' option was specified select all the subsystems,
  	 * otherwise if 'none', 'name=' and a subsystem name options were