diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-02-28 12:51:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 18:33:46 -0500 |
commit | afc847b7ddcf636e524cf5b0de644bd3a9419a8c (patch) | |
tree | 5022a566bc55a12a792c8bd9b2d94ccfd4b10235 /kernel/exit.c | |
parent | 60a6dc55b93b3321afa52f650a149fb7e87fa85a (diff) |
[PATCH] don't do exit_io_context() until we know we won't be doing any IO
testcase:
mount /dev/sdb10 /mnt
touch /mnt/tmp/b
umount /mnt
mount /dev/sdb10 /mnt
rm /mnt/tmp/b </mnt/tmp/b
umount /mnt
and watch blkdev_ioc line in /proc/slabinfo. Vanilla kernel leaks.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 531aadca5530..d1e8d500a7e1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -807,8 +807,6 @@ fastcall NORET_TYPE void do_exit(long code) | |||
807 | panic("Attempted to kill the idle task!"); | 807 | panic("Attempted to kill the idle task!"); |
808 | if (unlikely(tsk->pid == 1)) | 808 | if (unlikely(tsk->pid == 1)) |
809 | panic("Attempted to kill init!"); | 809 | panic("Attempted to kill init!"); |
810 | if (tsk->io_context) | ||
811 | exit_io_context(); | ||
812 | 810 | ||
813 | if (unlikely(current->ptrace & PT_TRACE_EXIT)) { | 811 | if (unlikely(current->ptrace & PT_TRACE_EXIT)) { |
814 | current->ptrace_message = code; | 812 | current->ptrace_message = code; |
@@ -822,6 +820,8 @@ fastcall NORET_TYPE void do_exit(long code) | |||
822 | if (unlikely(tsk->flags & PF_EXITING)) { | 820 | if (unlikely(tsk->flags & PF_EXITING)) { |
823 | printk(KERN_ALERT | 821 | printk(KERN_ALERT |
824 | "Fixing recursive fault but reboot is needed!\n"); | 822 | "Fixing recursive fault but reboot is needed!\n"); |
823 | if (tsk->io_context) | ||
824 | exit_io_context(); | ||
825 | set_current_state(TASK_UNINTERRUPTIBLE); | 825 | set_current_state(TASK_UNINTERRUPTIBLE); |
826 | schedule(); | 826 | schedule(); |
827 | } | 827 | } |
@@ -881,6 +881,9 @@ fastcall NORET_TYPE void do_exit(long code) | |||
881 | */ | 881 | */ |
882 | mutex_debug_check_no_locks_held(tsk); | 882 | mutex_debug_check_no_locks_held(tsk); |
883 | 883 | ||
884 | if (tsk->io_context) | ||
885 | exit_io_context(); | ||
886 | |||
884 | /* PF_DEAD causes final put_task_struct after we schedule. */ | 887 | /* PF_DEAD causes final put_task_struct after we schedule. */ |
885 | preempt_disable(); | 888 | preempt_disable(); |
886 | BUG_ON(tsk->flags & PF_DEAD); | 889 | BUG_ON(tsk->flags & PF_DEAD); |