summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGioh Kim <gi-oh.kim@cloud.ionos.com>2018-11-06 16:20:17 +0100
committerJes Sorensen <jsorensen@fb.com>2018-12-06 13:52:08 +0100
commit563ac108659980b3d1e226fe416254a86656235f (patch)
tree035da518cb5ed9f29974c162e7cbd493c267a621
parentimsm: update metadata correctly while raid10 double degradation (diff)
downloadmdadm-563ac108659980b3d1e226fe416254a86656235f.tar.xz
mdadm-563ac108659980b3d1e226fe416254a86656235f.zip
Assemble: mask FAILFAST and WRITEMOSTLY flags when finding the most recent device
If devices[].i.disk.state has MD_DISK_FAILFAST or MD_DISK_WRITEMOSTLY flag, it cannot be the most recent device. Both flags should be masked before checking the state. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r--Assemble.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Assemble.c b/Assemble.c
index f39c9e1c..9f75c68c 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -578,6 +578,7 @@ static int load_devices(struct devs *devices, char *devmap,
struct supertype *tst;
int i;
int dfd;
+ int disk_state;
if (tmpdev->used != 1)
continue;
@@ -711,7 +712,9 @@ static int load_devices(struct devs *devices, char *devmap,
devices[devcnt].i.disk.major = major(stb.st_rdev);
devices[devcnt].i.disk.minor = minor(stb.st_rdev);
- if (devices[devcnt].i.disk.state == 6) {
+ disk_state = devices[devcnt].i.disk.state & ~((1<<MD_DISK_FAILFAST) |
+ (1<<MD_DISK_WRITEMOSTLY));
+ if (disk_state == ((1<<MD_DISK_ACTIVE) | (1<<MD_DISK_SYNC))) {
if (most_recent < 0 ||
devices[devcnt].i.events
> devices[most_recent].i.events) {