- int rc;
- cfs_waitlink_t wait;
- ENTRY;
-
- /* we're being careful to ensure that the kernel thread is
- * able to set our state to running as it exits before we
- * get to schedule() */
- cfs_waitlink_init(&wait);
- set_current_state(TASK_INTERRUPTIBLE);
- cfs_waitq_add(&debug_ctlwq, &wait);
-
- rc = cfs_kernel_thread(libcfs_debug_dumplog_thread,
- (void *)(long_ptr_t)cfs_curproc_pid(),
- CLONE_VM | CLONE_FS | CLONE_FILES);
- if (rc < 0)
- printk(KERN_ERR "LustreError: cannot start log dump thread: "
- "%d\n", rc);
- else
- cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);
-
- /* be sure to teardown if kernel_thread() failed */
- cfs_waitq_del(&debug_ctlwq, &wait);
- set_current_state(TASK_RUNNING);
+ wait_queue_t wait;
+ struct task_struct *dumper;
+ ENTRY;
+
+ /* we're being careful to ensure that the kernel thread is
+ * able to set our state to running as it exits before we
+ * get to schedule() */
+ init_waitqueue_entry_current(&wait);
+ set_current_state(TASK_INTERRUPTIBLE);
+ add_wait_queue(&debug_ctlwq, &wait);
+
+ dumper = kthread_run(libcfs_debug_dumplog_thread,
+ (void *)(long)current_pid(),
+ "libcfs_debug_dumper");
+ if (IS_ERR(dumper))
+ printk(KERN_ERR "LustreError: cannot start log dump thread:"
+ " %ld\n", PTR_ERR(dumper));
+ else
+ waitq_wait(&wait, TASK_INTERRUPTIBLE);
+
+ /* be sure to teardown if cfs_create_thread() failed */
+ remove_wait_queue(&debug_ctlwq, &wait);
+ set_current_state(TASK_RUNNING);