new helper: daemonize_descriptors()

descriptor-related parts of daemonize, done right.  As the
result we simplify the locking rules for ->files - we
hold task_lock in *all* cases when we modify ->files.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2012-08-22 18:42:10 -04:00
parent 2be7fd55d4
commit 864bdb3b6c
3 changed files with 8 additions and 3 deletions

View file

@ -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(&current->files->count);
daemonize_descriptors();
reparent_to_kthreadd();
}