All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] kthread: Work could not be queued when worker being destroyed
@ 2020-07-05  1:30 qiang.zhang
  2020-07-06 14:59 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: qiang.zhang @ 2020-07-05  1:30 UTC (permalink / raw)
  To: ben.dooks, bfields, cl, peterz, pmladek, tj
  Cc: akpm, mm-commits, linux-kernel

From: Zhang Qiang <qiang.zhang@windriver.com>

Before the work is put into the queue of the worker thread,
the state of the worker thread needs to be detected,because
the worker thread may be in the destruction state at this time.

Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
Suggested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
---
 v1->v2:
 Add warning information for condition "!worker->task".
 v2->v3:
 Modify submission information and add "Reviewed-by" tags. 

 kernel/kthread.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index bfbfa481be3a..cac5184ffd86 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -791,6 +791,9 @@ static inline bool queuing_blocked(struct kthread_worker *worker,
 {
 	lockdep_assert_held(&worker->lock);
 
+	if (WARN_ON(!worker->task))
+		return true;
+
 	return !list_empty(&work->node) || work->canceling;
 }
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-07  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05  1:30 [PATCH v3] kthread: Work could not be queued when worker being destroyed qiang.zhang
2020-07-06 14:59 ` Tejun Heo
2020-07-07  1:26   ` 回复: " Zhang, Qiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.