aboutsummaryrefslogtreecommitdiffstats
path: root/fs/smbfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/smbfs')
-rw-r--r--fs/smbfs/smbiod.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c
index 481a97a423fa..3f71384020cb 100644
--- a/fs/smbfs/smbiod.c
+++ b/fs/smbfs/smbiod.c
@@ -20,6 +20,7 @@
20#include <linux/smp_lock.h> 20#include <linux/smp_lock.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/net.h> 22#include <linux/net.h>
23#include <linux/kthread.h>
23#include <net/ip.h> 24#include <net/ip.h>
24 25
25#include <linux/smb_fs.h> 26#include <linux/smb_fs.h>
@@ -40,7 +41,7 @@ enum smbiod_state {
40}; 41};
41 42
42static enum smbiod_state smbiod_state = SMBIOD_DEAD; 43static enum smbiod_state smbiod_state = SMBIOD_DEAD;
43static pid_t smbiod_pid; 44static struct task_struct *smbiod_thread;
44static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); 45static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait);
45static LIST_HEAD(smb_servers); 46static LIST_HEAD(smb_servers);
46static DEFINE_SPINLOCK(servers_lock); 47static DEFINE_SPINLOCK(servers_lock);
@@ -67,20 +68,29 @@ void smbiod_wake_up(void)
67 */ 68 */
68static int smbiod_start(void) 69static int smbiod_start(void)
69{ 70{
70 pid_t pid; 71 struct task_struct *tsk;
72 int err = 0;
73
71 if (smbiod_state != SMBIOD_DEAD) 74 if (smbiod_state != SMBIOD_DEAD)
72 return 0; 75 return 0;
73 smbiod_state = SMBIOD_STARTING; 76 smbiod_state = SMBIOD_STARTING;
74 __module_get(THIS_MODULE); 77 __module_get(THIS_MODULE);
75 spin_unlock(&servers_lock); 78 spin_unlock(&servers_lock);
76 pid = kernel_thread(smbiod, NULL, 0); 79 tsk = kthread_run(smbiod, NULL, "smbiod");
77 if (pid < 0) 80 if (IS_ERR(tsk)) {
81 err = PTR_ERR(tsk);
78 module_put(THIS_MODULE); 82 module_put(THIS_MODULE);
83 }
79 84
80 spin_lock(&servers_lock); 85 spin_lock(&servers_lock);
81 smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING; 86 if (err < 0) {
82 smbiod_pid = pid; 87 smbiod_state = SMBIOD_DEAD;
83 return pid; 88 smbiod_thread = NULL;
89 } else {
90 smbiod_state = SMBIOD_RUNNING;
91 smbiod_thread = tsk;
92 }
93 return err;
84} 94}
85 95
86/* 96/*
@@ -290,8 +300,6 @@ out:
290 */ 300 */
291static int smbiod(void *unused) 301static int smbiod(void *unused)
292{ 302{
293 daemonize("smbiod");
294
295 allow_signal(SIGKILL); 303 allow_signal(SIGKILL);
296 304
297 VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); 305 VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);