Whamcloud - gitweb
LU-5935 lnet: Fixes to make lnetctl function as expected.
[fs/lustre-release.git] / lnet / lnet / acceptor.c
index 9e9b236..c83843c 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -389,7 +389,6 @@ lnet_accept(cfs_socket_t *sock, __u32 magic)
 int
 lnet_acceptor(void *arg)
 {
-        char           name[16];
         cfs_socket_t  *newsock;
         int            rc;
         __u32          magic;
@@ -399,8 +398,6 @@ lnet_acceptor(void *arg)
 
         LASSERT (lnet_acceptor_state.pta_sock == NULL);
 
-        snprintf(name, sizeof(name), "acceptor_%03d", accept_port);
-        cfs_daemonize(name);
         cfs_block_allsigs();
 
         rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock,
@@ -506,6 +503,7 @@ accept2secure(const char *acc, long *sec)
 int
 lnet_acceptor_start(void)
 {
+       struct task_struct *task;
         int  rc;
         long rc2;
         long secure;
@@ -532,9 +530,11 @@ lnet_acceptor_start(void)
        if (lnet_count_acceptor_nis() == 0)  /* not required */
                return 0;
 
-       rc2 = cfs_create_thread(lnet_acceptor, (void *)(ulong_ptr_t)secure, 0);
-       if (rc2 < 0) {
-               CERROR("Can't start acceptor thread: %d\n", rc);
+       task = kthread_run(lnet_acceptor, (void *)(ulong_ptr_t)secure,
+                          "acceptor_%03ld", secure);
+       if (IS_ERR(task)) {
+               rc2 = PTR_ERR(task);
+               CERROR("Can't start acceptor thread: %ld\n", rc2);
                fini_completion(&lnet_acceptor_state.pta_signal);
 
                return -ESRCH;