dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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