]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - fs/io-wq.c
io-wq: Remove duplicate code in io_workqueue_create()
authorBixuan Cui <cuibixuan@huawei.com>
Sat, 11 Sep 2021 08:58:47 +0000 (16:58 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:33:02 +0000 (07:33 +0100)
commit4b3626b037a7c65f8018f13639ad5be6207c4d94
treedc6fb67df72034c89499af4f277dffd9e98acbd6
parent8b0f7be8cf061dbac3a4ab0ac8e532916b3ada40
io-wq: Remove duplicate code in io_workqueue_create()

BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit 71e1cef2d794338cc7b979d4c6144e1dc12718b5 ]

While task_work_add() in io_workqueue_create() is true,
then duplicate code is executed:

  -> clear_bit_unlock(0, &worker->create_state);
  -> io_worker_release(worker);
  -> atomic_dec(&acct->nr_running);
  -> io_worker_ref_put(wq);
  -> return false;

  -> clear_bit_unlock(0, &worker->create_state); // back to io_workqueue_create()
  -> io_worker_release(worker);
  -> kfree(worker);

The io_worker_release() and clear_bit_unlock() are executed twice.

Fixes: 3146cba99aa2 ("io-wq: make worker creation resilient against signals")
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Link: https://lore.kernel.org/r/20210911085847.34849-1-cuibixuan@huawei.com
Reviwed-by: Hao Xu <haoxu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/io-wq.c