dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0007-Assemble-mask-FAILFAST-and-WRITEMOSTLY-flags-when-fi.patch

8fbece
From 563ac108659980b3d1e226fe416254a86656235f Mon Sep 17 00:00:00 2001
8fbece
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
8fbece
Date: Tue, 6 Nov 2018 16:20:17 +0100
8fbece
Subject: [RHEL7.7 PATCH 07/24] Assemble: mask FAILFAST and WRITEMOSTLY flags
8fbece
 when finding the most recent device
8fbece
8fbece
If devices[].i.disk.state has MD_DISK_FAILFAST or MD_DISK_WRITEMOSTLY
8fbece
flag, it cannot be the most recent device. Both flags should be masked
8fbece
before checking the state.
8fbece
8fbece
Reviewed-by: NeilBrown <neilb@suse.com>
8fbece
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
8fbece
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8fbece
---
8fbece
 Assemble.c | 5 ++++-
8fbece
 1 file changed, 4 insertions(+), 1 deletion(-)
8fbece
8fbece
diff --git a/Assemble.c b/Assemble.c
8fbece
index f39c9e1..9f75c68 100644
8fbece
--- a/Assemble.c
8fbece
+++ b/Assemble.c
8fbece
@@ -578,6 +578,7 @@ static int load_devices(struct devs *devices, char *devmap,
8fbece
 		struct supertype *tst;
8fbece
 		int i;
8fbece
 		int dfd;
8fbece
+		int disk_state;
8fbece
 
8fbece
 		if (tmpdev->used != 1)
8fbece
 			continue;
8fbece
@@ -711,7 +712,9 @@ static int load_devices(struct devs *devices, char *devmap,
8fbece
 		devices[devcnt].i.disk.major = major(stb.st_rdev);
8fbece
 		devices[devcnt].i.disk.minor = minor(stb.st_rdev);
8fbece
 
8fbece
-		if (devices[devcnt].i.disk.state == 6) {
8fbece
+		disk_state = devices[devcnt].i.disk.state & ~((1<
8fbece
+							      (1<
8fbece
+		if (disk_state == ((1<
8fbece
 			if (most_recent < 0 ||
8fbece
 			    devices[devcnt].i.events
8fbece
 			    > devices[most_recent].i.events) {
8fbece
-- 
8fbece
2.7.5
8fbece