dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/Monitor-check_array-Get-nrdisks-active_disks-and-sp.patch

2c1b57
From b98943a4f889b466a3d07264068042b18c620d33 Mon Sep 17 00:00:00 2001
2c1b57
From: Jes Sorensen <jsorensen@fb.com>
2c1b57
Date: Tue, 9 May 2017 17:03:03 -0400
2c1b57
Subject: [RHEL7.5 PATCH 132/169] Monitor/check_array: Get nr_disks,
2c1b57
 active_disks and spare_disks from sysfs
2c1b57
2c1b57
This leaves working_disks and utime missing before we can eliminate
2c1b57
check_array()'s call to md_get_array_info()
2c1b57
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 Monitor.c | 14 +++++++-------
2c1b57
 1 file changed, 7 insertions(+), 7 deletions(-)
2c1b57
2c1b57
diff --git a/Monitor.c b/Monitor.c
2c1b57
index fe6f2b4..2204528 100644
2c1b57
--- a/Monitor.c
2c1b57
+++ b/Monitor.c
2c1b57
@@ -482,7 +482,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
2c1b57
 		strcpy(st->devnm, fd2devnm(fd));
2c1b57
 
2c1b57
 	sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_DISKS | GET_DEGRADED |
2c1b57
-			 GET_MISMATCH);
2c1b57
+			 GET_MISMATCH | GET_DEVS | GET_STATE);
2c1b57
 	if (!sra)
2c1b57
 		goto disappeared;
2c1b57
 
2c1b57
@@ -525,7 +525,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
2c1b57
 
2c1b57
 	if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
2c1b57
 	    st->working == array.working_disks &&
2c1b57
-	    st->spare == array.spare_disks &&
2c1b57
+	    st->spare == sra->array.spare_disks &&
2c1b57
 	    (mse == NULL  || (mse->percent == st->percent))) {
2c1b57
 		if ((st->active < st->raid) && st->spare == 0)
2c1b57
 			retval = 1;
2c1b57
@@ -535,8 +535,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
2c1b57
 	    mse->pattern && strchr(mse->pattern, '_') /* degraded */)
2c1b57
 		alert("DegradedArray", dev, NULL, ainfo);
2c1b57
 
2c1b57
-	if (st->utime == 0 && /* new array */
2c1b57
-	    st->expected_spares > 0 && array.spare_disks < st->expected_spares)
2c1b57
+	if (st->utime == 0 && /* new array */ st->expected_spares > 0 &&
2c1b57
+	    sra->array.spare_disks < st->expected_spares)
2c1b57
 		alert("SparesMissing", dev, NULL, ainfo);
2c1b57
 	if (st->percent < 0 && st->percent != RESYNC_UNKNOWN &&
2c1b57
 	    mse->percent >= 0)
2c1b57
@@ -574,7 +574,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
2c1b57
 	}
2c1b57
 	st->percent = mse->percent;
2c1b57
 
2c1b57
-	remaining_disks = array.nr_disks;
2c1b57
+	remaining_disks = sra->array.nr_disks;
2c1b57
 	for (i = 0; i < MAX_DISKS && remaining_disks > 0; i++) {
2c1b57
 		mdu_disk_info_t disc;
2c1b57
 		disc.number = i;
2c1b57
@@ -636,9 +636,9 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
2c1b57
 		st->devstate[i] = newstate;
2c1b57
 		st->devid[i] = makedev(disc.major, disc.minor);
2c1b57
 	}
2c1b57
-	st->active = array.active_disks;
2c1b57
+	st->active = sra->array.active_disks;
2c1b57
 	st->working = array.working_disks;
2c1b57
-	st->spare = array.spare_disks;
2c1b57
+	st->spare = sra->array.spare_disks;
2c1b57
 	st->failed = sra->array.failed_disks;
2c1b57
 	st->utime = array.utime;
2c1b57
 	st->raid = sra->array.raid_disks;
2c1b57
-- 
2c1b57
2.7.4
2c1b57