diff options
author | Igor Mammedov <qwerty0987654321@mail.ru> | 2007-04-03 15:16:43 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-04-03 15:16:43 -0400 |
commit | aaf737adb6937339494d5a7111f0433cd9676db8 (patch) | |
tree | 48129ee253f62c45229f615359db72bcb81624f3 | |
parent | c33f8d32746db12ba353b0a05b25f7893a0ac344 (diff) |
[CIFS] Switch cifsd to kthread_run from kernel_thread
cifsd was the only cifs thread that had not been switched to the newer
kthread interface
Signed-off-by: Igor Mammedov <niallain at gmail.com>
Signed-off-by: Wilhelm Meier <wilhelm.meier@fh-kl.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/connect.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 20ba7dcc9959..9e41f8ea5fbb 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/mempool.h> | 30 | #include <linux/mempool.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/completion.h> | 32 | #include <linux/completion.h> |
33 | #include <linux/kthread.h> | ||
33 | #include <linux/pagevec.h> | 34 | #include <linux/pagevec.h> |
34 | #include <linux/freezer.h> | 35 | #include <linux/freezer.h> |
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
@@ -120,7 +121,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
120 | struct mid_q_entry * mid_entry; | 121 | struct mid_q_entry * mid_entry; |
121 | 122 | ||
122 | spin_lock(&GlobalMid_Lock); | 123 | spin_lock(&GlobalMid_Lock); |
123 | if(server->tcpStatus == CifsExiting) { | 124 | if( kthread_should_stop() ) { |
124 | /* the demux thread will exit normally | 125 | /* the demux thread will exit normally |
125 | next time through the loop */ | 126 | next time through the loop */ |
126 | spin_unlock(&GlobalMid_Lock); | 127 | spin_unlock(&GlobalMid_Lock); |
@@ -182,7 +183,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
182 | spin_unlock(&GlobalMid_Lock); | 183 | spin_unlock(&GlobalMid_Lock); |
183 | up(&server->tcpSem); | 184 | up(&server->tcpSem); |
184 | 185 | ||
185 | while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood)) | 186 | while ( (!kthread_should_stop()) && (server->tcpStatus != CifsGood)) |
186 | { | 187 | { |
187 | try_to_freeze(); | 188 | try_to_freeze(); |
188 | if(server->protocolType == IPV6) { | 189 | if(server->protocolType == IPV6) { |
@@ -199,7 +200,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
199 | } else { | 200 | } else { |
200 | atomic_inc(&tcpSesReconnectCount); | 201 | atomic_inc(&tcpSesReconnectCount); |
201 | spin_lock(&GlobalMid_Lock); | 202 | spin_lock(&GlobalMid_Lock); |
202 | if(server->tcpStatus != CifsExiting) | 203 | if( !kthread_should_stop() ) |
203 | server->tcpStatus = CifsGood; | 204 | server->tcpStatus = CifsGood; |
204 | server->sequence_number = 0; | 205 | server->sequence_number = 0; |
205 | spin_unlock(&GlobalMid_Lock); | 206 | spin_unlock(&GlobalMid_Lock); |
@@ -345,7 +346,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
345 | int isMultiRsp; | 346 | int isMultiRsp; |
346 | int reconnect; | 347 | int reconnect; |
347 | 348 | ||
348 | daemonize("cifsd"); | ||
349 | allow_signal(SIGKILL); | 349 | allow_signal(SIGKILL); |
350 | current->flags |= PF_MEMALLOC; | 350 | current->flags |= PF_MEMALLOC; |
351 | server->tsk = current; /* save process info to wake at shutdown */ | 351 | server->tsk = current; /* save process info to wake at shutdown */ |
@@ -361,7 +361,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
361 | GFP_KERNEL); | 361 | GFP_KERNEL); |
362 | } | 362 | } |
363 | 363 | ||
364 | while (server->tcpStatus != CifsExiting) { | 364 | while (!kthread_should_stop()) { |
365 | if (try_to_freeze()) | 365 | if (try_to_freeze()) |
366 | continue; | 366 | continue; |
367 | if (bigbuf == NULL) { | 367 | if (bigbuf == NULL) { |
@@ -400,7 +400,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
400 | kernel_recvmsg(csocket, &smb_msg, | 400 | kernel_recvmsg(csocket, &smb_msg, |
401 | &iov, 1, 4, 0 /* BB see socket.h flags */); | 401 | &iov, 1, 4, 0 /* BB see socket.h flags */); |
402 | 402 | ||
403 | if (server->tcpStatus == CifsExiting) { | 403 | if ( kthread_should_stop() ) { |
404 | break; | 404 | break; |
405 | } else if (server->tcpStatus == CifsNeedReconnect) { | 405 | } else if (server->tcpStatus == CifsNeedReconnect) { |
406 | cFYI(1, ("Reconnect after server stopped responding")); | 406 | cFYI(1, ("Reconnect after server stopped responding")); |
@@ -524,7 +524,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
524 | total_read += length) { | 524 | total_read += length) { |
525 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, | 525 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, |
526 | pdu_length - total_read, 0); | 526 | pdu_length - total_read, 0); |
527 | if((server->tcpStatus == CifsExiting) || | 527 | if( kthread_should_stop() || |
528 | (length == -EINTR)) { | 528 | (length == -EINTR)) { |
529 | /* then will exit */ | 529 | /* then will exit */ |
530 | reconnect = 2; | 530 | reconnect = 2; |
@@ -757,7 +757,6 @@ multi_t2_fnd: | |||
757 | GFP_KERNEL); | 757 | GFP_KERNEL); |
758 | } | 758 | } |
759 | 759 | ||
760 | complete_and_exit(&cifsd_complete, 0); | ||
761 | return 0; | 760 | return 0; |
762 | } | 761 | } |
763 | 762 | ||
@@ -1850,10 +1849,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1850 | so no need to spinlock this init of tcpStatus */ | 1849 | so no need to spinlock this init of tcpStatus */ |
1851 | srvTcp->tcpStatus = CifsNew; | 1850 | srvTcp->tcpStatus = CifsNew; |
1852 | init_MUTEX(&srvTcp->tcpSem); | 1851 | init_MUTEX(&srvTcp->tcpSem); |
1853 | rc = (int)kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp, | 1852 | srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); |
1854 | CLONE_FS | CLONE_FILES | CLONE_VM); | 1853 | if( IS_ERR(srvTcp->tsk) ) { |
1855 | if(rc < 0) { | 1854 | rc = PTR_ERR(srvTcp->tsk); |
1856 | rc = -ENOMEM; | 1855 | cERROR(1,("error %d create cifsd thread", rc)); |
1856 | srvTcp->tsk = NULL; | ||
1857 | sock_release(csocket); | 1857 | sock_release(csocket); |
1858 | kfree(volume_info.UNC); | 1858 | kfree(volume_info.UNC); |
1859 | kfree(volume_info.password); | 1859 | kfree(volume_info.password); |
@@ -2050,7 +2050,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2050 | spin_unlock(&GlobalMid_Lock); | 2050 | spin_unlock(&GlobalMid_Lock); |
2051 | if(srvTcp->tsk) { | 2051 | if(srvTcp->tsk) { |
2052 | send_sig(SIGKILL,srvTcp->tsk,1); | 2052 | send_sig(SIGKILL,srvTcp->tsk,1); |
2053 | wait_for_completion(&cifsd_complete); | 2053 | kthread_stop(srvTcp->tsk); |
2054 | } | 2054 | } |
2055 | } | 2055 | } |
2056 | /* If find_unc succeeded then rc == 0 so we can not end */ | 2056 | /* If find_unc succeeded then rc == 0 so we can not end */ |
@@ -2064,9 +2064,9 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2064 | temp_rc = CIFSSMBLogoff(xid, pSesInfo); | 2064 | temp_rc = CIFSSMBLogoff(xid, pSesInfo); |
2065 | /* if the socketUseCount is now zero */ | 2065 | /* if the socketUseCount is now zero */ |
2066 | if((temp_rc == -ESHUTDOWN) && | 2066 | if((temp_rc == -ESHUTDOWN) && |
2067 | (pSesInfo->server->tsk)) { | 2067 | (pSesInfo->server) && (pSesInfo->server->tsk)) { |
2068 | send_sig(SIGKILL,pSesInfo->server->tsk,1); | 2068 | send_sig(SIGKILL,pSesInfo->server->tsk,1); |
2069 | wait_for_completion(&cifsd_complete); | 2069 | kthread_stop(pSesInfo->server->tsk); |
2070 | } | 2070 | } |
2071 | } else | 2071 | } else |
2072 | cFYI(1, ("No session or bad tcon")); | 2072 | cFYI(1, ("No session or bad tcon")); |
@@ -3316,7 +3316,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3316 | cFYI(1,("Waking up socket by sending it signal")); | 3316 | cFYI(1,("Waking up socket by sending it signal")); |
3317 | if(cifsd_task) { | 3317 | if(cifsd_task) { |
3318 | send_sig(SIGKILL,cifsd_task,1); | 3318 | send_sig(SIGKILL,cifsd_task,1); |
3319 | wait_for_completion(&cifsd_complete); | 3319 | kthread_stop(cifsd_task); |
3320 | } | 3320 | } |
3321 | rc = 0; | 3321 | rc = 0; |
3322 | } /* else - we have an smb session | 3322 | } /* else - we have an smb session |