]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
workqueue: Fix spurious sanity check failures in destroy_workqueue()
authorTejun Heo <tj@kernel.org>
Thu, 19 Sep 2019 01:43:40 +0000 (18:43 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 13:33:22 +0000 (07:33 -0600)
commitdbcc660118fd2c3c23fbfebc2e399af6f5b5a973
tree9d0ce70c852e1b2cd036f7fd903990545f047456
parent115703315f5b25deb6b0b148249d7d2978e1ad54
workqueue: Fix spurious sanity check failures in destroy_workqueue()

BugLink: https://bugs.launchpad.net/bugs/1858424
commit def98c84b6cdf2eeea19ec5736e90e316df5206b upstream.

Before actually destrying a workqueue, destroy_workqueue() checks
whether it's actually idle.  If it isn't, it prints out a bunch of
warning messages and leaves the workqueue dangling.  It unfortunately
has a couple issues.

* Mayday list queueing increments pwq's refcnts which gets detected as
  busy and fails the sanity checks.  However, because mayday list
  queueing is asynchronous, this condition can happen without any
  actual work items left in the workqueue.

* Sanity check failure leaves the sysfs interface behind too which can
  lead to init failure of newer instances of the workqueue.

This patch fixes the above two by

* If a workqueue has a rescuer, disable and kill the rescuer before
  sanity checks.  Disabling and killing is guaranteed to flush the
  existing mayday list.

* Remove sysfs interface before sanity checks.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Marcin Pawlowski <mpawlowski@fb.com>
Reported-by: "Williams, Gerald S" <gerald.s.williams@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/workqueue.c