public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Geraldo Nascimento <geraldogabriel@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] workqueue: missing NOT while checking if Workqueue is offline
Date: Sat, 28 May 2022 17:07:00 -0300	[thread overview]
Message-ID: <YpKA5Bdk1Cm6KgKU@geday> (raw)

Greetings,

This is a one-character patch but very important as the kernel workqueue
__cancel_work_timer will cancel active work without the NOT operator
added.

During early boot wq_online is false so with the NOT added it will evaluate
to true. Conversely, after boot is done, workqueue is now true and we want
it to evaluate to false because otherwise it will cancel important work.

Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>

--- workqueue.c	2022-05-28 16:54:12.024176123 -0300
+++ workqueue.c	2022-05-28 16:54:37.698176135 -0300
@@ -3158,7 +3158,7 @@ static bool __cancel_work_timer(struct w
 	 * This allows canceling during early boot.  We know that @work
 	 * isn't executing.
 	 */
-	if (wq_online)
+	if (!wq_online)
 		__flush_work(work, true);
 
 	clear_work_data(work);

             reply	other threads:[~2022-05-28 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 20:07 Geraldo Nascimento [this message]
2022-05-29  1:25 ` [PATCH] workqueue: missing NOT while checking if Workqueue is offline Geraldo Nascimento
2022-05-29  4:29   ` Geraldo Nascimento
2022-05-29  5:24     ` Tejun Heo
2022-05-29  5:53       ` Geraldo Nascimento
2022-05-29  6:14         ` Tejun Heo
2022-05-29  6:41           ` Geraldo Nascimento
2022-05-31  4:13           ` Geraldo Nascimento
2022-05-31 17:43             ` Tejun Heo

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=YpKA5Bdk1Cm6KgKU@geday \
    --to=geraldogabriel@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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