diff options
-rw-r--r-- | kernel/kthread.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c index 7fa441333529..bc5d1f0b25a4 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -27,7 +27,6 @@ struct kthread_create_info | |||
27 | /* Information passed to kthread() from kthreadd. */ | 27 | /* Information passed to kthread() from kthreadd. */ |
28 | int (*threadfn)(void *data); | 28 | int (*threadfn)(void *data); |
29 | void *data; | 29 | void *data; |
30 | struct completion started; | ||
31 | 30 | ||
32 | /* Result passed back to kthread_create() from kthreadd. */ | 31 | /* Result passed back to kthread_create() from kthreadd. */ |
33 | struct task_struct *result; | 32 | struct task_struct *result; |
@@ -75,7 +74,7 @@ static int kthread(void *_create) | |||
75 | /* OK, tell user we're spawned, wait for stop or wakeup */ | 74 | /* OK, tell user we're spawned, wait for stop or wakeup */ |
76 | __set_current_state(TASK_UNINTERRUPTIBLE); | 75 | __set_current_state(TASK_UNINTERRUPTIBLE); |
77 | create->result = current; | 76 | create->result = current; |
78 | complete(&create->started); | 77 | complete(&create->done); |
79 | schedule(); | 78 | schedule(); |
80 | 79 | ||
81 | if (!kthread_should_stop()) | 80 | if (!kthread_should_stop()) |
@@ -95,11 +94,10 @@ static void create_kthread(struct kthread_create_info *create) | |||
95 | 94 | ||
96 | /* We want our own signal handler (we take no signals by default). */ | 95 | /* We want our own signal handler (we take no signals by default). */ |
97 | pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD); | 96 | pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD); |
98 | if (pid < 0) | 97 | if (pid < 0) { |
99 | create->result = ERR_PTR(pid); | 98 | create->result = ERR_PTR(pid); |
100 | else | 99 | complete(&create->done); |
101 | wait_for_completion(&create->started); | 100 | } |
102 | complete(&create->done); | ||
103 | } | 101 | } |
104 | 102 | ||
105 | /** | 103 | /** |
@@ -130,7 +128,6 @@ struct task_struct *kthread_create(int (*threadfn)(void *data), | |||
130 | 128 | ||
131 | create.threadfn = threadfn; | 129 | create.threadfn = threadfn; |
132 | create.data = data; | 130 | create.data = data; |
133 | init_completion(&create.started); | ||
134 | init_completion(&create.done); | 131 | init_completion(&create.done); |
135 | 132 | ||
136 | spin_lock(&kthread_create_lock); | 133 | spin_lock(&kthread_create_lock); |