From: <qiang.zhang@windriver.com>
To: <ben.dooks@codethink.co.uk>, <bfields@redhat.com>,
<cl@rock-chips.com>, <peterz@infradead.org>, <pmladek@suse.com>,
<tj@kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] kthread: Don't cancel a work that is being cancelled
Date: Thu, 2 Jul 2020 12:43:24 +0800 [thread overview]
Message-ID: <20200702044324.32927-1-qiang.zhang@windriver.com> (raw)
From: Zhang Qiang <qiang.zhang@windriver.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@windriver.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
next reply other threads:[~2020-07-03 6:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 4:43 qiang.zhang [this message]
2020-07-03 7:28 ` Petr Mladek
2020-07-03 8:57 ` 回复: " Zhang, Qiang
-- strict thread matches above, loose matches on Subject: below --
2020-07-02 1:13 qiang.zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200702044324.32927-1-qiang.zhang@windriver.com \
--to=qiang.zhang@windriver.com \
--cc=ben.dooks@codethink.co.uk \
--cc=bfields@redhat.com \
--cc=cl@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®