[PATCH 3/3] coredump_wait: don't call complete_vfork_done()

From: Oleg Nesterov
Date: Fri Aug 12 2011 - 13:59:59 EST


Now that CLONE_VFORK is killable, coredump_wait() no longer needs
complete_vfork_done(). zap_threads() should find and kill all tasks
with the same ->mm, this includes our parent if ->vfork_done is set.

mm_release() becomes the only caller, unexport complete_vfork_done().

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---

include/linux/sched.h | 1 -
fs/exec.c | 14 ++------------
kernel/fork.c | 2 +-
3 files changed, 3 insertions(+), 14 deletions(-)

--- 3.1/include/linux/sched.h~3_coredump_no_vfork_done 2011-08-12 18:50:11.000000000 +0200
+++ 3.1/include/linux/sched.h 2011-08-12 18:51:13.000000000 +0200
@@ -2254,7 +2254,6 @@ extern int do_execve(const char *,
const char __user * const __user *,
const char __user * const __user *, struct pt_regs *);
extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
-extern void complete_vfork_done(struct task_struct *tsk);
struct task_struct *fork_idle(int);

extern void set_task_comm(struct task_struct *tsk, char *from);
--- 3.1/fs/exec.c~3_coredump_no_vfork_done 2011-08-12 18:50:11.000000000 +0200
+++ 3.1/fs/exec.c 2011-08-12 18:51:13.000000000 +0200
@@ -1925,19 +1925,9 @@ static int coredump_wait(int exit_code,
core_waiters = zap_threads(tsk, mm, core_state, exit_code);
up_write(&mm->mmap_sem);

- if (unlikely(core_waiters < 0))
- goto fail;
-
- /*
- * Make sure nobody is waiting for us to release the VM,
- * otherwise we can deadlock when we wait on each other
- */
- if (tsk->vfork_done)
- complete_vfork_done(tsk);
-
- if (core_waiters)
+ if (core_waiters > 0)
wait_for_completion(&core_state->startup);
-fail:
+
return core_waiters;
}

--- 3.1/kernel/fork.c~3_coredump_no_vfork_done 2011-08-12 18:50:11.000000000 +0200
+++ 3.1/kernel/fork.c 2011-08-12 18:51:13.000000000 +0200
@@ -650,7 +650,7 @@ struct mm_struct *get_task_mm(struct tas
}
EXPORT_SYMBOL_GPL(get_task_mm);

-void complete_vfork_done(struct task_struct *tsk)
+static void complete_vfork_done(struct task_struct *tsk)
{
struct completion *vfork;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/