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

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