diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index f9c99abc38ab..e801ecfa36ef 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1086,6 +1086,12 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
1086 | } | 1086 | } |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | /* | ||
1090 | * Mark @root has finished binding subsystems. @root->subsys_mask | ||
1091 | * now matches the bound subsystems. | ||
1092 | */ | ||
1093 | root->flags |= CGRP_ROOT_SUBSYS_BOUND; | ||
1094 | |||
1089 | return 0; | 1095 | return 0; |
1090 | } | 1096 | } |
1091 | 1097 | ||
@@ -1485,6 +1491,14 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts) | |||
1485 | 1491 | ||
1486 | init_cgroup_root(root); | 1492 | init_cgroup_root(root); |
1487 | 1493 | ||
1494 | /* | ||
1495 | * We need to set @root->subsys_mask now so that @root can be | ||
1496 | * matched by cgroup_test_super() before it finishes | ||
1497 | * initialization; otherwise, competing mounts with the same | ||
1498 | * options may try to bind the same subsystems instead of waiting | ||
1499 | * for the first one leading to unexpected mount errors. | ||
1500 | * SUBSYS_BOUND will be set once actual binding is complete. | ||
1501 | */ | ||
1488 | root->subsys_mask = opts->subsys_mask; | 1502 | root->subsys_mask = opts->subsys_mask; |
1489 | root->flags = opts->flags; | 1503 | root->flags = opts->flags; |
1490 | ida_init(&root->cgroup_ida); | 1504 | ida_init(&root->cgroup_ida); |
@@ -1734,9 +1748,11 @@ static void cgroup_kill_sb(struct super_block *sb) { | |||
1734 | mutex_lock(&cgroup_root_mutex); | 1748 | mutex_lock(&cgroup_root_mutex); |
1735 | 1749 | ||
1736 | /* Rebind all subsystems back to the default hierarchy */ | 1750 | /* Rebind all subsystems back to the default hierarchy */ |
1737 | ret = rebind_subsystems(root, 0, root->subsys_mask); | 1751 | if (root->flags & CGRP_ROOT_SUBSYS_BOUND) { |
1738 | /* Shouldn't be able to fail ... */ | 1752 | ret = rebind_subsystems(root, 0, root->subsys_mask); |
1739 | BUG_ON(ret); | 1753 | /* Shouldn't be able to fail ... */ |
1754 | BUG_ON(ret); | ||
1755 | } | ||
1740 | 1756 | ||
1741 | /* | 1757 | /* |
1742 | * Release all the links from cset_links to this hierarchy's | 1758 | * Release all the links from cset_links to this hierarchy's |