X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fsmbfs%2Fsmbiod.c;fp=fs%2Fsmbfs%2Fsmbiod.c;h=481a97a423fa5270c1eaa6c2ae4b2db54ad24522;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=e675404412880eb6d602cd7d9de3dbe6aef13c0a;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index e67540441..481a97a42 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c @@ -5,6 +5,7 @@ * Copyright (C) 2001, Urban Widmark */ +#include #include #include @@ -19,7 +20,6 @@ #include #include #include -#include #include #include @@ -40,7 +40,7 @@ enum smbiod_state { }; static enum smbiod_state smbiod_state = SMBIOD_DEAD; -static struct task_struct *smbiod_thread; +static pid_t smbiod_pid; static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); static LIST_HEAD(smb_servers); static DEFINE_SPINLOCK(servers_lock); @@ -67,29 +67,20 @@ void smbiod_wake_up(void) */ static int smbiod_start(void) { - struct task_struct *tsk; - int err = 0; - + pid_t pid; if (smbiod_state != SMBIOD_DEAD) return 0; smbiod_state = SMBIOD_STARTING; __module_get(THIS_MODULE); spin_unlock(&servers_lock); - tsk = kthread_run(smbiod, NULL, "smbiod"); - if (IS_ERR(tsk)) { - err = PTR_ERR(tsk); + pid = kernel_thread(smbiod, NULL, 0); + if (pid < 0) module_put(THIS_MODULE); - } spin_lock(&servers_lock); - if (err < 0) { - smbiod_state = SMBIOD_DEAD; - smbiod_thread = NULL; - } else { - smbiod_state = SMBIOD_RUNNING; - smbiod_thread = tsk; - } - return err; + smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING; + smbiod_pid = pid; + return pid; } /* @@ -192,7 +183,8 @@ int smbiod_retry(struct smb_sb_info *server) if (req->rq_flags & SMB_REQ_RETRY) { /* must move the request to the xmitq */ VERBOSE("retrying request %p on recvq\n", req); - list_move(&req->rq_queue, &server->xmitq); + list_del(&req->rq_queue); + list_add(&req->rq_queue, &server->xmitq); continue; } #endif @@ -298,6 +290,8 @@ out: */ static int smbiod(void *unused) { + daemonize("smbiod"); + allow_signal(SIGKILL); VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);