Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288235
b: refs/heads/master
c: c415c3b
h: refs/heads/master
i:
  288233: fc234a4
  288231: cc3b478
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Mar 5, 2012
1 parent 5603ee0 commit 2b27751
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 880641bb9da2473e9ecf6c708d993b29928c1b3c
refs/heads/master: c415c3b47ea2754659d915cca387a20999044163
8 changes: 2 additions & 6 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,6 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
{
struct task_struct *tsk = current;
struct mm_struct *mm = tsk->mm;
struct completion *vfork_done;
int core_waiters = -EBUSY;

init_completion(&core_state->startup);
Expand All @@ -1934,11 +1933,8 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
* Make sure nobody is waiting for us to release the VM,
* otherwise we can deadlock when we wait on each other
*/
vfork_done = tsk->vfork_done;
if (vfork_done) {
tsk->vfork_done = NULL;
complete(vfork_done);
}
if (tsk->vfork_done)
complete_vfork_done(tsk);

if (core_waiters)
wait_for_completion(&core_state->startup);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2291,6 +2291,7 @@ 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);
Expand Down
17 changes: 10 additions & 7 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,14 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
return mm;
}

void complete_vfork_done(struct task_struct *tsk)
{
struct completion *vfork_done = tsk->vfork_done;

tsk->vfork_done = NULL;
complete(vfork_done);
}

/* Please note the differences between mmput and mm_release.
* mmput is called whenever we stop holding onto a mm_struct,
* error success whatever.
Expand All @@ -683,8 +691,6 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
*/
void mm_release(struct task_struct *tsk, struct mm_struct *mm)
{
struct completion *vfork_done = tsk->vfork_done;

/* Get rid of any futexes when releasing the mm */
#ifdef CONFIG_FUTEX
if (unlikely(tsk->robust_list)) {
Expand All @@ -704,11 +710,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
/* Get rid of any cached register state */
deactivate_mm(tsk, mm);

/* notify parent sleeping on vfork() */
if (vfork_done) {
tsk->vfork_done = NULL;
complete(vfork_done);
}
if (tsk->vfork_done)
complete_vfork_done(tsk);

/*
* If we're exiting normally, clear a user-space tid field if
Expand Down

0 comments on commit 2b27751

Please sign in to comment.