lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 16 Mar 2012 11:04:40 +0800
From:	Wang Sheng-Hui <shhuiw@...il.com>
To:	Chris Mason <chris.mason@...cle.com>, linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] btrfs/async-thread.c: decrease workers->num_workers only
 on worker can be freed in btrfs_stop_workers

If the worker cannot be freed, decrease workers->num_workers can
corrupt the statistics. The workers->num_workers should be decreased
only when the worker can be stopped and freed in btrfs_stop_workers.


Signed-off-by: Wang Sheng-Hui <shhuiw@...il.com>
---
 fs/btrfs/async-thread.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 0cc20b3..5a7d756 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -413,9 +413,9 @@ int btrfs_stop_workers(struct btrfs_workers *workers)
 				    worker_list);
 
 		atomic_inc(&worker->refs);
-		workers->num_workers -= 1;
 		if (!list_empty(&worker->worker_list)) {
 			list_del_init(&worker->worker_list);
+			workers->num_workers--;
 			put_worker(worker);
 			can_stop = 1;
 		} else
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ