Re: [PATCH 01/11] io-wq: fix worker counting after worker received exit signal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/9/23 13:20, Hao Xu wrote:
From: Hao Xu <howeyxu@xxxxxxxxxxx>

acct->nr_workers should be decremented when we break the loop in
io_wq_worker().

Fixes: 78f8876c2d9f ("io-wq: exclusively gate signal based exit on get_signal() return")
Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx>
---
  io_uring/io-wq.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index b2715988791e..b70eebec2845 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -634,6 +634,10 @@ static int io_wq_worker(void *data)
if (!get_signal(&ksig))
  				continue;
+
+			raw_spin_lock(&wq->lock);
+			acct->nr_workers--;
+			raw_spin_unlock(&wq->lock);

Wouldn't it suffer the same race you fixed with the following?

commit 767a65e9f31789d80e41edd03a802314905e8fbf
Author: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx>
Date:   Sun Sep 12 03:40:52 2021 +0800

    io-wq: fix potential race of acct->nr_workers



Even more, seems we fail to decrement nr_workers when the loop condition
fails, i.e.

	while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) {


I.e. the patch looks legit, but what we currently have is a mess and we
have more work to do.

--
Pavel Begunkov



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux