Whamcloud - gitweb
LU-2850 kernel: 3.8 upstream kills daemonize()
[fs/lustre-release.git] / lustre / ptlrpc / pinger.c
index 06dc234..ab4822b 100644 (file)
@@ -306,8 +306,6 @@ static int ptlrpc_pinger_main(void *arg)
         struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
        ENTRY;
 
-        cfs_daemonize(thread->t_name);
-
         /* Record that the thread is running */
         thread_set_flags(thread, SVC_RUNNING);
         cfs_waitq_signal(&thread->t_ctl_waitq);
@@ -399,10 +397,10 @@ int ptlrpc_start_pinger(void)
        strcpy(pinger_thread.t_name, "ll_ping");
 
        /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we
-        * just drop the VM and FILES in cfs_daemonize_ctxt() right away. */
-       rc = cfs_create_thread(ptlrpc_pinger_main,
-                              &pinger_thread, CFS_DAEMON_FLAGS);
-       if (rc < 0) {
+        * just drop the VM and FILES in kthread_run() right away. */
+       rc = PTR_ERR(kthread_run(ptlrpc_pinger_main,
+                                &pinger_thread, pinger_thread.t_name));
+       if (IS_ERR_VALUE(rc)) {
                CERROR("cannot start thread: %d\n", rc);
                RETURN(rc);
        }
@@ -670,7 +668,7 @@ static int ping_evictor_main(void *arg)
         time_t expire_time;
         ENTRY;
 
-        cfs_daemonize_ctxt("ll_evictor");
+       unshare_fs_struct();
 
         CDEBUG(D_HA, "Starting Ping Evictor\n");
         pet_state = PET_READY;
@@ -745,18 +743,19 @@ static int ping_evictor_main(void *arg)
 
 void ping_evictor_start(void)
 {
-        int rc;
+       cfs_task_t *task;
 
-        if (++pet_refcount > 1)
-                return;
+       if (++pet_refcount > 1)
+               return;
 
-        cfs_waitq_init(&pet_waitq);
+       cfs_waitq_init(&pet_waitq);
 
-        rc = cfs_create_thread(ping_evictor_main, NULL, CFS_DAEMON_FLAGS);
-        if (rc < 0) {
-                pet_refcount--;
-                CERROR("Cannot start ping evictor thread: %d\n", rc);
-        }
+       task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
+       if (IS_ERR(task)) {
+               pet_refcount--;
+               CERROR("Cannot start ping evictor thread: %ld\n",
+                       PTR_ERR(task));
+       }
 }
 EXPORT_SYMBOL(ping_evictor_start);