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) | |
download | op-kernel-dev-afc847b7ddcf636e524cf5b0de644bd3a9419a8c.zip op-kernel-dev-afc847b7ddcf636e524cf5b0de644bd3a9419a8c.tar.gz |
[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 531aadc..d1e8d500 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -807,8 +807,6 @@ fastcall NORET_TYPE void do_exit(long code) panic("Attempted to kill the idle task!"); if (unlikely(tsk->pid == 1)) panic("Attempted to kill init!"); - if (tsk->io_context) - exit_io_context(); if (unlikely(current->ptrace & PT_TRACE_EXIT)) { current->ptrace_message = code; @@ -822,6 +820,8 @@ fastcall NORET_TYPE void do_exit(long code) if (unlikely(tsk->flags & PF_EXITING)) { printk(KERN_ALERT "Fixing recursive fault but reboot is needed!\n"); + if (tsk->io_context) + exit_io_context(); set_current_state(TASK_UNINTERRUPTIBLE); schedule(); } @@ -881,6 +881,9 @@ fastcall NORET_TYPE void do_exit(long code) */ mutex_debug_check_no_locks_held(tsk); + if (tsk->io_context) + exit_io_context(); + /* PF_DEAD causes final put_task_struct after we schedule. */ preempt_disable(); BUG_ON(tsk->flags & PF_DEAD); |