diff options
Diffstat (limited to 'fs/smbfs/smbiod.c')
| -rw-r--r-- | fs/smbfs/smbiod.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 481a97a423fa..e67540441288 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | * Copyright (C) 2001, Urban Widmark | 5 | * Copyright (C) 2001, Urban Widmark |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/config.h> | ||
| 9 | 8 | ||
| 10 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
| 11 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
| @@ -20,6 +19,7 @@ | |||
| 20 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
| 21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 22 | #include <linux/net.h> | 21 | #include <linux/net.h> |
| 22 | #include <linux/kthread.h> | ||
| 23 | #include <net/ip.h> | 23 | #include <net/ip.h> |
| 24 | 24 | ||
| 25 | #include <linux/smb_fs.h> | 25 | #include <linux/smb_fs.h> |
| @@ -40,7 +40,7 @@ enum smbiod_state { | |||
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | static enum smbiod_state smbiod_state = SMBIOD_DEAD; | 42 | static enum smbiod_state smbiod_state = SMBIOD_DEAD; |
| 43 | static pid_t smbiod_pid; | 43 | static struct task_struct *smbiod_thread; |
| 44 | static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); | 44 | static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); |
| 45 | static LIST_HEAD(smb_servers); | 45 | static LIST_HEAD(smb_servers); |
| 46 | static DEFINE_SPINLOCK(servers_lock); | 46 | static DEFINE_SPINLOCK(servers_lock); |
| @@ -67,20 +67,29 @@ void smbiod_wake_up(void) | |||
| 67 | */ | 67 | */ |
| 68 | static int smbiod_start(void) | 68 | static int smbiod_start(void) |
| 69 | { | 69 | { |
| 70 | pid_t pid; | 70 | struct task_struct *tsk; |
| 71 | int err = 0; | ||
| 72 | |||
| 71 | if (smbiod_state != SMBIOD_DEAD) | 73 | if (smbiod_state != SMBIOD_DEAD) |
| 72 | return 0; | 74 | return 0; |
| 73 | smbiod_state = SMBIOD_STARTING; | 75 | smbiod_state = SMBIOD_STARTING; |
| 74 | __module_get(THIS_MODULE); | 76 | __module_get(THIS_MODULE); |
| 75 | spin_unlock(&servers_lock); | 77 | spin_unlock(&servers_lock); |
| 76 | pid = kernel_thread(smbiod, NULL, 0); | 78 | tsk = kthread_run(smbiod, NULL, "smbiod"); |
| 77 | if (pid < 0) | 79 | if (IS_ERR(tsk)) { |
| 80 | err = PTR_ERR(tsk); | ||
| 78 | module_put(THIS_MODULE); | 81 | module_put(THIS_MODULE); |
| 82 | } | ||
| 79 | 83 | ||
| 80 | spin_lock(&servers_lock); | 84 | spin_lock(&servers_lock); |
| 81 | smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING; | 85 | if (err < 0) { |
| 82 | smbiod_pid = pid; | 86 | smbiod_state = SMBIOD_DEAD; |
| 83 | return pid; | 87 | smbiod_thread = NULL; |
| 88 | } else { | ||
| 89 | smbiod_state = SMBIOD_RUNNING; | ||
| 90 | smbiod_thread = tsk; | ||
| 91 | } | ||
| 92 | return err; | ||
| 84 | } | 93 | } |
| 85 | 94 | ||
| 86 | /* | 95 | /* |
| @@ -183,8 +192,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
| 183 | if (req->rq_flags & SMB_REQ_RETRY) { | 192 | if (req->rq_flags & SMB_REQ_RETRY) { |
| 184 | /* must move the request to the xmitq */ | 193 | /* must move the request to the xmitq */ |
| 185 | VERBOSE("retrying request %p on recvq\n", req); | 194 | VERBOSE("retrying request %p on recvq\n", req); |
| 186 | list_del(&req->rq_queue); | 195 | list_move(&req->rq_queue, &server->xmitq); |
| 187 | list_add(&req->rq_queue, &server->xmitq); | ||
| 188 | continue; | 196 | continue; |
| 189 | } | 197 | } |
| 190 | #endif | 198 | #endif |
| @@ -290,8 +298,6 @@ out: | |||
| 290 | */ | 298 | */ |
| 291 | static int smbiod(void *unused) | 299 | static int smbiod(void *unused) |
| 292 | { | 300 | { |
| 293 | daemonize("smbiod"); | ||
| 294 | |||
| 295 | allow_signal(SIGKILL); | 301 | allow_signal(SIGKILL); |
| 296 | 302 | ||
| 297 | VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); | 303 | VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); |
