aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/kthread.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/kthread.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kthread.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/kthread.h b/sys/compat/linuxkpi/common/include/linux/kthread.h
index f85a3f40ac55..61cdc3b8060a 100644
--- a/sys/compat/linuxkpi/common/include/linux/kthread.h
+++ b/sys/compat/linuxkpi/common/include/linux/kthread.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,15 +45,18 @@ static inline void
linux_kthread_fn(void *arg)
{
struct task_struct *task;
+ struct thread *td = curthread;
task = arg;
- task_struct_set(curthread, task);
+ task_struct_fill(td, task);
+ task_struct_set(td, task);
if (task->should_stop == 0)
task->task_ret = task->task_fn(task->task_data);
- PROC_LOCK(task->task_thread->td_proc);
+ PROC_LOCK(td->td_proc);
task->should_stop = TASK_STOPPED;
wakeup(task);
- PROC_UNLOCK(task->task_thread->td_proc);
+ PROC_UNLOCK(td->td_proc);
+ task_struct_set(td, NULL);
kthread_exit();
}