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: <20230614084740.1493969-2-linan666@huaweicloud.com>
Date:   Wed, 14 Jun 2023 16:47:38 +0800
From:   linan666@...weicloud.com
To:     song@...nel.org, neilb@...e.de
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 1/3] md/raid10: record rdev/replacement in struct r10bio

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

Getting rdev/replacement from mirror is risky. Replacement can replace
rdev while repl_bio pending, which forces us to add some complex code to
handle this scenario, but there are still some bugs left. Record
rdev/replacement in r10bio and get them from r10bio is a better way. It
is easy to ensure that rdev and replacement remains consistent in io
process, which can help us clean up some code and fix bugs.

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

diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h
index 8c072ce0bc54..261315ffe8c0 100644
--- a/drivers/md/raid10.h
+++ b/drivers/md/raid10.h
@@ -145,12 +145,12 @@ struct r10bio {
 	 */
 	struct r10dev {
 		struct bio	*bio;
-		union {
-			struct bio	*repl_bio; /* used for resync and
-						    * writes */
-			struct md_rdev	*rdev;	   /* used for reads
-						    * (read_slot >= 0) */
-		};
+		/* Currently just used for normal reads and writes */
+		struct md_rdev	*rdev;
+		/* used for resync and writes */
+		struct bio	*repl_bio;
+		/* Currently just used for normal writes */
+		struct md_rdev	*replacement;
 		sector_t	addr;
 		int		devnum;
 	} devs[];
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ