]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cgroup: fix spurious lockdep warning in cgroup_exit()
authorLi Zefan <lizefan@huawei.com>
Fri, 28 Mar 2014 07:18:27 +0000 (15:18 +0800)
committerTejun Heo <tj@kernel.org>
Sat, 29 Mar 2014 13:15:53 +0000 (09:15 -0400)
cgroup_exit() is called in fork and exit path. If it's called in the
failure path during fork, PF_EXITING isn't set, and then lockdep will
complain.

Fix this by removing cgroup_exit() in that failure path. cgroup_fork()
does nothing that needs cleanup.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup.c
kernel/fork.c

index e378cb2fac5e446d2a1d8eddeb9c022c1d6260b0..60fd6f1f6d4e7b3b957d1e4055c9a24f591e0fa4 100644 (file)
@@ -4431,8 +4431,7 @@ void cgroup_post_fork(struct task_struct *child)
  * notify_on_release(), then leave the task attached to the root cgroup in
  * each hierarchy for the remainder of its exit.  No need to bother with
  * init_css_set refcnting.  init_css_set never goes away and we can't race
- * with migration path - either PF_EXITING is visible to migration path or
- * @tsk never got on the tasklist.
+ * with migration path - PF_EXITING is visible to migration path.
  */
 void cgroup_exit(struct task_struct *tsk, int run_callbacks)
 {
index a17621c6cd4272182a78083e736c5972c741ed7a..8852b3463ab7b729dbc29e5c4196dbaa5d1be944 100644 (file)
@@ -1271,7 +1271,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        if (IS_ERR(p->mempolicy)) {
                retval = PTR_ERR(p->mempolicy);
                p->mempolicy = NULL;
-               goto bad_fork_cleanup_cgroup;
+               goto bad_fork_cleanup_threadgroup_lock;
        }
        mpol_fix_fork_child_flag(p);
 #endif
@@ -1524,11 +1524,10 @@ bad_fork_cleanup_policy:
        perf_event_free_task(p);
 #ifdef CONFIG_NUMA
        mpol_put(p->mempolicy);
-bad_fork_cleanup_cgroup:
+bad_fork_cleanup_threadgroup_lock:
 #endif
        if (clone_flags & CLONE_THREAD)
                threadgroup_change_end(current);
-       cgroup_exit(p, 0);
        delayacct_tsk_free(p);
        module_put(task_thread_info(p)->exec_domain->module);
 bad_fork_cleanup_count: