dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/Monitor-check_array-Get-faileddisks-from-sysfs.patch

b7f731
From b8e5713c74901862b96bf599ab6fd227addc1498 Mon Sep 17 00:00:00 2001
b7f731
From: Jes Sorensen <jsorensen@fb.com>
b7f731
Date: Tue, 9 May 2017 16:54:19 -0400
b7f731
Subject: [RHEL7.5 PATCH 130/169] Monitor/check_array: Get 'failed_disks'
b7f731
 from sysfs
b7f731
b7f731
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
b7f731
---
b7f731
 Monitor.c | 7 ++++---
b7f731
 1 file changed, 4 insertions(+), 3 deletions(-)
b7f731
b7f731
diff --git a/Monitor.c b/Monitor.c
b7f731
index b94fd7c..9456efd 100644
b7f731
--- a/Monitor.c
b7f731
+++ b/Monitor.c
b7f731
@@ -481,7 +481,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
b7f731
 	if (st->devnm[0] == 0)
b7f731
 		strcpy(st->devnm, fd2devnm(fd));
b7f731
 
b7f731
-	sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_MISMATCH);
b7f731
+	sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_DEGRADED |
b7f731
+			 GET_MISMATCH);
b7f731
 	if (!sra)
b7f731
 		goto disappeared;
b7f731
 
b7f731
@@ -522,7 +523,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
b7f731
 		alert("NewArray", st->devname, NULL, ainfo);
b7f731
 	}
b7f731
 
b7f731
-	if (st->utime == array.utime && st->failed == array.failed_disks &&
b7f731
+	if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
b7f731
 	    st->working == array.working_disks &&
b7f731
 	    st->spare == array.spare_disks &&
b7f731
 	    (mse == NULL  || (mse->percent == st->percent))) {
b7f731
@@ -638,7 +639,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
b7f731
 	st->active = array.active_disks;
b7f731
 	st->working = array.working_disks;
b7f731
 	st->spare = array.spare_disks;
b7f731
-	st->failed = array.failed_disks;
b7f731
+	st->failed = sra->array.failed_disks;
b7f731
 	st->utime = array.utime;
b7f731
 	st->raid = array.raid_disks;
b7f731
 	st->err = 0;
b7f731
-- 
b7f731
2.7.4
b7f731