aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cgroup.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f873c4681316..5eb20cd1709c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1694,7 +1694,6 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
1694 struct dentry *dentry; 1694 struct dentry *dentry;
1695 int ret; 1695 int ret;
1696 int i; 1696 int i;
1697 bool new_sb;
1698 1697
1699 /* 1698 /*
1700 * The first time anyone tries to mount a cgroup, enable the list 1699 * The first time anyone tries to mount a cgroup, enable the list
@@ -1785,7 +1784,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
1785 * path is super cold. Let's just sleep a bit and retry. 1784 * path is super cold. Let's just sleep a bit and retry.
1786 */ 1785 */
1787 pinned_sb = kernfs_pin_sb(root->kf_root, NULL); 1786 pinned_sb = kernfs_pin_sb(root->kf_root, NULL);
1788 if (IS_ERR(pinned_sb) || 1787 if (IS_ERR_OR_NULL(pinned_sb) ||
1789 !percpu_ref_tryget_live(&root->cgrp.self.refcnt)) { 1788 !percpu_ref_tryget_live(&root->cgrp.self.refcnt)) {
1790 mutex_unlock(&cgroup_mutex); 1789 mutex_unlock(&cgroup_mutex);
1791 if (!IS_ERR_OR_NULL(pinned_sb)) 1790 if (!IS_ERR_OR_NULL(pinned_sb))
@@ -1831,18 +1830,16 @@ out_free:
1831 return ERR_PTR(ret); 1830 return ERR_PTR(ret);
1832 1831
1833 dentry = kernfs_mount(fs_type, flags, root->kf_root, 1832 dentry = kernfs_mount(fs_type, flags, root->kf_root,
1834 CGROUP_SUPER_MAGIC, &new_sb); 1833 CGROUP_SUPER_MAGIC, NULL);
1835 if (IS_ERR(dentry) || !new_sb) 1834 if (IS_ERR(dentry) || pinned_sb)
1836 cgroup_put(&root->cgrp); 1835 cgroup_put(&root->cgrp);
1837 1836
1838 /* 1837 /*
1839 * If @pinned_sb, we're reusing an existing root and holding an 1838 * If @pinned_sb, we're reusing an existing root and holding an
1840 * extra ref on its sb. Mount is complete. Put the extra ref. 1839 * extra ref on its sb. Mount is complete. Put the extra ref.
1841 */ 1840 */
1842 if (pinned_sb) { 1841 if (pinned_sb)
1843 WARN_ON(new_sb);
1844 deactivate_super(pinned_sb); 1842 deactivate_super(pinned_sb);
1845 }
1846 1843
1847 return dentry; 1844 return dentry;
1848} 1845}