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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230627034127.4000994-3-linan666@huaweicloud.com>
Date:   Tue, 27 Jun 2023 11:41:27 +0800
From:   linan666@...weicloud.com
To:     song@...nel.org
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        linan122@...wei.com, yukuai3@...wei.com, yi.zhang@...wei.com,
        houtao1@...wei.com, yangerkun@...wei.com
Subject: [PATCH 2/2] md/raid10: handle replacement devices in fix_recovery_read_error

From: Li Nan <linan122@...wei.com>

In fix_recovery_read_error(), the handling of replacement devices is
missing. Add it. If io error is from replacement, error this device
directly. If io error is from other device, just set badblocks for
replacement.

Signed-off-by: Li Nan <linan122@...wei.com>
---
 drivers/md/raid10.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 5105273f60e9..6d9025089455 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2551,7 +2551,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
 
 	while (sectors) {
 		int s = sectors;
-		struct md_rdev *rdev;
+		struct md_rdev *rdev, *repl;
 		sector_t addr;
 		int ok;
 
@@ -2559,6 +2559,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
 			s = PAGE_SIZE >> 9;
 
 		rdev = conf->mirrors[dr].rdev;
+		repl = conf->mirrors[dw].replacement;
 		addr = r10_bio->devs[0].addr + sect,
 		ok = sync_page_io(rdev,
 				  addr,
@@ -2580,6 +2581,9 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
 					set_bit(MD_RECOVERY_NEEDED,
 						&rdev->mddev->recovery);
 			}
+			if (repl && !sync_page_io(repl, addr, s << 9,
+			    pages[idx], REQ_OP_WRITE, false))
+				md_error(mddev, repl);
 		}
 		if (!ok) {
 			/* We don't worry if we cannot set a bad block -
@@ -2592,7 +2596,9 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
 				/* need bad block on destination too */
 				rdev = conf->mirrors[dw].rdev;
 				addr = r10_bio->devs[1].addr + sect;
-				if (!rdev_set_badblocks(rdev, addr, s, 0)) {
+				if (!rdev_set_badblocks(rdev, addr, s, 0) ||
+				    (repl &&
+				    !rdev_set_badblocks(repl, addr, s, 0))) {
 					/* just abort the recovery */
 					pr_notice("md/raid10:%s: recovery aborted due to read error\n",
 						  mdname(mddev));
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ