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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230803132426.2688608-10-yukuai1@huaweicloud.com>
Date:   Thu,  3 Aug 2023 21:24:22 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     song@...nel.org, xni@...hat.com
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yukuai1@...weicloud.com, yi.zhang@...wei.com,
        yangerkun@...wei.com
Subject: [PATCH -next 09/13] md: convert to use hot_add_rdev() to hot add one rdev

From: Yu Kuai <yukuai3@...wei.com>

Replace remove_and_add_spares() with hot_add_rdev() in
check_sb_changes(), also handle the case that hot add rdev failed.

Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
 drivers/md/md.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index de7399769c8d..1dc26bb1e096 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9773,13 +9773,20 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
 			    !(le32_to_cpu(sb->feature_map) &
 			      MD_FEATURE_RESHAPE_ACTIVE)) {
 				rdev2->saved_raid_disk = role;
-				ret = remove_and_add_spares(mddev, rdev2);
-				pr_info("Activated spare: %pg\n",
-					rdev2->bdev);
-				/* wakeup mddev->thread here, so array could
-				 * perform resync with the new activated disk */
-				set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
-				md_wakeup_thread(mddev->thread);
+				if (!test_bit(MD_RECOVERY_RUNNING,
+					      &mddev->recovery) &&
+				    hot_add_rdev(rdev2)) {
+					pr_info("Activated spare: %pg\n",
+						rdev2->bdev);
+					/*
+					 * wakeup mddev->thread here, so array
+					 * could perform resync with the new
+					 * activated disk.
+					 */
+					set_bit(MD_RECOVERY_NEEDED,
+						&mddev->recovery);
+					md_wakeup_thread(mddev->thread);
+				}
 			}
 			/* device faulty
 			 * We just want to do the minimum to mark the disk
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ