[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200702044324.32927-1-qiang.zhang@windriver.com>
Date: Thu, 2 Jul 2020 12:43:24 +0800
From: <qiang.zhang@...driver.com>
To: <ben.dooks@...ethink.co.uk>, <bfields@...hat.com>,
<cl@...k-chips.com>, <peterz@...radead.org>, <pmladek@...e.com>,
<tj@...nel.org>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH] kthread: Don't cancel a work that is being cancelled
From: Zhang Qiang <qiang.zhang@...driver.com>
When canceling a work, if it is found that the work is in
the cancelling state, we should directly exit the cancelled
operation.
Signed-off-by: Zhang Qiang <qiang.zhang@...driver.com>
---
kernel/kthread.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/kthread.c b/kernel/kthread.c
index bfbfa481be3a..1166f2043e67 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -1103,6 +1103,9 @@ static bool __kthread_cancel_work_sync(struct kthread_work *work, bool is_dwork)
/* Work must not be used with >1 worker, see kthread_queue_work(). */
WARN_ON_ONCE(work->worker != worker);
+ if (work->canceling)
+ goto out_fast;
+
ret = __kthread_cancel_work(work, is_dwork, &flags);
if (worker->current_work != work)
--
2.24.1
Powered by blists - more mailing lists