diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-07-25 04:47:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:40 -0400 |
commit | 9d5b327bf198d2720666de958dcc2ae219d86952 (patch) | |
tree | 2eba6fe178581c2291393a061ff42d09da95386b /fs/exec.c | |
parent | c5f1cc8c1828486a61ab3e575da6e2c62b34d399 (diff) |
coredump: make mm->core_state visible to ->core_dump()
Move the "struct core_state core_state" from coredump_wait() to
do_coredump(), this makes mm->core_state visible to binfmt->core_dump().
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1595,17 +1595,16 @@ done: | |||
1595 | return nr; | 1595 | return nr; |
1596 | } | 1596 | } |
1597 | 1597 | ||
1598 | static int coredump_wait(int exit_code) | 1598 | static int coredump_wait(int exit_code, struct core_state *core_state) |
1599 | { | 1599 | { |
1600 | struct task_struct *tsk = current; | 1600 | struct task_struct *tsk = current; |
1601 | struct mm_struct *mm = tsk->mm; | 1601 | struct mm_struct *mm = tsk->mm; |
1602 | struct core_state core_state; | ||
1603 | struct completion *vfork_done; | 1602 | struct completion *vfork_done; |
1604 | int core_waiters; | 1603 | int core_waiters; |
1605 | 1604 | ||
1606 | init_completion(&mm->core_done); | 1605 | init_completion(&mm->core_done); |
1607 | init_completion(&core_state.startup); | 1606 | init_completion(&core_state->startup); |
1608 | core_waiters = zap_threads(tsk, mm, &core_state, exit_code); | 1607 | core_waiters = zap_threads(tsk, mm, core_state, exit_code); |
1609 | up_write(&mm->mmap_sem); | 1608 | up_write(&mm->mmap_sem); |
1610 | 1609 | ||
1611 | if (unlikely(core_waiters < 0)) | 1610 | if (unlikely(core_waiters < 0)) |
@@ -1622,8 +1621,7 @@ static int coredump_wait(int exit_code) | |||
1622 | } | 1621 | } |
1623 | 1622 | ||
1624 | if (core_waiters) | 1623 | if (core_waiters) |
1625 | wait_for_completion(&core_state.startup); | 1624 | wait_for_completion(&core_state->startup); |
1626 | mm->core_state = NULL; | ||
1627 | fail: | 1625 | fail: |
1628 | return core_waiters; | 1626 | return core_waiters; |
1629 | } | 1627 | } |
@@ -1679,6 +1677,7 @@ int get_dumpable(struct mm_struct *mm) | |||
1679 | 1677 | ||
1680 | int do_coredump(long signr, int exit_code, struct pt_regs * regs) | 1678 | int do_coredump(long signr, int exit_code, struct pt_regs * regs) |
1681 | { | 1679 | { |
1680 | struct core_state core_state; | ||
1682 | char corename[CORENAME_MAX_SIZE + 1]; | 1681 | char corename[CORENAME_MAX_SIZE + 1]; |
1683 | struct mm_struct *mm = current->mm; | 1682 | struct mm_struct *mm = current->mm; |
1684 | struct linux_binfmt * binfmt; | 1683 | struct linux_binfmt * binfmt; |
@@ -1717,7 +1716,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1717 | current->fsuid = 0; /* Dump root private */ | 1716 | current->fsuid = 0; /* Dump root private */ |
1718 | } | 1717 | } |
1719 | 1718 | ||
1720 | retval = coredump_wait(exit_code); | 1719 | retval = coredump_wait(exit_code, &core_state); |
1721 | if (retval < 0) | 1720 | if (retval < 0) |
1722 | goto fail; | 1721 | goto fail; |
1723 | 1722 | ||
@@ -1812,6 +1811,7 @@ fail_unlock: | |||
1812 | 1811 | ||
1813 | current->fsuid = fsuid; | 1812 | current->fsuid = fsuid; |
1814 | complete_all(&mm->core_done); | 1813 | complete_all(&mm->core_done); |
1814 | mm->core_state = NULL; | ||
1815 | fail: | 1815 | fail: |
1816 | return retval; | 1816 | return retval; |
1817 | } | 1817 | } |