From 00516986758e93669ba300159056598577b8a22b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 22 Aug 2012 18:42:10 -0400 Subject: [PATCH] --- yaml --- r: 328983 b: refs/heads/master c: 864bdb3b6cbd9911222543fef1cfe36f88183f44 h: refs/heads/master i: 328981: 70983a5f3956881f8832eb4a4c1ad19c1b59c8ea 328979: 349d9fd3800b27fc34245bbffa6f1ac3065c4b04 328975: 9f77a8dcfb1fcd6e0511fbcdac1c9641a51e25e4 v: v3 --- [refs] | 2 +- trunk/fs/file.c | 6 ++++++ trunk/include/linux/fdtable.h | 1 + trunk/kernel/exit.c | 4 +--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 89bd6ad66041..1cfb0a763181 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2be7fd55d44882c9818ed2d1dabc0f0abab5eeed +refs/heads/master: 864bdb3b6cbd9911222543fef1cfe36f88183f44 diff --git a/trunk/fs/file.c b/trunk/fs/file.c index e6e418122587..15750b80e3ce 100644 --- a/trunk/fs/file.c +++ b/trunk/fs/file.c @@ -519,6 +519,12 @@ struct files_struct init_files = { .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), }; +void daemonize_descriptors(void) +{ + atomic_inc(&init_files.count); + reset_files_struct(&init_files); +} + /* * allocate a file descriptor, mark it busy. */ diff --git a/trunk/include/linux/fdtable.h b/trunk/include/linux/fdtable.h index fb7dacae0522..45052aa814c8 100644 --- a/trunk/include/linux/fdtable.h +++ b/trunk/include/linux/fdtable.h @@ -95,6 +95,7 @@ struct task_struct; struct files_struct *get_files_struct(struct task_struct *); void put_files_struct(struct files_struct *fs); void reset_files_struct(struct files_struct *); +void daemonize_descriptors(void); int unshare_files(struct files_struct **); struct files_struct *dup_fd(struct files_struct *, int *); void do_close_on_exec(struct files_struct *); diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 20dfc7617c2e..095113321318 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -457,9 +457,7 @@ void daemonize(const char *name, ...) /* Become as one with the init task */ daemonize_fs_struct(); - exit_files(current); - current->files = init_task.files; - atomic_inc(¤t->files->count); + daemonize_descriptors(); reparent_to_kthreadd(); }