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]
Message-ID: <415ab1a1454a44129e997d51822ed533@kioxia.com>
Date: Thu, 18 Apr 2024 05:44:23 +0000
From: tada keisuke <keisuke1.tada@...xia.com>
To: "song@...nel.org" <song@...nel.org>,
        "yukuai3@...wei.com"
	<yukuai3@...wei.com>
CC: "linux-raid@...r.kernel.org" <linux-raid@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 09/11] md: add atomic mode switching when removing disk

This patch depends on patch 08.

To minimize the number of execution of atomic mode switching, not only adding atomic mode switching, but also remove judgment is divided into two stages.
Latency is minimized because only rdev to be removed is switched to atomic mode, not all rdevs.

Signed-off-by: Keisuke TADA <keisuke1.tada@...xia.com>
Signed-off-by: Toshifumi OHTAKE <toshifumi.ootake@...xia.com>
---
 drivers/md/md.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7e6966e65d0d..5f785353353d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9291,8 +9291,11 @@ static bool rdev_removeable(struct md_rdev *rdev)
 		return false;
 
 	/* Fautly rdev is not used, it's safe to remove it. */
-	if (test_bit(Faulty, &rdev->flags))
-		return true;
+	if (nr_pending_is_percpu_mode(rdev) && test_bit(Faulty, &rdev->flags)) {
+		percpu_ref_switch_to_atomic_sync(&rdev->nr_pending);
+		if (nr_pending_is_zero(rdev))
+			return true;
+	}
 
 	/* Journal disk can only be removed if it's faulty. */
 	if (test_bit(Journal, &rdev->flags))
@@ -9346,6 +9349,11 @@ static bool md_spares_need_change(struct mddev *mddev)
 {
 	struct md_rdev *rdev;
 
+	rdev_for_each_rcu(rdev, mddev) {
+		if (test_bit(Faulty, &rdev->flags))
+			percpu_ref_switch_to_atomic_sync(&rdev->nr_pending);
+	}
+
 	rcu_read_lock();
 	rdev_for_each_rcu(rdev, mddev) {
 		if (rdev_removeable(rdev) || rdev_addable(rdev)) {
-- 
2.34.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ