aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-03 00:09:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-03 00:09:10 -0400
commit8fe74cf053de7ad2124a894996f84fa890a81093 (patch)
tree77dcd8fbf33ce53a3821942233962fb28c6f2848 /kernel/exit.c
parentc2eb2fa6d2b6fe122d3479ec5b28d978418b2698 (diff)
parentced117c73edc917e96dea7cca98c91383f0792f7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: Remove two unneeded exports and make two symbols static in fs/mpage.c Cleanup after commit 585d3bc06f4ca57f975a5a1f698f65a45ea66225 Trim includes of fdtable.h Don't crap into descriptor table in binfmt_som Trim includes in binfmt_elf Don't mess with descriptor table in load_elf_binary() Get rid of indirect include of fs_struct.h New helper - current_umask() check_unsafe_exec() doesn't care about signal handlers sharing New locking/refcounting for fs_struct Take fs_struct handling to new file (fs/fs_struct.c) Get rid of bumping fs_struct refcount in pivot_root(2) Kill unsharing fs_struct in __set_personality()
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 3bec141c82f6..6686ed1e4aa3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -46,6 +46,7 @@
46#include <linux/blkdev.h> 46#include <linux/blkdev.h>
47#include <linux/task_io_accounting_ops.h> 47#include <linux/task_io_accounting_ops.h>
48#include <linux/tracehook.h> 48#include <linux/tracehook.h>
49#include <linux/fs_struct.h>
49#include <linux/init_task.h> 50#include <linux/init_task.h>
50#include <trace/sched.h> 51#include <trace/sched.h>
51 52
@@ -420,7 +421,6 @@ EXPORT_SYMBOL(disallow_signal);
420void daemonize(const char *name, ...) 421void daemonize(const char *name, ...)
421{ 422{
422 va_list args; 423 va_list args;
423 struct fs_struct *fs;
424 sigset_t blocked; 424 sigset_t blocked;
425 425
426 va_start(args, name); 426 va_start(args, name);
@@ -453,11 +453,7 @@ void daemonize(const char *name, ...)
453 453
454 /* Become as one with the init task */ 454 /* Become as one with the init task */
455 455
456 exit_fs(current); /* current->fs->count--; */ 456 daemonize_fs_struct();
457 fs = init_task.fs;
458 current->fs = fs;
459 atomic_inc(&fs->count);
460
461 exit_files(current); 457 exit_files(current);
462 current->files = init_task.files; 458 current->files = init_task.files;
463 atomic_inc(&current->files->count); 459 atomic_inc(&current->files->count);
@@ -556,30 +552,6 @@ void exit_files(struct task_struct *tsk)
556 } 552 }
557} 553}
558 554
559void put_fs_struct(struct fs_struct *fs)
560{
561 /* No need to hold fs->lock if we are killing it */
562 if (atomic_dec_and_test(&fs->count)) {
563 path_put(&fs->root);
564 path_put(&fs->pwd);
565 kmem_cache_free(fs_cachep, fs);
566 }
567}
568
569void exit_fs(struct task_struct *tsk)
570{
571 struct fs_struct * fs = tsk->fs;
572
573 if (fs) {
574 task_lock(tsk);
575 tsk->fs = NULL;
576 task_unlock(tsk);
577 put_fs_struct(fs);
578 }
579}
580
581EXPORT_SYMBOL_GPL(exit_fs);
582
583#ifdef CONFIG_MM_OWNER 555#ifdef CONFIG_MM_OWNER
584/* 556/*
585 * Task p is exiting and it owned mm, lets find a new owner for it 557 * Task p is exiting and it owned mm, lets find a new owner for it