dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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